llms.txt: machine-readable documentation index. Markdown version of this page is also available.

Ninja Bear Studio Plugins Help

Switch Behaviors at Runtime

Give a guard a usual activity and let a patrol stop replace it temporarily. For example, the guard can pause for one second at ordinary stops and look around for four seconds at a lookout. Use the tree from First Steps. If your level has no patrol points yet, the patrol route guide shows how to connect them.

Give the Behavior Tree two possible activities

  1. Create BT_Pause and BT_Lookout using your guard's Blackboard. Give each a Sequence with a Wait task. Use one second in Pause and four in Lookout.

  2. In the branch that runs after arriving at a stop, add Run Behavior Dynamic. Set its injection tag to AI.Dynamic.Patrol and its fallback asset to BT_Pause. Map the same tag to BT_Pause in Bot Setup → Dynamic Behavior Trees.

  3. Add the Patrol Point Behavior service to the sequence that uses the stop. Choose the Blackboard key holding the current point and the same injection tag. On the lookout point, set Logic Type to Behavior Tree and choose BT_Lookout. Leave the next point without an activity. The service reads each point when its branch becomes active.

A Behavior Tree assigned to one patrol point

Give a linked State Tree a per-stop duration

  1. Create an AI State Tree named ST_Pause. Add a Float root parameter named PauseSeconds and bind it to the Duration of a Delay task. Finish the tree successfully after the delay. Compile it.

  2. In the patrol tree, set the state that runs on arrival to Linked Asset. Select ST_Pause and set the state tag to AI.Dynamic.Patrol.

  3. In Bot Setup → Linked State Trees, add that tag and select ST_Pause. Enable the override for PauseSeconds and enter 1. On the lookout point, set Logic Type to State Tree, choose ST_Pause, and override PauseSeconds to 4.

  4. Before entering the linked state, run Set Patrol Point Behavior with the current point and the same tag. Leave the following point without its own tree. On that visit the task restores the setup's reference, including the one-second override.

Try It in Play

Watch a full lap. The guard should pause longer at the lookout, then return to its ordinary pause at the next stop. If every stop uses the same duration, check the point instance and compare the tag on the service or task with the tag on the dynamic branch.

25 November 2026