How to return player back to where they were after opening a door

Hey, I’m currently working on a project and have hit an issue and I’m not entirely sure how to tackle the problem, I’d very much appreciate any help from the community!

Alright so I’ve made a door blueprint, you push F on the door and it loads a new level - when you push F on the door from the second level to load back into the original level you spawn at the player start. I’m going to have a lot of doors on the original level and was wondering how would I make it so that the player would spawn in front of the door they originally opened on the original level?

Can I achieve this through blueprint or will I require the use of C++?

Thanks in advance!

Hi CookieCaster,

Use a blueprint of a trigger volume or billboard that you can set in front of the door to allow the user to load to that specific point.

The problem is more that there’ll be multiple doors in each level, but I do not know how to have a door in one level bring the player to a specific door in another level. For example, a player opens the door to a house which loads him into the house interior level, I want the player to be able to use the backdoor to load into the outside level again except behind the house. I thought about maybe having a Boolean value which turns true when the player uses it, and then iterating through all of the doors checking for the bool so the player is moved to the location of the door, but that didn’t work.

Hm, you could save a position when using a door.

I would try to add a variable for a position to my doors and if i use the door, i would save the position to a variable that survives the changelevel and than port the player to this place.

But, hm, i guess there could be a much better solution to your problem.

What may work is to save the value, though. You save the value of the specific location you walked through (lets say a trigger volume. Then when you walk back in, you send them directly to the saved value. If you enter another door, save the vector value of that one. Repeat as necessary.


How would you go about saving the value of that specific location? I have doors with box triggers in front of them, that when interacted with the player by pressing E > Which opens the assigned level. What kind of value would I apply to that trigger and how would I go about using it?

You would want a vector, so for example lets say trigger A is at 0,0,0 and it sends you to level 1. Well when you press E in trigger A, you want to set the vector variable Return_Vector to 0,0,0. When you come back to the loading area use “Set actor location” to the vector “Return_Vector” on level load. You can use the "Return_Vector for every trigger and just set it to the trigger location each time you load a new level so that when you return you always return to “Return_Vector”, which is set to whichever trigger you used.

You’d want to just store that vector manually in your triggers, wouldn’t you?

Assuming that you start in a with multiple doors… you go in one, storing your return value, and then you enter a third room, and once more store your return value… if you return to the second room, having once again stored a return value, you’d have overwritten your ability to enter the main and would be returning to the third room again…

If you store the vector manually on each trigger, then they would just always take you where you need to go.

I spent a long time trying to figure out the level open “option” it appears to be undocumented. I also spent a bunch of time trying to figure out the “tag” on Playerstart… I’m assuming that there’s no way to select a player start when running level open? That we are expected to use teleport instead?

Okay, so I have been trying this out and I am kind of lost (yeah, I admit it -_-)

So I have a couple questions (please know that I have almost zero knowledge on how programming works (i’m working on it)):

If you want to set it so when the player presses the E key inside of a trigger and have it store the vector:

  1. Do you want to SET the Vector when hitting E? What does this do exactly?

  2. Do you want to GET the Vector when hitting E? What does this do exactly?

  3. Do I put the GET or SET after the Open Level Node, or after (or does it even matter)?

  4. How do I go about storing this Vector? Do I make it it’s own variable (Vector) and use the same variable for each trigger, or do I create a new variable for each trigger that leads to a new level? Is there a way to check if the correct vector location is stored?

  5. Since I want the player to go back and forth (as if they are going through a door and back through it), would each trigger need it’s own SET/GET?

I apologize for all my questions, but I want to make sure I am doing this correctly and efficiently. I really need/want to learn how to do this right.thank you

I can answer most of these pretty quickly by explaining what a get/set are. It will make a lot more sense then.

A set variable node takes a variable that you have and sets it to whatever you tell it. So basically, in our case you have a vector variable, and a set node says “Vector A, you are now this location”.

A get variable, in contrast, grabs the variable and uses the value that it is. So a get will look at a vector and take whatever data that is already present in the variable.

In our case, we want to set the variable when pressing E to force the “Return Vector” variable to be the triggers vector value. I haven’t tested this directly, but I believe storing the return vector in the player would be the best choice. The reason is that you can save the players variable values when transferring levels. When you return, you can cast to the player and grab the vector, which should still have the value you are looking for, then simply set the player to the location. This is just the way I do it though, I believe Allegro’s suggestion of storing the vector in the trigger should be possible as well.

To answer the question Allegro had, I think it is possible to select a player start, however you have to use the get all actors of class on level loaded and select which one you want from there. This is on my agenda of stuff I haven’t tested but theoretically should probably work.