BTCooldown
Inherits: BTDecorator < BTTask < BT
BT decorator that executes its child task only if duration time has passed since the previous execution.
Description
BTCooldown runs its child task only if duration time has passed since the last successful child task execution. It will only consider successful executions unless trigger_on_failure is set to true
.
Returns RUNNING
, if the child task results in RUNNING
.
Returns SUCCESS
, if the child task results in SUCCESS
, and triggers the cooldown timer.
Returns FAILURE
, if the child task results in FAILURE
or if duration time didn’t pass since the previous execution.
Properties
StringName |
|
|
float |
|
|
bool |
|
|
bool |
|
|
bool |
|
Property Descriptions
StringName cooldown_state_var = &""
void set_cooldown_state_var ( StringName value )
StringName get_cooldown_state_var ( )
A boolean variable used to store the cooldown state in the Blackboard. If left empty, the variable will be automatically generated and assigned.
If the variable’s value is set to true
, it indicates that the cooldown is activated. This feature is useful for checking the cooldown state from other parts of the tree or sharing it among different sections of the BehaviorTree.
float duration = 10.0
void set_duration ( float value )
float get_duration ( )
Time to wait before permitting another child’s execution.
bool process_pause = false
void set_process_pause ( bool value )
bool get_process_pause ( )
If true
, process cooldown when the SceneTree
is paused.
bool start_cooled = false
void set_start_cooled ( bool value )
bool get_start_cooled ( )
If true
, initiate a cooldown as if the child had been executed before the first BT tick.
bool trigger_on_failure = false
void set_trigger_on_failure ( bool value )
bool get_trigger_on_failure ( )
If true
, the cooldown will be activated if the child task also returns FAILURE
. Otherwise, the cooldown will only be triggered when the child task returns SUCCESS
.