How to create a level unlock system?

So i am currently working on a simple, single player 3d platformer game - i am pretty new to UE4 but i think i’m making good progress with this game.

In the game, i have a level select widget that allows the player to choose between levels (Currently there are 3 levels), how can i make it so that that player cannot enter level 2 if he did not complete level 1? and that he cannot enter level 3 without completing level 2? and so on…

Here is a link to a video of the game:Dungeon Quest trailer! - YouTube

You could do that pretty easily with a boolean I suppose.
So you make a boolean for each level. Like (no Level1 since it’s always unlocked), Level2, Level3 etc.
At the end of each level, you make a trigger which sets the boolean for the next level to true and cast it to the Level Selection.
The Level Selection should then check for the boolean variables.
If Level2 is True, it’s clickable, if false, it’s greyed out.

I tried doing that but it’s not working can you please send me some pictures maybe?
like where do i create the booleans and what do you mean by cast it to level selection?

So I made this setup quite quickly.
It’s purpose is to show you how you could approach this kind of thing, there are probably some other ways to do this.

I made a new blueprint class and searched for “SaveGame” to get the class, selected it and called it MySaveGame.
This is where I store and save which levels are unlocked or locked.

http://i.imgur.com/3LhCCqC.png

Inside the SaveGame Blueprint I made two boolean variables.
Level2Unlocked and Level3Unlocked, you can repeat this for all your Levels (except Level 1)
Make sure you click the eye to the right of their name to make them public.

http://i.imgur.com/oCXpq0Y.png

The next thing I made is a menu for the level select. You have this already but you’ll need to change the blueprint for my system to work.

Mine is just super simple like that:

http://i.imgur.com/17bIcjr.png

In the Graph of this Widget, I first check if we already have a Save Slot, if not I force it to make one, then load the game from this slot to get variables stored in there.

http://i.imgur.com/iqSyPG3.png

Cast To MySaveGame is there to get a reference to get to the content of the save game.

In the next step, I hooked up the buttons.

http://i.imgur.com/FXICUA7.png

The button for the first level doesn’t check any variable. The second and third button both check the validity of the save game to make sure “MySaveGame” has been created at this point.
This uses the reference I made earlier via casting.
Then, if the Bool for a level inside the save game is true, I can open the level.

The last button will delete the save:

http://i.imgur.com/fog6A2T.png

The last step is to unlock the next level, I used a trigger box at the end of each level, like this:

http://i.imgur.com/BzfT2pf.png

Oh, and casting is a way for blueprints to communicate.
You should give this a read:

(I had to post this extra, since I ran out of characters)

Thanks so much!
I really appreciated your time

http://harrisongreetingcards.net/index.php?main_page=popup_image&pID=449&zenid=19edf0b66f7ba871aa935eb0faa22265

I’m sorry i used this system for a while but for some reason today it’s acting weirdly…
Like for some reason level 2 is unlocked at the start and after i finish it it locks its self and unlocks level 3, then when i unlock level 3 and finish it the same thing happens, level 3 locks itself and doesn’t even unlock level 4…

I’m sorry i used this system for a while but for some reason today it’s acting weirdly… Like for some reason level 2 is unlocked at the start and after i finish it it locks its self and unlocks level 3, then when i unlock level 3 and finish it the same thing happens, level 3 locks itself and doesn’t even unlock level 4.

Here is the solution:

Apologies if it took a year to say, just found out this thread a few days ago.

What is “Time” in this blueprint? Is it your savegame object, or something else?

Yes, that would be a save game object, notice it is being cast to from a “load game from slot” output node, this is the only type of object that node returns.

Hi i have a problem. When i go thru finish line nothing open or unlocked level. I try it change open level command on create a widget but no reaction. Can u please tell me where is problem ?
260524-

Hi this part of script belongs to Main Menu or trigger box ? And secondary can u take a look at my script and tell me where is mistake ? I really dont know and i try everything… I can give you my facebook but i explain already my problem on these page as well just type to search “Boolean problem”. I would really appreciate it. Thanks.

I have done the same thing as its written but it still didn’t work and level 2 is not unlocking after completing level 1 please help

1 Like

hey i am also making this system i see that video of ronit only in which he try to tell that open level after compilation in my game in level 1 if i collect all coins then level2 should be unlocked then next level and then next there is a wierd issue for me like when i play game and i progress and return to main menu i can open any level which i unlocked but as soon as i exit and re entre i have to unlock all levels again does anybody know the solution