How do I run Custom Events of a character from Inside a Behaviour Tree

Hi all,

So right now i’ve got a little behaviour tree, that switches actions depending on the value of an enum (Cycling between idle, attack and patrol actions right now)

When it goes down the attack route, I want it to call the “Attack” custom event from the pawn it is possessing, and do the actions here, and continue doing them in this event until it receives an updated enum value (This is all all from the same parent so it should be able to call the custom event no matter what)

What I can’t for the life of me figure out, is how to call the event of a possessed pawn from inside of the behaviour tree. Is their an easy way to do this that already exists, or do I need to build a custom task, that casts to the parent and runs the event?

It’s entirely likely i’m going about this the wrong way, so if I am please also let me know

Thanks :slight_smile:

Many ways to do that. First create a custom BT_Service, then you can simply cast to the BP and call the event, or you can (more complicatedly) create an Interface and call a message from the custom.

The answer is to create a custom decorator, task or service and use it in your behavior tree. It’s C++ or Blueprint classes from which you can execute any code.

Here’s some docs on how to create them:

They’re far, far, far from great and don’t tell you how to actually finish creating a simple functioning class but it’s a start.