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 do I Switch from a Player Controller to an AI Controller?

I'm currently working on a feature where the player can switch between 4 different characters that are running AI controllers. Switching to the AI controller and possessing it to take control works fine, but I can't seem to figure out how to have the previously controlled pawn run the AI controller. Is there another way to have the character use the AI controller instead of just spawning in a new AI in its place?

Product Version: UE older version
Tags:
more ▼

asked Dec 08 '16 at 07:10 PM in Blueprint Scripting

avatar image

renderman09
162 11 13 24

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

1 answer: sort voted first

Ended up figuring it out... I just had to spawn in a default controller for each AI.

more ▼

answered Dec 14 '16 at 01:01 AM

avatar image

renderman09
162 11 13 24

avatar image mabdog Jul 28 '17 at 11:02 PM

could you elaborate? I'm trying to figure out how to do this as well

avatar image Baron von Whimsy Feb 25 '18 at 07:41 AM

Probably too late for the person who commented, but one way you can achieve this is probably something like:

Set up an AI controller variable in your actor, then save a reference to it on Begin Play.

Under "Pawn" set a default AI, have the Auto Possess AI set to "placed in world or spawned", and set up the "Unpossessed" event, which you use to have the AI Controller reference you saved reclaim control of your actor when your player drops possession of that actor.

(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