Goal

Use this pattern when survival should interrupt ordinary combat as soon as health falls below a threshold.

Tree structure

A low-health Flee sequence has higher priority than Combat and Patrol.

How it runs

Place Flee first under the Selector so it has priority over Combat and Patrol. Select the Flee Sequence and set its Abort Type to Both.

While Combat or Patrol is running, the Lower Priority abort keeps checking Is Health Low. When health drops below the threshold, it stops the lower-priority branch and starts Flee. While Flee is running, the Self abort keeps checking the same condition and ends the branch after health recovers.

Is Health Low has succeeded and Flee from Threat is running while Combat and Patrol remain inactive.

Here the low-health condition has stopped normal behavior and activated Flee from Threat.

The Selector, Sequence, and abort setting are built in. Is Health Low, Flee from Threat, Combat, and Patrol represent game-specific tasks; use your own tasks or equivalent tasks from the movement and combat integrations available to your project.

Variations

Use separate values for starting and stopping the behavior. For example, start below 25 percent but stop above 40 percent. This prevents rapid switching near one boundary.

Tasks used in this tree

Selector, Sequence, and Conditional Aborts.