Menu

System State

Si Dunford (Scaremonger)

Using the SystemState

The SystemState allows you to enable or disable whole sections of your behavior tree based on a simple bitvector.

As an example, maybe you want certain behaviors to be valid only when it is raining. For this situation we might set the Systemstate to hex 00000001.

'# Using the helper function
SetSystemState( $00000001 )

'# Using the BHTree global function
BHTree.SystemState = $00000001

In order to use this you need to manipulate the match property of your objects (Which by default are set to $ffffffff).

When both bitvectors match (Binary AND) then a trait is disabled.

.match=$FFFFFFFE, SystemState=$0000000 = ENABLE
.match=$FFFFFFFE, SystemState=$0000001 = DISABLE

Binary AND is used to disable a traitwith the SystemState AND Match property
A Trait is disabled when the systemSystem property ANDnd the

A Match Criteria can be defined within a BHTreeBuilder file by including the Hex value in the Parameters, for example:

Selector (
    Skidding{$FFFFFFFE}()
    Drive()
    Movement()
)

MongoDB Logo MongoDB