Download

AI - Task/Animation Blueprint Communication

Hey guys,

I´ve just started with NPCs and their AI “brains” and I have a question concerning blueprint communication between AI-tasks blueprints and the animation blueprint.

My NPC has two simple tasks which are controlled via the behavior tree. A “wander” task and a “chase player” task. The NPC wanders around and as soon as he sees the player he starts to chase him. This all works well, but I wanted to take this a step further and have the NPC attack the player when the distance between player and NPC is small enough.

So I added a “compare distance” in the “chase player” task to see, if the NPC is close to the player. If this is the case, the NPC should play an attack animation. I´ve set up an anim state which plays the attack animation when “IsAttacking = true”. In my task blueprint I also set up a boolean variable and set this to true when the distance is close enough.

Now I´m not sure how to connect the task blueprint with the anim blueprint so that they can communicate with each other. How can I cast between tasks and the anim blueprint? Or should I use a blueprint interface?

Thankful for any advice,
Michael

Never mind, I´ve solved the problem via blueprint interface.

can you share an example of your work flow?