unreal.StateTreeTaskBlueprintBase

class unreal.StateTreeTaskBlueprintBase(outer: Object | None = None, name: Name | str = 'None')

Bases: StateTreeNodeBlueprintBase

  • Base class for Blueprint based Tasks.

C++ Source:

  • Plugin: StateTree

  • Module: StateTreeModule

  • File: StateTreeTaskBlueprintBase.h

Editor Properties: (see get_editor_property/set_editor_property)

  • should_call_tick_only_on_events (bool): [Read-Write] If set to true, Tick() is called. Default false.

  • should_copy_bound_properties_on_exit_state (bool): [Read-Write] If set to true, copy the values of bound properties before calling ExitState(). Default true.

  • should_copy_bound_properties_on_tick (bool): [Read-Write] If set to true, copy the values of bound properties before calling Tick(). Default true.

  • should_state_change_on_reselect (bool): [Read-Write] If set to true, the task will receive EnterState/ExitState even if the state was previously active. Generally this should be true for action type tasks, like playing animation, and false on state like tasks like claiming a resource that is expected to be acquired on child states.

finish_task(succeeded=True) None

Finish the task and sets it’s status.

Parameters:

succeeded (bool) –

receive_enter_state(transition) StateTreeRunStatus

Receive Enter State deprecated: Use the new EnterState event without without return value instead. Task status is now controlled via FinishTask node, instead of a return value. Default status is running.

Parameters:

transition (StateTreeTransitionResult) –

Return type:

StateTreeRunStatus

receive_exit_state(transition) None

Called when a current state is exited and task is part of active states.

Parameters:

transition (StateTreeTransitionResult) – Describes the states involved in the transition

receive_latent_enter_state(transition) None

Called when a new state is entered and task is part of active states. Use FinishTask() to set the task execution completed. State completion is controlled by completed tasks.

GameplayTasks and other latent actions should be generally triggered on EnterState. When using a GameplayTasks it’s required to manually cancel active tasks on ExitState if the GameplayTask’s lifetime is tied to the State Tree task.

Parameters:

transition (StateTreeTransitionResult) – Describes the states involved in the transition

receive_latent_tick(delta_time) None

Called during state tree tick when the task is on active state. Use FinishTask() to set the task execution completed. State completion is controlled by completed tasks.

Triggering GameplayTasks and other latent action should generally be done on EnterState. Tick is called on each update (or event) and can cause huge amount of task added if the logic is not handled carefully. Tick should be generally be used for monitoring that require polling, or actions that require constant ticking.

Note: The method is called only if bShouldCallTick or bShouldCallTickOnlyOnEvents is set.

Parameters:

delta_time (float) – Time since last StateTree tick.

receive_state_completed(completion_status, completed_active_states) None

Called right after a state has been completed, but before new state has been selected. StateCompleted is called in reverse order to allow to propagate state to other Tasks that are executed earlier in the tree. Note that StateCompleted is not called if conditional transition changes the state.

Parameters:
  • completion_status (StateTreeRunStatus) – Describes the running status of the completed state (Succeeded/Failed).

  • completed_active_states (StateTreeActiveStates) – Active states at the time of completion.

receive_tick(delta_time) StateTreeRunStatus

Receive Tick deprecated: Use the new Tick event without without return value instead. Task status is now controlled via FinishTask node, instead of a return value. Default status is running.

Parameters:

delta_time (float) –

Return type:

StateTreeRunStatus