# AI - Task/Animation Blueprint Communication

**URL:** <https://forums.unrealengine.com/t/ai-task-animation-blueprint-communication/33178>\
**Category:** Blueprint\
**Tags:** unreal-engine\
**Created:** [June 22, 2015, 6:02am UTC](https://forums.unrealengine.com/t/ai-task-animation-blueprint-communication/33178 "2015-06-22T06:02:43Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ForGobbler](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ForGobbler](https://forums.unrealengine.com/u/ForGobbler)\
**Post date:** [June 22, 2015, 6:02am UTC](https://forums.unrealengine.com/t/ai-task-animation-blueprint-communication/33178/1 "2015-06-22T06:02:43Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![ForGobbler](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ForGobbler](https://forums.unrealengine.com/u/ForGobbler)\
**Post date:** [June 22, 2015, 7:07pm UTC](https://forums.unrealengine.com/t/ai-task-animation-blueprint-communication/33178/2 "2015-06-22T19:07:44Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![SwordsKeyboard](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@SwordsKeyboard](https://forums.unrealengine.com/u/SwordsKeyboard)\
**Post date:** [September 11, 2015, 3:06am UTC](https://forums.unrealengine.com/t/ai-task-animation-blueprint-communication/33178/3 "2015-09-11T03:06:58Z")

</div>

can you share an example of your work flow?
