Switching and Possess Characters

I try to make a game where the player can switch between characters like in Genshin Impact. Each characters have different abilities, speed, etc.
I was able to spawn the second player and possess it, and destroy the first player, but i can’t switch back to the first player. I think the problem is I can’t get the world transform reference of a spawned actor so don’t have a location where the first player can spawn.
Please Help Me

Both of the destroyactors refer to self as target.

You aren’t doing anything with the return of getallactors…, regardless probably not the best approach. Instead, try creating 2 char(or actor) reference variables ie (PlayerChar1, PlayerChar2) , assign the character to the variable when you spawn the actor using the return of SpawnActor node, then use that reference variable for the target of your destroyactor AND possess call.

Just noticed this is in the characterBP… you probably want this logic in your playercontroller as you’re spawning and destroying your char.

1 Like