# BotAI attack sequence

**URL:** <https://forums.unrealengine.com/t/botai-attack-sequence/322634>\
**Category:** Cinematics & Media\
**Tags:** Behavior-Tree, attack, unreal-engine, bots, question\
**Created:** [June 22, 2015, 1:39pm UTC](https://forums.unrealengine.com/t/botai-attack-sequence/322634 "2015-06-22T13:39:42Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![xhallix](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@xhallix](https://forums.unrealengine.com/u/xhallix)\
**Post date:** [June 22, 2015, 1:39pm UTC](https://forums.unrealengine.com/t/botai-attack-sequence/322634/1 "2015-06-22T13:39:42Z")

</div>

Hello,

I’m trying to setup a simple AI bot who is moving towards the player, stop at him and attack.  
This sounds so simple, but turns out to be not as easy as I thought.

I thought I’m going to make a decorator, which should check if the bot is at the player location, but this does not work.  
Is this a good approach?  
If yes, please let me know how to fix my blueprint or please point me in a correct direction

Here is my setup:  
Behaviour Tree

 ![47318-behaviortree.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/d/c/b/dcb234909f75512d7684ed73b665a51548a912f9.jpeg)

Decorator

 ![47319-decorator.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/1/1/e11c0c74e19f1c6be10b08e69fabb97022ed5694.jpeg)

Thanks in advance

---

<div class="post-metadata">

**Author:** ![MieszkoZ](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@MieszkoZ](https://forums.unrealengine.com/u/MieszkoZ)\
**Post date:** [June 22, 2015, 1:53pm UTC](https://forums.unrealengine.com/t/botai-attack-sequence/322634/2 "2015-06-22T13:53:32Z")

</div>

First of all you’re using AIController’s location while what you need to use is its controlled pawn (use `Perform Condition Check AI`, you’ll get both the controller and pawn with it). This is probably why you’re BT doesn’t work.

Second, your current setup doesn’t even require that conditional decorator - the Move node won’t finish until AI is at the goal. You just need to make it move to the Goal Actor instead of Goal Location - just add an “actor” key to your blackboard, set it to store player pawn, and make the task go to that blackboard key.

Last but not least, the ideal setup would be like so:

 ![47331-attacknearbyplayer.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/8/d/c/8dc215f90a6bf203d928db404865b070cd6ad734.png)

I’ll let you figure out the details 😉

Cheers,

–mieszko

---

<div class="post-metadata">

**Author:** ![xhallix](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@xhallix](https://forums.unrealengine.com/u/xhallix)\
**Post date:** [June 22, 2015, 1:55pm UTC](https://forums.unrealengine.com/t/botai-attack-sequence/322634/3 "2015-06-22T13:55:01Z")

</div>

works like a charm when using pawn 😉  
thanks for the hin. I will recheck my tree also
