x

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"

How to Create Multiple Level Spawnpoints?

So, as with many RPGs, levels have many spawning points.

Let's assume there's a level where you start in the center, but you can go through passages on the left or to the right. If from either passage you walk back into the room, instead of respawning in the center, how can I have the player respawn in the level next to the way they exited, rather than the level's spawn?

Here's an example: alt text

Let's assume this is Level 0. If the player walks up to the Left Exit, they'll enter Level 1, but if FROM Level 1, they enter the right exit, then they'll enter Level 0 again, but next to the Left Exit, not the center of the level, where'd they'd spawn by default.

If anyone could help that'd be great. Have a nice day :)

Product Version: UE 4.20
Tags:
1.png (14.4 kB)
more ▼

asked Aug 09 '18 at 02:37 PM in Blueprint Scripting

avatar image

Astro_dex
5 1 2

avatar image ThompsonN13 Aug 10 '18 at 11:50 PM

personally i would have a system where when you get to the level exit then you save a variable to the game instance which would be used to decide the location to spawn the player when the next level opens. so basically in your picture when you move to the right edge you would have a script that sets a variable (spawnLocation) in the game instance (for example have it set to the value right or left), then opens level 2. then when level 2 opens you immediately set the characters location based on the variable in the game instance, in this case it would be set to left, so you would have a predetermined vector or marker such as a target point, and you would set the characters location.

(comments are locked)
10|2000 characters needed characters left

1 answer: sort voted first

If you create your own GameModeBase, you can override its ChoosePlayerStart or FindPlayerStart functions and use GetAllActors to loop through all PlayerStarts in the level and pick the one you wish to spawn at.

more ▼

answered Aug 09 '18 at 06:32 PM

avatar image

Raptorcore
51 1 6 6

avatar image Astro_dex Aug 10 '18 at 08:37 PM

Thank you! I'll be sure to report back here if I have any other questions.

(comments are locked)
10|2000 characters needed characters left
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