Goal

Use a Selector to express preference: try the best option first and move right only when an option fails.

Tree structure

A Selector orders Use Nearby Cover, Move Away, and Idle Safely as fallbacks.

How it runs

The Selector evaluates its children from left to right, so order the alternatives from most desirable to most dependable. When an option is only valid under certain conditions, make that branch a Sequence containing the condition followed by the Action. For example, a Has Nearby Cover condition can run before Use Nearby Cover.

Each unavailable branch must return Failure so the Selector can try the next one. If Use Nearby Cover remains Running when no cover exists, the Selector never reaches Move Away from Threat.

Use Nearby Cover has failed, so Move Away from Threat is running and Idle Safely remains inactive.

This runtime state confirms that the failed first option allowed the next fallback to run.

Put an inexpensive, dependable behavior such as Idle Safely on the far right so the Selector always has a useful final option.

Selector and Sequence are built-in structural tasks. The cover, movement, and safe-idle Actions represent game-specific behavior that can come from your own tasks or a compatible movement add-on.

Variations

Use a Priority Selector when the order should be calculated at startup, or a Utility Selector when changing values should be able to redirect execution.

Tasks used in this tree

Selector, Sequence, Priority Selector, and Utility Selector.