Reply To: Multiple Behaviour Trees

NodeCanvas Forums General Discussion Multiple Behaviour Trees Reply To: Multiple Behaviour Trees

#9303
Gavalakis
Keymaster

Yep, that code is totaly fine 🙂

BehaviourTrees are objects of their own. While by default they are created as a child, they don’t have to be child if you don’t want them to. You can place them wherever you want. The rest will be done for you in runtime :), but then you will need another way to reference them, which well… is realy easy.

There are many ways to communicate from the BT to your FSM. First of all, you can pass a callback for when the BT is finished in case you set it to RunOnce.

You can also check the root status of the BT by the rootStatus property and respond accordingly.
You can simply use a SendMessage from within a BT action and catch that message on the agent or any other game object.

You can use the blackboard which the BTs will be using and check it’s variables like so:

You can use ScriptControl Tasks to call a function on one of you components and in consequence trigger a transition.
Last but not least, you can use the NC FSMs with nested BTs 😛 🙂

Let me know if you need more possible ways or something specific.

Join us on Discord: https://discord.gg/97q2Rjh