scripted_sentence

Modified

12-Jul-2023

Allows any monster to speak a pre-assembled sentence or a custom audio file. Does automatic lip-syncing based on the file contents. If sentence have no given name, it will be activated on map start or when search radius is reached.

Keyvalues


OnDestroy Function ondestroyfn : Name of the function to use from already parsed .as script files when entity is destroyed (killed) in any way. If the function belongs to namespace, you must use prefix with the namespace name (e.g. mynamespace::MyFunction) for the keyvalue.

Name targetname : Set name of scripted_sentence so other entities can trigger it to play a sentence. This will only work if "Search Radius" is set to '0'. Every trigger use-type works uniformly. Can be kill-targeted.

Target target : Entity to trigger on sentence play. Trigger use-type is 'Toggle'.

Delay Before Trigger delay : Delay before trigger entity specified in "Target".

Kill Target killtarget : Entity to remove on sentence play.

Sentence Name sentence : Name of sentence from "sentences.txt" or sound file to play. Lip syncing is automatic when sound file is typed. To use sound file write '+' symbol and then filename with path (e.g. if you want to set file located in "svencoop/sound/mymap/bell1.wav", type '+mymap/bell1.wav'.

Speaker Type entity : Name OR classname of monster who will "speak" this sentence. If classname is specified, the search radius is used (sentence is activated when monster with specified classname reach radius).

Sentence Time duration : Duration of monster speaking, in seconds. Best value is a sound file duration.

Search Radius radius : Radius, in units, in which to search for a valid target monster. This will only work if you specified a monster classname for 'Speaker Type'. Disables direct triggering. Set to 0 to disable.

Delay Before Refire refire : Time interval between playing sentence. When sentence have a name this feature is disabled.

Listener Type listener : The name of entity the monster will look at when "speaking" a sentence.

Volume 0-10 volume : Audibility of speaker.

Sound Radius attenuation : Custom sound radius (just like radius flags in ambient_generic).

  • 0 : Small Radius : About ~384 units.
  • 1 : Medium Radius : About ~768 units.
  • 2 : Large Radius : About ~1536 units.
  • 3 : Play Everywhere : The sound will play everywhere.

Flags


  • 1 : Fire Once : Can be activated only once.

  • 2 : Followers Only : Speak only if this monster is following player (by 'USE' follow command).

  • 4 : Interrupt Speech : Override current speech on affected monster (including default ones). Still some monsters interactions can break this sentence.

  • 8 : Concurrent : This sentence cannot be played among other sentences (pick random sentence from those which are called at the moment). Also override any other sentences (like interrupt speech but works globally) except default sentences of other monsters.

Sound files are precached automatically (unlike sentences in monster classes).