# How to create own an AIController for each bots?

**URL:** <https://forums.unrealengine.com/t/how-to-create-own-an-aicontroller-for-each-bots/328209>\
**Category:** AI\
**Tags:** controller, ai-controller, unreal-engine, bots, CPP, question\
**Created:** [August 10, 2015, 2:08pm UTC](https://forums.unrealengine.com/t/how-to-create-own-an-aicontroller-for-each-bots/328209 "2015-08-10T14:08:03Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Syntopia](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Syntopia](https://forums.unrealengine.com/u/Syntopia)\
**Post date:** [August 10, 2015, 2:08pm UTC](https://forums.unrealengine.com/t/how-to-create-own-an-aicontroller-for-each-bots/328209/1 "2015-08-10T14:08:03Z")

</div>

Hello,

I have created several blueprints character then set him my BotAIController (where created random actions and movements that can not be the same, I do not use blackboard and behaviorTree, I have no common data)

But they start at the same time to perform the same actions.

I want allow for each character existed a _separate instance_ of the controller. How can I do it ?

Thanks!

---

<div class="post-metadata">

**Author:** ![gamer08](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@gamer08](https://forums.unrealengine.com/u/gamer08)\
**Post date:** [August 10, 2015, 3:09pm UTC](https://forums.unrealengine.com/t/how-to-create-own-an-aicontroller-for-each-bots/328209/2 "2015-08-10T15:09:50Z")

</div>

Hello Syntopia,

So as I understand you don’t unreal stuff for AI Behavior tree etc… ? ok.

Anyway, what you could do is create as many AIBotCrontroller you need for your character and make them possess a character.

To be honest, I don’t see any problems in particular.

If you can give more details, I can find an answer that fit better.

gamer08

---

<div class="post-metadata">

**Author:** ![Syntopia](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Syntopia](https://forums.unrealengine.com/u/Syntopia)\
**Post date:** [August 10, 2015, 3:41pm UTC](https://forums.unrealengine.com/t/how-to-create-own-an-aicontroller-for-each-bots/328209/3 "2015-08-10T15:41:34Z")

</div>

I will describe two scenarios. In the first test, pure blueprint, I created a MyChar1\_BP derive from standard character class.  
Then I create a MyController\_BP derive from standard AIController, and fill it with the logic like this:

 ![53521-123.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/3/4/d/34d4842028f2bf6b1ed58f0618af38cf8280c1a6.png)

And it works! If I create two characters with a single controller - MyController\_BP, they will go at the start of the game in different positions.  
But when I create a controller through the code, they act as if they have single brain, go to the exact same point. Here is my controller code:

.h

[http://pastebin.com/0xCvHBbM](http://pastebin.com/0xCvHBbM)

.cpp

[http://pastebin.com/uP2fvFt2](http://pastebin.com/uP2fvFt2)

Thank you and sorry for my english 🙂

---

<div class="post-metadata">

**Author:** ![gamer08](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@gamer08](https://forums.unrealengine.com/u/gamer08)\
**Post date:** [August 10, 2015, 9:32pm UTC](https://forums.unrealengine.com/t/how-to-create-own-an-aicontroller-for-each-bots/328209/4 "2015-08-10T21:32:56Z")

</div>

Hello Syntopia, sorry for the delay.

That’s normal, if you have only 1 controller you can only control one pawn (by default at least). We could make a controller controls multiples pawn at once in certain cases.

If you create multiples controller, you can call MyController.Possess(Pawn1) etc…

what’s your goal exactly, each pawn has his own controller ? or a controller that controll multiples pawns at once ?

Based on what you said, it seems to be the first case, 1 controller has 1 pawn

So you should create multiples controller instances an assign a pawn to each of them.

I can make a code example if you want.

Just tell me what you want or if you have any problems to understand something.

Always glad to help.

gamer08

---

<div class="post-metadata">

**Author:** ![Syntopia](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Syntopia](https://forums.unrealengine.com/u/Syntopia)\
**Post date:** [August 11, 2015, 8:06am UTC](https://forums.unrealengine.com/t/how-to-create-own-an-aicontroller-for-each-bots/328209/5 "2015-08-11T08:06:35Z")

</div>

I solved this problem by transferring the global variables to header. C ++ is not my primary language, so I can not be aware of some of its rules. Thank you anyway!
