Is it possible to spawn players at nearest spawn pad to death?

Hey Team,

Is it possible to override the respawn function to add in logic to calculate nearest spawn point available and respawn there?

Background: I am creating a game where I have spawn points associated with capture points. Ideally the player spawns at the nearest spawn point (and therefore capture point) to their death. The number and places available to spawn is dynamic depending on capture point control.

Default options for spawning appear to be “Random” or “Near Teammates”

1 Like

could you add a verse tag to each point and then enable and disable them dependant on which points you control ?

we do something similar

# add verse markup tag to the spawner you want found by the code
PlayerSpawnTag          := class(tag){}

## Used to put all player_spawner_devices into an array
var PlayerSpawns : []player_spawner_device = array{}

## Get an array of player spawn with the given tag
GetPlayerSpawns(): void=
    PlayerSPWN := GetCreativeObjectsWithTag(PlayerSpawnTag{})
    for (found : PlayerSPWN):
        if (PlayerSpawner := player_spawner_device[found]):
            set PlayerSpawns = PlayerSpawns + array{PlayerSpawner}

DisablePlayerSpawns(): void=
    GetPlayerSpawns()
    for (i : int := 0..PlayerSpawns.Length):
        if (PlayerSpawner := PlayerSpawns[i]):
            PlayerSpawner.Disable()
            
EnablePlayerSpawns(): void=
    GetPlayerSpawns()
    for (i : int := 0..PlayerSpawns.Length):
        if (PlayerSpawner := PlayerSpawns[i]):
            PlayerSpawner.Enable()

Love the suggestion, I started with something similar. The issue with my game mode is its not necessarily a linear progression, so I don’t want to disable the other spawn points. Ideally if you are defending site B and die, you spawn back at site B regardless of if the rest of your team just captured site A

The problem with disabling spawners is that you can’t really decide where the players respawn individually, if they die at the same moment for example.

So I’d say using the (:agent).Respawn() function would be the solution. But this method has some drawbacks, like hiding some HUD elements (e.g. score managers) or disabling spectator mode on the respawned player.

If your gamemode doesn’t have a spectator mode, then you could think about using it. I think someone told me he kept the spectator mode by respawning the player changing its class and killing it again? haha good luck with that one!

Can I override the agent.respawn function or rather are you saying to put a listener on player deaths and then call agent.respawn (before the in-built respawn function is called?)

New to verse, coming from unreal engine so trying to pick up the differences in how I can implement things

Well I’m not sure how you would do it, but maybe changing the default After Last Spawn Go To island setting to Spectator and then doing the respawning yourself.

But maybe trying to disabling some spawners depending on which area you want players to fight for would be an easier solution

The full Verse solution would need some more testing :+1:

Ah I see, I was afraid of that but hey considering all the time I’m saving on not implementing other things I cant really complain about having to set some things up :laughing:

1 Like

we tried the respawn function and you respawn but you not registered back with the score board and alot of stuff breaks

you can add numerous tags to the spawners so you can turn off all the spawners except the ones you select

you could even do something like get distance to spawner with tag then select the closest

1 Like