:github_url: hide .. DO NOT EDIT THIS FILE!!! .. Generated automatically from Godot engine sources. .. Generator: https://github.com/godotengine/godot/tree/4.2/doc/tools/make_rst.py. .. XML source: https://github.com/godotengine/godot/tree/4.2/modules/limboai/doc_classes/BTCooldown.xml. .. _class_BTCooldown: BTCooldown ========== **Inherits:** :ref:`BTDecorator` **<** :ref:`BTTask` **<** :ref:`BT` BT decorator that executes its child task only if :ref:`duration` time has passed since the previous execution. .. rst-class:: classref-introduction-group Description ----------- BTCooldown runs its child task only if :ref:`duration` time has passed since the last successful child task execution. It will only consider successful executions unless :ref:`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 :ref:`duration` time didn't pass since the previous execution. .. rst-class:: classref-reftable-group Properties ---------- .. table:: :widths: auto +--------+-------------------------------------------------------------------------+-----------+ | String | :ref:`cooldown_state_var` | ``""`` | +--------+-------------------------------------------------------------------------+-----------+ | float | :ref:`duration` | ``10.0`` | +--------+-------------------------------------------------------------------------+-----------+ | bool | :ref:`process_pause` | ``false`` | +--------+-------------------------------------------------------------------------+-----------+ | bool | :ref:`start_cooled` | ``false`` | +--------+-------------------------------------------------------------------------+-----------+ | bool | :ref:`trigger_on_failure` | ``false`` | +--------+-------------------------------------------------------------------------+-----------+ .. rst-class:: classref-section-separator ---- .. rst-class:: classref-descriptions-group Property Descriptions --------------------- .. _class_BTCooldown_property_cooldown_state_var: .. rst-class:: classref-property String **cooldown_state_var** = ``""`` .. rst-class:: classref-property-setget - void **set_cooldown_state_var** **(** String value **)** - String **get_cooldown_state_var** **(** **)** A boolean variable used to store the cooldown state in the :ref:`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 :ref:`BehaviorTree`. .. rst-class:: classref-item-separator ---- .. _class_BTCooldown_property_duration: .. rst-class:: classref-property float **duration** = ``10.0`` .. rst-class:: classref-property-setget - void **set_duration** **(** float value **)** - float **get_duration** **(** **)** Time to wait before permitting another child's execution. .. rst-class:: classref-item-separator ---- .. _class_BTCooldown_property_process_pause: .. rst-class:: classref-property bool **process_pause** = ``false`` .. rst-class:: classref-property-setget - void **set_process_pause** **(** bool value **)** - bool **get_process_pause** **(** **)** If ``true``, process cooldown when the ``SceneTree`` is paused. .. rst-class:: classref-item-separator ---- .. _class_BTCooldown_property_start_cooled: .. rst-class:: classref-property bool **start_cooled** = ``false`` .. rst-class:: classref-property-setget - 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. .. rst-class:: classref-item-separator ---- .. _class_BTCooldown_property_trigger_on_failure: .. rst-class:: classref-property bool **trigger_on_failure** = ``false`` .. rst-class:: classref-property-setget - 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``. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)` .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)` .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)` .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)` .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)` .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)` .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`