# Move AI randomly using behavior tree?

**URL:** <https://forums.unrealengine.com/t/move-ai-randomly-using-behavior-tree/312379>\
**Category:** AI\
**Tags:** Behavior-Tree, random, task, unreal-engine, question\
**Created:** [March 24, 2015, 1:31pm UTC](https://forums.unrealengine.com/t/move-ai-randomly-using-behavior-tree/312379 "2015-03-24T13:31:04Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ItsScotch](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ItsScotch](https://forums.unrealengine.com/u/ItsScotch)\
**Post date:** [March 24, 2015, 1:31pm UTC](https://forums.unrealengine.com/t/move-ai-randomly-using-behavior-tree/312379/1 "2015-03-24T13:31:04Z")

</div>

I want my AI character to move randomly i tired using this node setup shown below.  
but using this method in AIController making it run on the highest priority… all other tasks in my behavior trees are not kicking in.  
Is there any way to implement this method in behavior tree task. so i can run this on some conditions??

Basically, my AI character will be moving randomly only if some conditions will be true for it!!

 ![15449-randomrunaroundaibp.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/f/9/b/f9b7c58995bafc843df6801b176ce52cc57e5ef6.jpeg)

---

<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:** [March 24, 2015, 2:33pm UTC](https://forums.unrealengine.com/t/move-ai-randomly-using-behavior-tree/312379/2 "2015-03-24T14:33:50Z")

</div>

The way to achieve what you describe with Behavior Trees would be to implement a BT Service that would put random locations to a blackboard entry, and then have a BT move task go to that BB entry. Alternatively you could have a BT task that puts random locations in to a BB entry, and use that in sequence with the move task - find location then move.

Cheers,

–mieszko

---

<div class="post-metadata">

**Author:** ![ItsScotch](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ItsScotch](https://forums.unrealengine.com/u/ItsScotch)\
**Post date:** [March 24, 2015, 4:13pm UTC](https://forums.unrealengine.com/t/move-ai-randomly-using-behavior-tree/312379/3 "2015-03-24T16:13:17Z")

</div>

Yup it worked thanks!

---

<div class="post-metadata">

**Author:** ![ItsScotch](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ItsScotch](https://forums.unrealengine.com/u/ItsScotch)\
**Post date:** [March 24, 2015, 4:46pm UTC](https://forums.unrealengine.com/t/move-ai-randomly-using-behavior-tree/312379/4 "2015-03-24T16:46:54Z")

</div>

btw i’m not sure if i can ask a question which is not completely related to the question i posted…

but actually my AI character as soon as it sees me…it starts following me… problem is that it follows me even after i ran out of NAV MESH… and stucks should this happen?  
or do i need to make some condition like dont go out of the nav mesh??
