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 do I get the AI controller from an actor?

I've been attempting to make an RTS using pure Blueprint, and I read on AnswerHub that the best approach to create an unit would be to create an AIController, in my example named RTSPawnController, assign this as the AI Controller for my Character (or Unit. I use the Character class for different units like Warrior, Archer, Mage, etc.), and then control these AI controllers with a global PlayerController.

First of all I'd like to know if this is the correct approach. Should I use characters for units? Should I use AI Controllers for units? Should I manage these AI controllers from a PlayerController?

Second of all, how would I get the AI Controller off of a character? I have created a function in my AI Controller called AI_MoveToPoint, and I would like to call this function for all the selected characters from my PlayerController Blueprint.

NOTE: This question is now solved. The answer is found in the comments of the accepted question.

Product Version: Not Selected
more ▼

asked Sep 20 '14 at 08:33 PM in Blueprint Scripting

avatar image

8 1 2 5

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

1 answer: sort voted first

You could check out this template:


It's really awesome and helped me a lot to get started ;)

more ▼

answered Sep 20 '14 at 08:45 PM

avatar image

5.9k 291 86 293

avatar image CptAsgard Sep 20 '14 at 09:32 PM

Thank you, but I've read through the blueprints and it unfortunately doesn't answer my question.

avatar image Erasio Sep 20 '14 at 09:37 PM

Well it does have the working Unit movement.

Anyway to directly answer your question: The node "Get Owner" should be what you are looking for.

avatar image CptAsgard Sep 20 '14 at 09:43 PM

Thank you for the quick reply. Here's what I'm currently doing:


The cast, however, fails. I've assigned BP_RTSPawnController as the AI Controller in the character as follows:


Why would the cast fail?

avatar image Erasio Sep 20 '14 at 10:14 PM

Could you print the displayname of the result of "Get Owner" real quick for me?

avatar image CptAsgard Sep 20 '14 at 10:22 PM

The display name is empty

avatar image CptAsgard Sep 21 '14 at 09:30 AM

If I firstly cast to BP_BaseUnit, and then do the Get Owner, they owner is still empty however the display name is now displaying correctly.

avatar image CptAsgard Sep 21 '14 at 09:43 AM

It works now!


First of all, I get all actors that have my BaseUnit class. Then I For Each through them, and cast each one to my BaseUnit class. From that point I can do a 'GetController', and cast the controller to my controller class. BP_RTSPawnController. At this point the cast was successful and I can call my controller's move function.

I will mark your answer as correct.

(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