How to respawn all players from spectator to their respective Spawn Pads?

Hello,

I have players eliminating other players, eliminated players go to spectator.
At some point I want to “rez” all the players to their respective pads.

I built this to do so:

    varvector :vector3= vector3{X := 0.0, Y := 0.0 ,Z := 0.0}

    RezAllPlayers():void=
        AllPlayers := GetPlayspace().GetPlayers()
        for (Player : AllPlayers):
            if:
                FortCharacter := Player.GetFortCharacter[]
                FortAgent := FortCharacter.GetAgent[] 
            then:
                FortAgent.Respawn(varvector, rotation{})
        Print("All players Rez")

Strangely on one map, this does what I want and all the players do respawn from their Spawn Pads and on another map, they respawn from the X=0,Y=0,Z=0 location.

Do you have any idea how to spawn players from their respective spawn pads?
Thank you !

1 Like

If you want them at specific pads, you have to store their positions in a map ([player/agent]vector3, not character I think) upon spawning.

I think you can use the player_spawner_device.SpawnedEvent for that.

Also as a note, when I used the Respawn() function, I found that :

  • Your players will probably loose their weapons, you’ll have to grant them again in order if you want the same inventory
  • You can’t set a Rotate in the first Respawn(), you’ll have to Sleep(0.0) twice and Respawn() again.
  • You’ll loose some kind of HUD too (like the score manager one)
  • You’ll also loose your movement settings if you set some (either in your island setting or your team settings device)
  • If you can’t spectate others after dying after a Respawn(), it’s okay, it only happens in the unpublished version of your island
2 Likes

Wow amazing insight, thank you very much i will test all that ! :slight_smile:

1 Like

Update:

In the end this script works.
I was respawning on X=0,Y=0,Z=0 because of a bug, i moved some landscapes above this position to fix the issue. Don’t ask me why :joy:

2 Likes

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