Changing level with multiple doors in and out

Hello everyone,

So I want to do a door system like in rpgs, where the players enter a new place and can go back by the same door to the place before (entering a house en exiting it) It’s very basic, but I found nothing about that, except tutorials with Game instance and saving data from level to another one.

I spend the day trying to establish something with open string variable, and matching variable from the game instance (if string for Game instance = string from door -> Teleport the player on the front of the door), but some doors work and others don’t (even though it’s the same door BP)
And basicly every time the level is loaded, every door BP had to check if there is a matching id in the Game instance. And I don’t think it’s really efficient, that’s probably why my doors get all messed up.

So if you have an idea on how to do that it would be wonderfull ^^

Thank you !

Are you talking about saving door states or level streaming? The game instance is the best way to save variables from level to level. Instead of casting to each door BP. Make a new actor BP, call it something like BP_LevelManager. To the begin play add a GetAllActors(BP_Door)>Get a copy and promote it to a variable. Place it in your level. You can use that as a reference to call variables and events on the door_bp. Set up boolean checks for all your doors in the BP_LevelManager. Pass all those into a boolean array and save it in your game instance.

In the BP_LevelManager you can also setup your levels to stream so that whenever your players go to the doors it will load the previous level.

Thanks for your answer. I’m not an expert on visual scripting so I’m sorry if I ask dumb question.

I made the BP_levelManager but I’m not sure on what to do with that. What node do I use in my door BP to check if it’s the right door to spawn at ?

EDIT:
In my attempt, I had something similar where: if “door_open” is true -> check if “doorID” is the same as game instance “doorID”. If doorID is the same, teleport player to door. (sorry if it’s confusing)
But everytime the script run, it has to do it for every door, and sometimes “door_open” is desactivated and prevente the other doors from being checked.

I don’t really understand boolean array, do you know a documentation that could help me ?

OK, so I managed to resolve the problem on my own. Apparently I didn’t used the proper teleport point. And I messed up some variables. But now It’s working !! sorry for the useless post
Thank you for the answer anyway ^^

Glad you figured it out! That code snippet I sent you was wrong anyway, sorry bout that. Not a useless post! It helped me remember how to do it correctly and that there is an even simpler solution available.

For anyone looking for a solution:

https://www.unrealengine.com/marketp…asy-multi-save

The easy multi save system is free at the moment. All you have to do is add the interface to your blueprint holding your door states array and set the variable to save. It has one save node and one load node that handles everything for you.

Documentation explains it well: Easy Multi Save Documentation - Google Docs