Blueprint to AI Task communication

I’m looking for a way to have my Player Controller trigger an event in an AI Task. I’ve tried several things, but I haven’t figured how to cast to the AI Task from inside the Player Controller. Any ideas on how to do this? Thanks.

1 Like

Hi,
casting to an AI task from the player controller does not feel quite right to be honest. But if you want to do it that way, I would recommend you set up a blackboard value which you could set from the controller. Then you set up the composite node in your behaviour tree (selector or sequence) to abort itself based on a decorator placed on it.

Best Regards!

Actually, I came to think of another solution that is closer to what you want.

You could use an event dispatcher. Create the event dispatcher in the player controller. Cast on “Even receive execute AI” to the controller and bind a custom event in the task to the dispatcher event. Connect the red delegate pin into the custom event in the BT task as you wanted!

Let me know if it helps :slight_smile:

Since the OP, I’ve reworked the AI so that tasks no longer need to be triggered from outside the behavior tree. I appreciate your suggestions though. Thank you.