Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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?

Regards Tom

Product Version: UE 4.13
more ▼

asked Oct 26 '16 at 12:53 PM in Blueprint Scripting

avatar image

28 3 7 10

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

2 answers: sort voted first

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

more ▼

answered Oct 26 '16 at 01:44 PM

avatar image

40 9 11 16

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

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:

alt text

capture.png (208.2 kB)
more ▼

answered Oct 26 '16 at 02:09 PM

avatar image

Night Watcher
1.7k 44 12 71

avatar image Bjessa Oct 26 '16 at 06:54 PM

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.

avatar image Night Watcher Oct 26 '16 at 09:05 PM

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

avatar image Bjessa Oct 27 '16 at 09:04 PM

Thank you :)

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question