Hi all, I’m working on an RTS based AI where the player has to be able to send commands to the AI, but I’ve been unable to find any way to influence a Behavior Tree externally to send an AI any commands - is there any way to send commands from the player controller / pawn to tell the Behavior Tree to perform some sequence?
Hi, you can set blackboard values and you can run different behavior trees (you can do both inside the AI controller).
So I presume that from the AI Controller, I would set a blackboard boolean to true to act like a gate to a behavior, then in the case of something like commanding the AI to move to a location, I would have a blackboard vector key which I just set with the location the player wants the AI to move to?
Yes. And you can reuse behavior by putting it in another behavior tree and then running this as subtree from your “main” behavior tree wherever you need it. That might help to keep the behavior tree from getting bloated.
So this issue was resolved by setting the Blackboard values from the AI Controller as suggested by chrudimer, e.g. using a move to location event for when the player right clicks to move the character to a location will then enable a boolean in the BB that allows the BT to traverse to a move command branch: