StateTree nodes
All nodes are in the category Pulse AI and only need the AIController context (bound automatically). Movement tasks take a speed preset (Keep, Walk, Run) from the profile.
Tasks
| Task | Does | Ends |
|---|---|---|
| Move To (Pulse) | Moves to an actor, the current target (follows changes) or a location | Succeeds on arrival, fails without path or target |
| Patrol | Walks the patrol route (agent’s or bound), waits at points, continues where it stopped: the progress is kept on the agent (GetPatrolProgress, FPulseAIPatrolProgress) and reset by a new route (SetPatrolRoute) | Runs (or succeeds at the next point without Loop); fails without route |
| Wander | Random reachable points around home or the pawn, with waits | Runs (or succeeds once) |
| Keep Distance | Circles the target between min and max distance, facing it | After Duration, or runs |
| Flee | Steps away from a threat (current target) on the navmesh | Succeeds at the safe distance, fails when cornered |
| Return Home | Walks home, forgets targets; sends Pulse.AI.Event.Reset on arrival | Succeeds on arrival |
| Investigate | Goes to the investigate location (or a bound one) and looks around | Succeeds after looking, fails without location |
| Focus Target | Looks at an actor or the current target | Runs |
| Set Move Speed | Applies a speed preset | Runs (or succeeds with Finish Immediately) |
| Select Target | Picks the current target now or forces one; output Target | Fails without target |
| Set Awareness | Sets the level (Unaware forgets everything) | Runs (or succeeds) |
| Raise Alarm | Allies in the radius and the group become Alert; output Receivers | Succeeds (or runs) |
| Telegraph | Announces an action on all machines (OnTelegraph, cue tag) | Succeeds after Duration |
| Play Montage (Pulse) | Plays a montage on all machines | Succeeds when it ends |
| Activate Ability | Activates GAS abilities by tag, or by gameplay event with the target | Waits for the end (by tag), fails if none started |
| Send Gameplay Event | Sends a gameplay event to the pawn or the target | Succeeds (or runs) |
| Use Smart Object | Claims a free gameplay-behavior smart object slot nearby, walks there and uses it | Succeeds when the behavior ends; leaving the state stops it |
Instant tasks run on by default so they can sit next to other tasks in a state; set Finish Immediately when the task is alone in its state.
Conditions
| Condition | True when |
|---|---|
| Has Target | The agent has a current target |
| Target In Range | Distance (and angle, sight) to an actor or the current target are within limits |
| Awareness Is | The level is at least / exactly / below a level |
| Beyond Leash | Farther from home than the profile’s leash (+ extra); On Target: where the current target stands (false without target), so a guard stops at the edge of its leash instead of following |
| Has Role | The agent has a role (profile or group) |
| Has Gameplay Tag | The pawn (or target) has one of the tags |
| Health Below | The health of the pawn (or target) is below a percentage: Pulse.Stat.Health of its attribute source, with or without GAS (false without health) |
| Chance | Random, optionally scaled by aggression |
| Pulse Conditions | Pulse conditions of Pulse Foundation hold (an item, quest or team of the target player, tags, a Blueprint condition): the agent’s pawn as instigator, the target (default: the current target) as target and, when it belongs to a player, as player, the profile as source, the agent’s team as tags. Unknown counts as false. |
Evaluator and considerations
Target Info outputs target, distance, angle, sight, last known location, awareness, investigate location, home, distance from home, leash and aggression for bindings. Considerations Target Distance, Awareness, Aggression and Health (of the pawn or the target, full without health) score states for utility selection.
Own nodes
USTRUCT()
struct FMyTaskInstanceData
{
GENERATED_BODY()
UPROPERTY(EditAnywhere, Category = Context)
TObjectPtr<AAIController> AIController;
};
USTRUCT(meta = (DisplayName = "My Task", Category = "My Game"))
struct FMyTask : public FPulseAITaskBase
{
GENERATED_BODY()
using FInstanceDataType = FMyTaskInstanceData;
virtual const UStruct* GetInstanceDataType() const override { return FInstanceDataType::StaticStruct(); }
virtual EStateTreeRunStatus EnterState(FStateTreeExecutionContext& Context, const FStateTreeTransitionResult& Transition) const override
{
const FInstanceDataType& data = Context.GetInstanceData(*this);
UPulseAIAwarenessComponent* awareness = Pulse::AI::StateTree::GetAwareness(data.AIController);
...
}
};
Pulse::AI::StateTree has helpers for own movement tasks: StartMove, GetMoveState, CancelMove, MakeMoveRequest, FindRandomReachablePoint, ProjectToNavigation, and StartUseSmartObject for own smart object tasks (claims the closest free slot in a radius and starts walking there and using it, like Use Smart Object). Blueprint tasks (UStateTreeTaskBlueprintBase) work with the schema as well.