1. Home
  2. Artificial Intelligence
  3. AI Controller
  4. Using Move Completed in Behavior Tree

Using Move Completed in Behavior Tree


Setup the composite in your branch or sub-tree of this task to be a Sequence node. This way the branch waits for each node to execute successfully. Next within the task node which will execute the Move To Location, setup everything accordingly but do not link anything to the Finish Execute node. Next, pull from your AIControllerwithin the task, and assign the event Move Completed.

Now with your newly created Move Completed event, you can do one of 2 things. You can check the results of the move or just finish the execution. I suggest the former, but the latter works just as well for now. So for now just pull from the execution node of the Move Completed event, and link this to your Finish Execute and setting Successto true .

This will now prevent the bot from doing any other actions within the tree until they’ve completed the move, successfully or not. Of course I suggest using the results of the move as information to either retry the move or the appropriate action for your game.

One thing I should note that by using the Sequence composite, each node within the branch needs to have the Finish Execute set Success to true. This way the nodes in the branch execute in order, returning false would return resetting the tree.




Click here for the original post.

Was this article helpful to you? Yes No

How can we help?