GetBehaviorState(int)
Test whether a creature is in a particular behavior state.
int GetBehaviorState( int nCondition );
Parameters
nCondition
Bitmask of possible behavior state.
Description
Creatures can be created with governing behavior states, as defined by the NW_FLAG_BEHAVIOR_* constants in nw_i0_generic:
//Behavior Constants
int NW_FLAG_BEHAVIOR_SPECIAL = 0x00000001;
int NW_FLAG_BEHAVIOR_CARNIVORE = 0x00000002; //Will always attack regardless of faction
int NW_FLAG_BEHAVIOR_OMNIVORE = 0x00000004; //Will only attack if approached
int NW_FLAG_BEHAVIOR_HERBIVORE = 0x00000008; //Will never attack. Will alway flee.
GetBehaviorState compares nCondition to the creature's behavior state mask, and returns true if they match.
Remarks
This function is described as internal to nw_i0_generic.
Requirements
#include "x0_i0_behavior"
Version
1.22
Example
if(GetBehaviorState(NW_FLAG_BEHAVIOR_HERBIVORE)) { // Do some special grass-nibbling code. }
See Also
functions: | DetermineSpecialBehavior | SetBehaviorState |
categories: | Core AI Functions |
constants: | NW_FLAG_BEHAVIOR_* Constants |
author: Iskander Merriman, editor: John Shuell, Mistress