NEWS
   Current / Submit
   Archive

   HELP
   Walkthrough
   Cheats
   Editing

   COMMUNITY
   Forums
   Fan Fiction
   Fan Art
   Links

   FILES
   Game Demo
   Patch
   Editing Tools
   Community maps
   Movies
   Music
   Submit

   UNDYING
   Game Info
   Features
   Requirements
   Screenshots
   Characters
   Enemies
   NPCs
   Weapons
   Spells
   Inventory
   Macintosh
   Playstation2
   FAQ

   JERICHO
   Game Info


   SITE
   Site Info
   Contact Email




AI Scripting (formerly AI Dialog Scripting)

This document describes the techniques used for in-game scripted sequences. There are 3 essential components for these situations. Each is discussed in detail below. This document and the Narrator Script system were both written by Michael Goodwin.

[O] 1. Scripted Actor
This is the actor that follows the scripted sequence. Though originally implemented only for the ScriptedNarrator class, this functionality is now available for any subclass of ScriptedPawn. This means that any AI creature can use this feature. A scripted actor can be given an initial script that is executed until another sequence is triggered. When the subsequent sequence is triggered, the scripted actor can be made to execute another script. The relevant properties of ScriptedPawn class can be located within the AIScript group and are:

ScriptTag This specifies the Tag property of the script object for the scripted actor’s initial script. This is the script that is executed until the dialog sequence is triggered.
ScriptAction This specifies the starting action number within the assigned initial script. Note: this also tracks the current position within the current script.
TriggerScriptTag This specifies the Tag property of the script object for the scripted actor’s triggered dialog sequence. If this is not specified, the dialog sequence uses the current script.
TriggerScriptAction This specifies the starting action number within the dialog sequence script.


[O] 2. Script
A script (within the context of in-game dialog) is a list of actions that a scripted actor executes. The scripts used by scripted actors are of the NarratorScript class, which is an immediate subclass of Info. A NarratorScript currently consists of an array of (up to) 20 actions that the scripted actor executes in sequence. The relevant properties of the NarratorScript class are:
ActionList This is the array of actions for this script.
For each entry in the ActionList, there is one property that specifies the action and four additional properties that are used to clarify the action. These properties are:
Action This is the action to perform.
ActionName This is a generic name property used to clarify an action.
ActionSound This is a Sound property used to clarify an action.
ActionValue This is a generic numeric value used to clarify an action.
ActionBool This is a generic boolean (true/false) value used to clarify an action.
Some of these parameters are required, some are optional and some are ignored, depending on the value specified by the Action property. The available actions for the Action property are:
ACTION_None This is the default action for each entry. The scripted actor does nothing when executing this action. Note: This action is useful as a placeholder for an undefined and/or future action.
ACTION_WalkToPoint The scripted actor will walk to a point.
ActionName (required) specifies the Tag property of a NavigationPoint object.
ActionSound (optional) specifies a sound to play when the walk action begins.
ActionBool (optional) specifies whether to proceed to the next instruction (true) or wait and turn toward the orientation of the NavigationPoint (false) when reached.
ActionValue (optional) specifies a time (in seconds) to delay after reaching the point.
ACTION_RunToPoint The scripted actor will run to a point.
ActionName (required) specifies the Tag property of a NavigationPoint object.
ActionSound (optional) specifies a sound to play when the run action begins.
ActionBool (optional) specifies whether to proceed to the next instruction (true) or wait and turn toward the orientation of the NavigationPoint (false) when reached.
ActionValue (optional) specifies a time (in seconds) to delay after reaching the point.
ACTION_WalkToPlayer The scripted actor will walk to a point near the player.
ActionValue (optional) specifies a distance offset to use when calculating the destination point. Elaboration needed.
ActionSound (optional) specifies a sound to play when the walk action begins.
ACTION_RunToPlayer The scripted actor will run to a point near the player.
ActionValuez (optional) specifies a distance offset to use when calculating the destination point. Elaboration needed.
ActionSound (optional) specifies a sound to play when the run action begins.
ACTION_SpeakCasual The scripted actor will play a sound while randomly playing "casual" speaking animations.
ActionSound (required) specifies the sound to play.
ActionValue (optional) specifies a time (in seconds) to delay after the sound finishes playing.
ACTION_SpeakImplore The scripted actor will play a sound while randomly playing "imploring" speaking animations.
ActionSound (required) specifies the sound to play.
ActionValue (optional) specifies a time (in seconds) to delay after the sound finishes playing.
ACTION_SpeakInquisitive The scripted actor will play a sound while randomly playing "inquisitive" speaking animations.
ActionSound (required) specifies the sound to play.
ActionValue (optional) specifies a time (in seconds) to delay after the sound finishes playing.
ACTION_SpeakMumble The scripted actor will play a sound and immediately proceed to the next action.
ActionSound (required) specifies the sound to play.
ACTION_PlayAnimation The scripted actor will play an animation.
ActionName (required) specifies the animation name.
ActionSound (optional) specifies a sound to play when the animation action begins.
ActionBool (optional) specifies whether to wait for the animation to finish before proceeding.
ActionValue (optional) specifies a time (in seconds) to delay before proceeding. Elaboration needed.
ACTION_LoopAnimation The scripted actor will loop an animation.
ActionName (required) specifies the animation name.
ActionSound (optional) specifies a sound to play when the animation begins.
ActionValue (optional) specifies a time (in seconds) to delay before proceeding.
ACTION_Trigger The scripted actor will trigger an event. Note: when a scripted actor is triggered, it remembers the actor that triggered it. When a trigger action is executed, the scripted actor passes this information on to all triggered actors.
ActionName (required) specifies the name of the event to trigger.
ActionSound (optional) specifies a sound to play when the trigger action occurs.
ActionValue (optional) specifies a time (in seconds) to delay before proceeding.
ACTION_Wait The scripted actor will play its waiting animation and wait for some time.
ActionSound (optional) specifies a sound to play when the wait begins.
ActionValue (optional) specifies a time (in seconds) to wait. If unspecified, the default value of zero is used.
ACTION_Goto The scripted actor will go to an action within the current script.
ActionValue (optional) specifies the action number (entry number in the ActionList array) to go to. If unspecified, the default value of zero is used.
ACTION_GotoState The scripted actor will change to an AI state.
ActionName (required) specifies the state to change to. NOTE: Once the creature leaves the AIRunScript state via ACTION_GotoState, it will not return unless triggered.
ACTION_GotoScript The scripted actor will locate a script and begin executing it.
ActionName (required) specifies the Tag of the script.
ActionValue (optional) specifies the action number (entry number in the ActionList array) to go to. If unspecified, the default value of zero is used.
ACTION_UnlockPlayer The scripted actor will disengage the LockPlayerTrigger that was used to trigger the dialog sequence, if any.
ACTION_PlayerSpeak The scripted actor will cause the player to play a sound.
ActionSound (required) specifies the sound to play.
ACTION_Unlook The scripted actor will stop looking at the player.
ACTION_LeashPlayer The scripted actor will make or break the tether to the player. When the player is tethered, he will follow the scripted actor wherever he goes.
ActionBool (required) specifies whether to leash (true) or unleash (false) the player.
ACTION_JumpToPoint The scripted actor will attempt to jump from its current location to a point.
ActionName (required) specifies the Tag property of a NavigationPoint object.
ActionSound (optional) specifies a sound to play when the animation begins.
ACTION_Vanish The scripted actor will destroy itself.
ActionSound (optional) specifies a sound to play when the animation begins.
ACTION_PlayerDetect The scripted actor will enable or disable its visual and aural detection of the player.
ActionBool (required) specifies whether to enable (true) or disable (false) the senses.
ACTION_EndScript The scripted actor will cease script execution.
ACTION_CallState The scripted actor will call an AI state.
ActionName (required) specifies the state to call.
ActionSound (optional) specifies a sound to play when the animation begins.
ACTION_CallScript The scripted actor will locate another script and begin executing it. When ACTION_Return is encountered in the sub-script, control will return to the calling script. NOTE: If the ACTION_Return is absent from the sub-script, control will return to the calling script when the end of the sub-script is reached.
ActionName (required) specifies the Tag property of the script.
ActionValue (optional) specifies the action number (entry number in the ActionList array) to go to. If unspecified, the default value of zero is used.
ACTION_Return Ends a sub-script, returning control to the calling script.
ACTION_SetTag The scripted actor will set its Tag property.
ActionName (required) specifies the value with which to set the Tag property.
ACTION_Die The scripted actor will commit suicide.
ActionName (optional) specifies the name to pass as the damage type for the death animation.
ACTION_FadeOut The scripted actor will fade to 0.0 opacity (complete transparency).
ActionValue (required) specifies the time (in seconds) for the fade effect.
ACTION_FadeIn The scripted actor will fade to 1.0 opacity (complete opacity).
ActionValue (required) specifies the time (in seconds) for the fade effect.
ACTION_LookAt The scripted actor will attempt to look at another actor.
ActionName (optional) specifies the Tag property of an actor to look at. If unspecified, the scripted actor will cancel any previous looking commands.


[O] 3. Trigger
A trigger is the object responsible for starting the scripted dialog sequence. Using the event/tag mechanism, the trigger specifies the scripted actor(s) that will participate in the scripted dialog sequence. When a scripted actor is triggered, it locates the script specified by its TriggerScriptTag property and begins execution at the action specifed by its TriggerScriptAction property.

In most instances, the trigger will be a LockPlayerTrigger. In the LockPlayerTrigger, the bLetterBox property should be set and the LockTimer property should specify an amount of time greater than that required for the scripted dialog sequence. The scripted actor should use the ACTION_UnlockPlayer action to free the lock.