I'm trying to create a level where there is a default spawn point that everyone enters the game at, with proximity-based respawn points deeper into the level. Right now everyone just spawns at a random spawn point.
Not sure if there is a better way to handle that without handling the respawn yourself.
Without knowing more about your game this might not be suited for you.
So first thought would be to have your main spawn point to be set to team 1, and your outer spawn points set to team 2. When the player joins, set them to team 1 in the playerJoinedEvent
. Then at some point you change the players team to 2. This way when the player dies, they will only respawn at spawn points for team 2.
My preferred method would be to handle respawning your self. You can do this by using the event diedEvent
and then use Respawn
method and passing in the position of the respawn. I would have a list of spawn points (represented by cubes for example) in a folder (not including the main spawn), and randomly (depends on your game) choose one from that folder. Grab it's world position, pass that to the respawn method. Just remember to set Respawn Mode to "None".
Thanks, this gives me some ideas on where to start. I'm making an open world shooter/rpg. There's a dungeon at the far end of the map from the player faction town. I want players to all spawn initially in the town, but if they die further out in the map, especially in the dungeon, I'd like them to respawn closer to where they died, or outside the entrance of the dungeon.
Guess I can't reply directly to your comment, I have to post as an answer.
Ok, then yeah, I think either method will work for you here, but I personally would go with the second method and handle the respawn yourself. This will be better if you add more dungeons in the future, and the code is pretty simple, as it's just 2 event handlers (player joined + died event).
If you need a deeper explanation of the code, let me know.
Good luck