Ninja Bear Studio Plugins Help

Configuring Dynamic Behaviors

Both Behavior Trees and State Trees support Dynamic Assets, and Ninja Bot simplifies their usage by providing a dedicated area in the Bot Setup to catalog and manage these behaviors.

This is especially useful when you want to define a common base structure (for example, Combat, Roam, and Idle), while allowing specific behaviors to vary across different AI archetypes. A zombie may roam between random locations, whereas a guard may patrol predefined routes, all while sharing the same high-level decision flow.

Create the Combat Behavior Tree

  1. Duplicate your Base Behavior Tree and name the new asset BT_Combat.

  2. Remove everything except the Combat branch. Remove any Services and Decorators from this branch as well.

    Dynamic Combat Behavior Tree

Create the Roam Behavior Tree

  1. Duplicate your Base Behavior Tree and name the new asset BT_Roam.

  2. Remove everything except the Roam branch. Remove any Services and Decorators from this branch as well.

    Dynamic Roam Behavior Tree

Create the Idle Behavior Tree

  1. Duplicate your Base Behavior Tree and name the new asset BT_Idle.

  2. Remove everything except the Idle branch. Remove any Services and Decorators from this branch as well.

    Dynamic Idle Behavior Tree

Update the Base Behavior Tree

  1. Return to the Base Behavior Tree and add three Run Behavior Dynamic tasks.

  2. For each task, assign a Behavior Tag: AI.Dynamic.Combat, AI.Dynamic.Patrol, and AI.Dynamic.Idle. Also assign the corresponding Behavior Tree asset to each task.

  3. Transfer the Has Target? decorator from the original Combat branch to the new dynamic Combat task. Connect the new tasks accordingly and remove the original static branches.

    Full Dynamic Tree

Update the Bot Setup for the Behavior Tree

  1. Open your Bot Setup.

  2. Add one Dynamic Behavior Tree entry for each behavior, mapping the appropriate Dynamic Tags to their respective assets.

    Setup for Dynamic Behavior Tree

Create the Combat State Tree

  1. Duplicate your Base State Tree and name the new asset ST_Combat. Remove all states, keeping only the Combat state at the Root.

  2. Create a new Global Parameter named SensedActor and set its type to Actor. Update all existing SensedActor bindings to use Parameters.SensedActor instead.

    Dynamic Combat State Tree
  3. Add an On State Completed transition to the Wait state and set it to Tree Succeeded.

  4. Remove the Perception Evaluator inherited from the base State Tree.

Create the Roam State Tree

  1. Duplicate your Base State Tree and name the new asset ST_Roam. Remove all states, keeping only the Roam state at the Root.

  2. Add an On State Completed transition to the Move to Location state and set it to Tree Succeeded. Remove the Perception Evaluator.

    Dynamic Roam State Tree

Create the Idle State Tree

  1. Duplicate your Base State Tree and name the new asset ST_Idle. Remove all states, keeping only the Idle state at the Root.

  2. Add an On State Completed transition to the Wait state and set it to Tree Succeeded. Remove the Perception Evaluator.

    Dynamic Idle State Tree

Update the Base State Tree

  1. Return to the Base State Tree, remove all state implementations, and add a single Child State to each main state: Combat → Run Combat Behavior, Roam → Run Roam Behavior, Idle → Run Idle Behavior.

  2. In the Run Combat Behavior state, set the Tag to AI.Dynamic.Combat, set the type to Linked Asset, and assign the Combat State Tree. This enables overriding the Combat Tree’s SensedActor parameter. Override it to use UpdatePerception.SensedActor.

    Full Dynamic Tree, Combat
  3. In the Run Roam Behavior state, set the Tag to AI.Dynamic.Roam, set the type to Linked Asset, and assign the Roam State Tree. Add a Tick transition to Combat with high priority and a Valid Object condition that checks whether UpdatePerception.SensedActor is valid.

    Full Dynamic Tree, Roam
  4. In the Run Idle Behavior state, set the Tag to AI.Dynamic.Idle, set the type to Linked Asset, and assign the Idle State Tree. Add a Tick transition to Combat with high priority and a Valid Object condition that checks whether UpdatePerception.SensedActor is valid.

    Full Dynamic Tree, Idle

Update the Bot Setup for the State Tree

  1. Open your Bot Setup.

  2. Add one Dynamic State Tree entry for each behavior, mapping the appropriate Dynamic Tags to their respective assets.

    Setup for Dynamic State Tree

Your Bot’s behavior should still remain the same. However, by using the same base asset, you can now mix and match multiple authored behaviors to create different AI archetypes, and even swap behaviors dynamically based on context, such as:

  • Patrol Points with their own set of dynamic behaviors.

  • Different combat strategies based on the currently equipped weapon.

  • Unique idle states for different types of idle breaks.

Last modified: 11 January 2026