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 reassign AI controllers to new pawn

I have three characters in my game where the player can cycle between them. What I currently have setup is when the player possess a new character, I a new AI controller on the previous pawn. However, with the current setup that I have, I'm continually creating new AI controllers and eventually it will clog up my outliner and suck up needed resources.

Would anyone have any idea on how to either reassign the AI controller to a new pawn when I possess the character that it's currently on or destroy unused AI controllers?

Thanks for any and all help!!

P.S. Here's what I have setup atm

alt text

alt text

Product Version: UE 4.10
capture1.png (290.0 kB)
capture2.png (173.0 kB)
more ▼

asked Jan 15 '16 at 04:06 PM in Blueprint Scripting

avatar image

43 17 17 19

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

1 answer: sort voted first

AIController is like PlayerController, they are based of same class called Controller class and Pawn universally treats them as that class, so AI can dynamicly change possession too. So insted of "Spawn Default Controller" multiple times, spawn the controller just once get it set to some varable and change the possession same as you do with PlayerController

more ▼

answered Jan 15 '16 at 04:51 PM

avatar image

37.8k 937 172 1123

avatar image Huskey3737 Jan 15 '16 at 04:56 PM

This sounds kinda silly, but how would you set the AI controller to a variable so that I'd be able to change the possession?

avatar image Shadowriver Jan 15 '16 at 05:57 PM

You can either spawn AIController manually and make it posses the pawn, spawn node will output spawned AIController, or use "Spawn Default Controller" once and then use "Get Controller" node from pawn to get controller that posses the pawn and store in varable.

avatar image Rizzu_R Sep 07 '18 at 10:52 AM

Thanks its helped me....

(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