AI Instinct - SenseDanger

Instinct Arguments

With regard to unit clarification, 1 JKU is the equivalent of 1 meter, a time value of 3000.0 msec is the equivalent of 3 seconds and boolean values within are assigned by either a 0 (false) or 1 (true) value. Interestingly, both integer and floating-point numbers seem to be legal values for boolean arguments (but must be of the form 0.0 or 1.0).


Each instinct has a set number of arguments which must be set, in order for the AI character to use that instinct. The following details show examples, as well as listing each argument effect and type.

    SenseDanger     0.10, 1.00  [ Flee on sight of the player ]
    SenseDanger     0.10, 0.0   [ Flee on sight of combat ] 
    SenseDanger     100.0, 0.0  [ Flee only when damaged ]
Argument 1: Sensibility to danger (%: ranges from 0=danger sensed at "first sight of combat" to 100=AI has to be hit once to be "intimidated")
Argument 2: If <> 0, AI flees at first sight, else (=0) at the condition in Argument 1


Expanded Information

[ Cross-Reference: Flee and Retreat ]


This instinct specifies conditions upon which the AI should initiate its Flee instinct. Unlike Retreat which can make an enemy flee, SenseDanger will explicity make the AI character flee upon completion of its conditions. With regard to argument information, argument 1 is unusual in-so-far-as its maximum setting is 100 (rather than 1.0) and sets the AI's perception towards any potential danger. Argument 2 is used to set the conditions of this instinct if the result of argument 1 has had no effect (or whether no effect was intended). What *can* be confusing for editors is trying to work out which of the two arguments initially invokes this instinct. Logically, argument 2 takes precedence; argument 1 is initialised and despite the value it is assigned, as long as argument 2 isn't 0 or 0.0, then the AI will not run away from the player (however - agressive behaviour or the AI receiving damage will trigger this instinct, culminating with the "Flee" instinct being activated). Effectively, what this means is that argument 1 is the minimum requirement to trigger this instinct (if 0, it will always be triggered), whilst argument 2 will trigger this instinct on sight (a non-0 value will make the AI flee if it sees the player).


Instinct Trigger Studies

This section details how the instinct is initiated. In some cases, a charactor's AI are dependent upon certain actions/events occurring before the instinct is triggered.

  • Instinct Dependency - Flee
  • Triggered by - This instinct's arguments values define the course of action to take
  • Upon Immediate Initialisation - Sets the AI character's sensitivity to danger (pending completion of a valid argument)


Testing Notes

With the assumption that LookForTarget is present in the AI file, the results of testing are as follows (where A[number] means Argument[number]):

  • A1=0.0 + A2=0.0 -> If the player has not entered the AI's FOV then the AI will flee if hit. If the player has entered the AI's FOV then the AI will not flee when hit.
  • A1=1.0 + A2=0.0 -> If the player has not entered the AI's FOV then the AI will flee if combat hit or when combat breaks out. This appears to be loosely tied to the "heardist" attribute value in the AI Setup line. If the player has entered the AI's FOV then the AI will not flee when hurt or when combat begins.
  • A1=0.0 + A2=1.0 -> The AI retreats merely from the player's presence, usually upon being sighted. The AI will not proceed to flee on the basis of whether it is hurt/damaged.
  • A1=1.0 + A2=1.0 -> The AI retreats at everything - whether it be sighting the player, the AI taking damage or just general combat ensuing in its vicinity.


Please note that valid values range from 0.0 to 100.0 for argument 1 - if a 50/50 choice is desired then set the argument values to 0.5. It is highly recommended to peruse the default pedestrian/civilian AI files, to find a balance that best suits the tone of the character when applying this AI instinct.

  • Create:
This page was last modified 21:21, 3 December 2005.   This page has been accessed 227 times.