Skip to content

WalkWhenAnim

Perform Wander when the entity animstate is Walk (or Idle if the behaviorcooldown expired) or change it to the frequency when it's not with a behaviorcooldown of 20.0 frames (prevents another Wander cycle to process for 20.0 frames when entity.animstate is Idle).

Frequency meaning

An animstate to set the entity one when the current one is different and it's not Walk (or Idle when the behaviorcooldown expired).

About this behavior and animation events

This behavior is intended to be used with an animstate as the frequency whose clip contains an animation event that sets the entity.animstate to Walk (or after, but only applicable when behaviorcooldown expires). This is because under normal circumstances, there is no logic to change the entity.animstate to these 2 that is offered by this behavior. It is intended to be used whenever the timing of the Wander needs to be carefully determined by the animation clip instead of immediately triggering when the behavior gets switched to.

It can be used as the default behavior while ChaseWhenAnim is the inrange one. This allows behaviorcooldown to take effect and not change the entity.animstate too frequently.

DoBehavior

If the entity.animstate is Walk (or Idle if the behaviorcooldown expired), this acts as an alias to Wander.

Otherwise, if the current entity.animstate isn't the frequency:

  • The behaviorcooldown is set to 20.0 (prevents another Wander cycle to process for 20.0 frames when entity.animstate is Idle)
  • StopForceMove is called on the entity
  • The entity.animstate is set to frequency