Script:speak

From Arx Libertatis Wiki
Jump to navigation Jump to search

The speak script command is used to speak a line with text and/or sound for an entity. Each entity can only have one speech in progress. Calling this command again before it completes will replace the active speech. To stop the speech of the calling entity without starting a new one use speak []. To stop speech of all entities use speak killall.

Usage

speak [-tuphao] <speech*> <command...>
speak -c[tuphao] keep <speech*> <command...>
speak -c[tuphao] zoom <p0*> <y0*> <p1*> <y1*> <d0*> <d1*> <speech*> <command...>
speak -c[tuphao] <mode> <target> <d0*> <d1*> <speech*> <command...>
speak []
speak killall

Context: Any Entity

Flags:

 -t: Don't show any text - this is implicit when the cinematic border is not active
 -u: Don't allow skipping this line using escape
 -p: Use the player as the speaker instead of the calling entity
 -h: Use the talk_happy animation instead of talk_neutral
 -a: Use the talk_angry animation instead of talk_neutral
 -o: Play sound in front of the player instead of at the entity's position
 -c: Play cinematic speech (ignored if no completion command is given)

Parameters:

ParameterTypeDescription
mode (requires -c) string Camera mode
target (requires -c) entity Entity to focus the camera on
p0 (requires -c) number or variable Start camera pitch
y0 (requires -c) number or variable Start camera yaw
p1 (requires -c) number or variable End camera pitch
y1 (requires -c) number or variable End camera pitch
d0 (requires -c) number or variable Start camera distance
d1 (requires -c) number or variable End camera distance
speech text or variable Localization key for the text to speak
command command A command to execute after the speech completes

Context is ignored if the -o flag is given.

The sound is played from the speaker's position with the speak pitch configured for that entity using the setspeakpitch (for NPCs).

Audio sample location

The speech audio is loaded from speech/<language>/<speech><variant>.wav.

Variant is a randomized integer for -t if there are multiple strings under the given localization key (empty for variant 1).

Speech controlled camera

With the -c flag the player camera will be controlled during the speech. This has no effect while another camera has been activated using the cameraactivate command. The type of camera movement is given as the first parameter:

Mode Description
keep Use the previous speech camera position and angle, do not move the camera during the speech
zoom Look at the given target from a position interpolated from the given angles and distance
ccctalker_l Look at the given target from a position offset towards the left between the speaker and target
ccctalker_r Look at the given target from a position offset towards the right between the speaker and target
ccclistener_l Look at the speaker from a position offset towards the left between the target and speaker
ccclistener_r Look at the speaker from a position offset towards the right between the target and speaker
side_l Look at a position between target and speaker from the left side
side_r Look at a position between target and speaker from the right side
side Alias for side_r

Unlike the audio playback position, the camera will use the position the speaker and listener had when speak was called even if those entities move.

Audio playback command comparison

play playspeech speak cine
Text shown with cinemascope on unless -t is used
Localized text entry required unless -t is used
Character is animated
Player camera is controlled with -c
Sample loaded relative to sfx speech/<language> speech/<language> sfx or speech/<language>
Randomized sample with -t if there are multiple
Playback speed (pitch) 1× or random in [0.9,1.1]× NPC pitch unless invisible or in inventory NPC pitch unless -o is used
Playback relative to entity (player if in player inventory) entity (player if invisible or in inventory) entity (player with -p/-o) camera
Playback position updates when moving ( if in player inventory) ( if invisible or in inventory)
Command executed on completion cine_end event