:github_url: hide

.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/modules/limboai/doc_classes/BTRunLimit.xml.

.. _class_BTRunLimit:

BTRunLimit
==========

**Inherits:** :ref:`BTDecorator<class_BTDecorator>` **<** :ref:`BTTask<class_BTTask>` **<** :ref:`BT<class_BT>`

BT decorator that restricts the execution of its child a limited number of times.

.. rst-class:: classref-introduction-group

Description
-----------

BTRunLimit restricts the execution of the child task to a maximum number of times, defined by :ref:`run_limit<class_BTRunLimit_property_run_limit>`.

Returns ``FAILURE`` if the limit on executions is exceeded; otherwise, it returns the status of the child task.

.. rst-class:: classref-reftable-group

Properties
----------

.. table::
   :widths: auto

   +-------------------------------------------------+-------------------------------------------------------------+-------+
   | :ref:`CountPolicy<enum_BTRunLimit_CountPolicy>` | :ref:`count_policy<class_BTRunLimit_property_count_policy>` | ``0`` |
   +-------------------------------------------------+-------------------------------------------------------------+-------+
   | ``int``                                         | :ref:`run_limit<class_BTRunLimit_property_run_limit>`       | ``1`` |
   +-------------------------------------------------+-------------------------------------------------------------+-------+

.. rst-class:: classref-section-separator

----

.. rst-class:: classref-descriptions-group

Enumerations
------------

.. _enum_BTRunLimit_CountPolicy:

.. rst-class:: classref-enumeration

enum **CountPolicy**: :ref:`🔗<enum_BTRunLimit_CountPolicy>`

.. _class_BTRunLimit_constant_COUNT_SUCCESSFUL:

.. rst-class:: classref-enumeration-constant

:ref:`CountPolicy<enum_BTRunLimit_CountPolicy>` **COUNT_SUCCESSFUL** = ``0``

Count only successful runs towards the limit.

.. _class_BTRunLimit_constant_COUNT_FAILED:

.. rst-class:: classref-enumeration-constant

:ref:`CountPolicy<enum_BTRunLimit_CountPolicy>` **COUNT_FAILED** = ``1``

Count only failed runs towards the limit.

.. _class_BTRunLimit_constant_COUNT_ALL:

.. rst-class:: classref-enumeration-constant

:ref:`CountPolicy<enum_BTRunLimit_CountPolicy>` **COUNT_ALL** = ``2``

Count successful and failed runs towards the limit.

.. rst-class:: classref-section-separator

----

.. rst-class:: classref-descriptions-group

Property Descriptions
---------------------

.. _class_BTRunLimit_property_count_policy:

.. rst-class:: classref-property

:ref:`CountPolicy<enum_BTRunLimit_CountPolicy>` **count_policy** = ``0`` :ref:`🔗<class_BTRunLimit_property_count_policy>`

.. rst-class:: classref-property-setget

- |void| **set_count_policy**\ (\ value\: :ref:`CountPolicy<enum_BTRunLimit_CountPolicy>`\ )
- :ref:`CountPolicy<enum_BTRunLimit_CountPolicy>` **get_count_policy**\ (\ )

Which runs should be counted towards the limit: successful, failed, or all?

.. rst-class:: classref-item-separator

----

.. _class_BTRunLimit_property_run_limit:

.. rst-class:: classref-property

``int`` **run_limit** = ``1`` :ref:`🔗<class_BTRunLimit_property_run_limit>`

.. rst-class:: classref-property-setget

- |void| **set_run_limit**\ (\ value\: ``int``\ )
- ``int`` **get_run_limit**\ (\ )

The maximum number of times the child is permitted to be executed.

.. |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.)`
.. |void| replace:: :abbr:`void (No return value.)`
