Spawn at different playerstart after level restart?


Lets say I have 2 PlayerStarts in different sublevels. The first one is where the player start at the beginning of the game. The second PlayerStart is in a different sublevel, and this is where I want the player to spawn after he is killed.

I have referenced the PlayerStart in the Character BP, so the respawn location is at the PlayerStart. But the player spawns at the first PlayerStart. How would I go about selecting the correct PlayerStart by tag?

The original plan was using a checkpoint system. I created a simple checkpoint system. So when the player dies he spawns at the last checkpoint. But this dont work since I need to restart the level for everything to reset.

I used OpenLevel to restart the game and that resets everything. The thing is that the player checkpoint is in a sublevel and the checkpoint dont work when using OpenLevel to reset.

Hope this makes any sense?


I don’t have much idea about sublevel and level streaming but :

  1. u can create multiple player start actors.
  2. Now, now make an array of all the player start references (can use get all actors node at begin play for that) in some universal class, lets say game state or player state.
  3. Create a custom event in universal class which is called when any character dies.
  4. When a character dies, that event is called in game state, get a reference of player start from the array.
  5. There is a ‘array index’ parameter in ‘Get’ node. plug it to get random integer in range node. This way u will get a random player start reference.
  6. Now spawn the character which is dead at location of that random player start location

Maybe when ‘get all actors of class’ node is runs, it will return only references of objects loaded sublevel and not those who are unloaded in a specific sublevel

Hope it helps

The choice of the spawn point is managed by your game mode, to manually select which spawn point to use, you need to override the ChoosePlayerStart Function, here’s an example:

This looks like the way I need to do it. But how would I get the specific Player Start in the game mode? Sorry if this is abvious, kinda lost here.

A player start has a player start tag field that you can use to filter different player starts. Just use a foreach loop on the array of player start you have to find the player start you want that has the right tag

Thank you :slight_smile: