How to enable AIController when uncontrolling Pawn

I have 2 3rd person characters, I first gave them AIContoller, I want to realize that when another character is clicked, that character is controlled by Player 0, and the other character continues to be controlled by AI. switch between each other.
The problem now is that after controlling the character and switching to another character, the liberated character does not return to the original AI control.

The blueprint below is written in the third person character Pawn BP.

Thank you!

before you posses, you could set references to the old pawn and ai

then at the end, you possess the old pawn with the old ai

1 Like


I currently have 3 third person templates. Your solution doesn’t work very well. The current situation is that when the first click is made, all 3 AIs are taken over by the player and stop moving. And when I click the second time, the previous one will be released, but the Pawn controlled by the player and another Pawn are still not controlled by AI. That is to say:
The first time, one Pawn is controlled, and the remaining 2 will stop without any AI or player control.
The second time, the last Pawn controlled by the player becomes AI, the player controls one Pawn, and the third Pawn still has no control.

“SelfAIController” is what I got and added in Event BeginPlay. Other than that there is no other code.

Hello

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.