x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

How to create own an AIController for each bots ?

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!

Product Version: UE 4.8
Tags:
more ▼

asked Aug 10 '15 at 02:08 PM in C++ Programming

avatar image

Syntopia
222 22 28 45

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

2 answers: sort voted first

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!

more ▼

answered Aug 11 '15 at 08:06 AM

avatar image

Syntopia
222 22 28 45

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

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

more ▼

answered Aug 10 '15 at 03:09 PM

avatar image

gamer08
271 17 17 36

avatar image Syntopia Aug 10 '15 at 03:41 PM

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:

alt text

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

.cpp

http://pastebin.com/uP2fvFt2

Thank you and sorry for my english :)

123.png (118.9 kB)
avatar image gamer08 Aug 10 '15 at 09:32 PM

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

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question