Ambient ai.xls

From Dragon Age Toolset Wiki
Revision as of 22:23, 31 July 2009 by BryanDerksen (Talk | contribs)

Jump to: navigation, search

Ambient Behaviour System

Ambient behaviour begins when the player moves within 50m of a creature and ceases when the player remains more than 50m away for at least 40s. Ambient behaviour alternates between a movement phase and an animation phase, simulating a bubble of activity around the player. In a movement phase, the creature (optionally) moves to a new waypoint or location. In an animation phase, the creature (optionally) performs one or more animations either in sequence or at random. Exact behaviour is controlled by local variables set on either the creature instance or template (see table below). All other local variables with the prefix AMBIENT_* are used internally by the ambient behaviour system (see script sys_ambient_h.nss) and should not be manually modified. Never directly modify AMBIENT_* local variables at run time using SetLocalInteger() - always use the functions Ambient_Start(), Ambient_Stop(), Ambient_OverrideBehaviour(), and Ambient_RestoreBehaviour() instead.

The actions used in an animation phase are listed in the ambient_anim_patterns worksheet of ambient_ai.xls. Each row defines a series actions, each composed of an animation (left of the decimal) and a loop count (right of decimal). For example, 619.02 will play a sleeping animation for 2 loops and 619.99 will play an infinitely looping sleeping animation. Non-looping animations require no looping (i.e. decimal) component. The list of all available animations is located in ANIM_base.xls.

Local Variable Name Type Default Description
AMBIENT_SYSTEM_STATE int 0 Bitmask controlling ambient system operation (ergo, values below are in hexadecimal).
  • 0x01 (AMBIENT_SYSTEM_ENABLED) = Ambient behaviour enabled.
  • 0x02 (AMBIENT_SYSTEM_SPAWNSTART) = Begin ambient behaviour immediately after spawning.
  • 0x04 (AMBIENT_SYSTEM_NOPLAYNEXT) = Sets PlayNext parameter to CommandPlayAnimation() to false.
  • 0x08 (AMBIENT_SYSTEM_NOBLEND) = Sets BlendIn parameter to CommandPlayAnimation to false.
  • 0x10 (AMBIENT_SYSTEM_ALWAYSON) = Ambient behaviour never stops, regardless of distance to player.
AMBIENT_MOVE_PATTERN int 0 Dictates how the creature moves. Add 100 to values below make creature run instead of walk.
  • 0 (AMBIENT_MOVE_NONE) = No movement
  • 1 (AMBIENT_MOVE_PATROL) = Patrol waypoints (1, 2, 3, 2, 1, …)
  • 2 (AMBIENT_MOVE_LOOP) = Loop through waypoints (1, 2, 3, 1, 2, 3, ...)
  • 3 (AMBIENT_MOVE_WARP) = Jump creature from the last waypoint to the first (1, 2, 3, jump to 1, 2, 3, …)
  • 4 (AMBIENT_MOVE_RANDOM) = Walk to random waypoints
  • 5 (AMBIENT_MOVE_WANDER) = Walk to random location within 5m of home location
  • 6 (AMBIENT_MOVE_WANDER_FAR) = Walk to random location within 20m of home location
  • 7 (AMBIENT_MOVE_PATH_PATROL) = Patrol waypoints using CommandMoveToMultiLocations() (1-2-3, 1-2-3, ...)
  • 8 (AMBIENT_MOVE_PATH_LOOP) = Loop through waypoints using CommandMoveToMultiLocations() (1-2-3, 1-2-3, ...)
  • 9 (AMBIENT_MOVE_ONCE) = Walk through the waypoint set once (1-2-3)
AMBIENT_MOVE_PREFIX string ap_<tag> The prefix used to determine the waypoints the creature travels to. Note that '<tag>' is a placeholder filled in at run-time with the tag of the creature. Hence, if a creature has the tag 'dog' and AMBIENT_MOVE_PREFIX is set to 'ap_<tag>', the system will first look for waypoints with tags corresponding to; ap_dog_01, ap_dog_02, etc. If no such waypoints are found, it will attempt to look for waypoints with the tag 'ap_dog'.
AMBIENT_ANIM_PATTERN int 0 Index into ambient_ai.xls specifiying list of possible actions to perform during an animation phase.
AMBIENT_ANIM_FREQ float -1.0 Animation frequency. The portion left of decimal specifies the minimum and the portion right of the decimal specifies the maximum number of animations to play during an animation phase (e.g. 2.4 will play between 2 and 4 animations randomly selected from the appropriate animation pattern). A value of -1.0 causes all animations for an animation pattern to play in the order listed in ambient_ai.xls. Animation pattens that are highlighted in green on the worksheeet should always be played in order (i.e. AMBIENT_ANIM_FREQ = -1.0).
AMBIENT_COMMAND int 0 If non-zero, this value forces the creature to perform a specific command (instead of moving and animating).
  • 1 = Attack target, waiting 1-4s between attacks. Target's tag must be: <attacker tag>_target
  • 2 = Attack a target. Target's tag must be: <attacker tag>_target
Column Type Description
ID int A number that uniquely identifies the entry (unless creating an M2DA override). ID numbers are listed from smallest to highest within a given file but do not need to be consecutive.
Label string Anything in green MUST be played in order.
NoPlayNext int Sets bPlayNext parameter used with CommandPlayAnimation() function to FALSE.
ActionTotal int
Action0 float Format: Animation.Loops
Action1 float
Action2 float
Action3 float
Action4 float
Action5 float
Action6 float
Action7 float
Action8 float
Action9 float
Action10 float
Action11 float
Action12 float