How to switch to new character when respawning?

I want my character to respawn at the same spot and this is my current blue print for the trigger box.

My second character is showing up but my first one is still on the screen and it’s not switching to my second character. How should I resolve this?

  • Handle this in the level blueprint instead of your collision volume’s blueprint
  • Store the player character’s transformation info before destroying it and then destroy the currently controlled character
  • Spawn the new character and possess it

I see an already existing topic that you created on the same subject with answers: Respawn new character at collision box - #3 by silnarm

Please be mindful of not abandoning topics.

possess

Sorry about that but I gave up the idea of using a key to trigger and I want to see if it would simplify the scripting.

this is my current code, it seems like when my 1st character is destroyed my the camera will shift to the default angle, and my 2nd character will drown when I control the map.

My camera is stored in the character but shouldn’t it remain the same since its already possessed before destroying? My CH1 is basically a duplicate of my CH2 (just different flipbook) so I’m not sure why it would fall off my stage.

Nope, that’s totally expected. You can save the control rotation inside a rotation type variable and set the control rotation to that saved rot value after you switch characters.

Is this correct? My camera is still switching and I did a delay to check and my first character didn’t get destroyed

I also tried this and it worked for an hour then decided not to work anymore… (character still falling off stage but CH1 got destroyed) :sob:

  • You should store the control rotation inside that rot type variable by using the Get Control Rotation node
  • You should set the control rotation to our rot type variable after you possess the new character by using the Set Control Rotation node
  • And also, destroy the currently controlled character before spawning the new character

Hi! Thank you so much it worked! One last question, its respawning at the upper corner of my stage instead of the death point, I tried to input XYZ manually but it doesn’t work, any way I could fix this?

You should also store the transform info (location, rotation, scale) of the currently controlled character inside a transform type variable (or just a vector type variable if you only want to store the location) before destroying it and plug that variable into the Spawn Transform pin.

Again, if you only want the location to be taken into account, you can right click on the Spawn Transform pin and click on the Split Struct Pin option to expose it’s components, that way you can plug the stored location variable into the location pin.

OMG its working correctly finally, you’re a life saver! Thank you.

My script for anyone who might encounter similar obstacles:

1 Like