: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/BTRepeat.xml.

.. _class_BTRepeat:

BTRepeat
========

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

BT decorator that repeats its child a specified number of :ref:`times<class_BTRepeat_property_times>`.

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

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

BTRepeat iterates its child task a specified number of times, as defined by :ref:`times<class_BTRepeat_property_times>`. If :ref:`forever<class_BTRepeat_property_forever>` is ``true``, the child's execution will be repeated indefinitely.

Returns ``RUNNING`` if the child task results in ``RUNNING``. If :ref:`forever<class_BTRepeat_property_forever>` is ``true``, BTRepeat will always return ``RUNNING``.

Returns ``SUCCESS`` if the specified number of successful executions is reached. If :ref:`abort_on_failure<class_BTRepeat_property_abort_on_failure>` is ``false``, a ``FAILURE`` status returned by the child is also considered a successful execution.

Returns ``FAILURE`` if the child task results in ``FAILURE`` when :ref:`abort_on_failure<class_BTRepeat_property_abort_on_failure>` is ``true``.

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

Properties
----------

.. table::
   :widths: auto

   +----------+-------------------------------------------------------------------+-----------+
   | ``bool`` | :ref:`abort_on_failure<class_BTRepeat_property_abort_on_failure>` | ``false`` |
   +----------+-------------------------------------------------------------------+-----------+
   | ``bool`` | :ref:`forever<class_BTRepeat_property_forever>`                   | ``false`` |
   +----------+-------------------------------------------------------------------+-----------+
   | ``int``  | :ref:`times<class_BTRepeat_property_times>`                       | ``1``     |
   +----------+-------------------------------------------------------------------+-----------+

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

----

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

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

.. _class_BTRepeat_property_abort_on_failure:

.. rst-class:: classref-property

``bool`` **abort_on_failure** = ``false`` :ref:`🔗<class_BTRepeat_property_abort_on_failure>`

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

- |void| **set_abort_on_failure**\ (\ value\: ``bool``\ )
- ``bool`` **get_abort_on_failure**\ (\ )

If ``false``, ``FAILURE`` status returned by the child task is also considered as a successful execution.

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

----

.. _class_BTRepeat_property_forever:

.. rst-class:: classref-property

``bool`` **forever** = ``false`` :ref:`🔗<class_BTRepeat_property_forever>`

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

- |void| **set_forever**\ (\ value\: ``bool``\ )
- ``bool`` **get_forever**\ (\ )

If ``true``, the child's execution will be repeated indefinitely, always returning ``RUNNING``.

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

----

.. _class_BTRepeat_property_times:

.. rst-class:: classref-property

``int`` **times** = ``1`` :ref:`🔗<class_BTRepeat_property_times>`

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

- |void| **set_times**\ (\ value\: ``int``\ )
- ``int`` **get_times**\ (\ )

The number of times to repeat execution of the child task.

.. |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.)`
