How do you destroy An AI Controller, but keep the pawn

I have a gamemode setup to spawn out pawns with a loop. Using a branch i grab the first pawn and possess it for the player, the rest of the pawns are for AI Controllers. My problem is I have that left over AI Controller from the player controller taking over the pawn. How can I destroy that extra AI Controller. I have tried grabbing the spawned pawns ref from the spawn node and getting the AI Controller and attaching that to a Destroy Actor, but that doesn’t seem to do the trick. I always end up with the same number of pawns as AI Controllers. Any help is appreciated, Thanks

Are you using the same pawn class for AI pawns and player pawns?

I somehow get the feeling you do and don’t think you’d have the problem if you had a specific character for player use and specific pawns for AI use.

Yep, 1 BP Character class. Decided to go that route because i thought it would be easier later on, especially since the player char and the bots are so similar for the most part, only difference really is the controller, ai vs player. Having that extra AI is more of a nuisance than anything, at least at the point i am at . The is valid, branches, cast to…etc always catch it.

I see.

I’m out of my area, but maybe you could try using a “Player Start” actor to spawn the player instead of grabbing an AI character?

You would still want to only keep the base class and create 2 seperated BP Child from it. One for the Player and one for the Bots. You can then add everything the 2 have in common to the base class and every difference to each child like its needed.

That’s what objective programming is for (:

Then you can just use the Player Class as the default class in your GameMode (Project Settings->Maps and Nodes) and spawn the AI with a for loop.

With 2 seperated classes you can also set the AIController of that class to your custom one and set the posses to “When Spawned” or how ever it was called.

Then you will only need to spawn the the AI and it will be possed directly.

Thanks for the advice, i did look into doing the inheritance with the parents and what not. But decided against it just because it seemed to add complexity where it was not needed.

I also answered my own question. Detach from Controller Pending Destroy worked to destroy the extra AI. You just have to attach that to the AI Ref and you will have one less AI on the screen, but keep the character if you possess it, haven’t looked to see if the character stays if you don’t tho. And haven’t tested to see if this causes other problems down the line. Thanks for the advice tho