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 ?
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:
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:
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.
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!