How to restart behavior tree when an external input arrives?

airoll

Member
Hello, I have the following scenario and am trying to understand how to solve for it using Behavior Designer.

Every 0.1 seconds, an input, external to the behavior tree, arrives with an ability index to use. I populate a shared variable within the below tree, and the Selector chooses which set of actions to take depending in the ability index. If the ability index is set to 1 or 2, it will continue to start Use until there is a failure.

BehaviorTree.PNG

My question is: if the input changes the ability index to use, how do I restart the tree from the top and make the selector and its child tasks runs in the same tick? I am aware of conditional aborts, but any design using conditional aborts that I can think of would essentially do nothing for one tick, and make the selector and its child tasks run in the next tick, which is 0.1 seconds later (my Behavior Manager is set to run every 0.1 seconds, not every frame).
 
For cases like this I recommend using the Interrupt/Perform Interruption tasks. These set of tasks give you more control over when your tree aborts a branch.
 
Top