so I’ve created 15 levels, and I want the player to be able to load a level (say level 5) in the level selection menu, only if he’s finished the level. So locked if he hasn’t finished it yet, open if he’s finished it (to get better scores etc).
Now I have a save system in place, where by pressing “continue” you continue where you left off. So my guess would be that it is connected to a blueprint that recognises your savegame. But how would I go about doing this?
Maybe with something like this:
current level = 5
selected level = 7
if (current level >= selected level)
{
allow player to load it
remove ‘locked’ UMG effects
} else {
nope
}
It sounds like you already have a way to save the player’s progress. Where ever you are handling your UMG logic, have it check the players progress. If the player isn’t far enough in the game, have the UMG widget use a tint (probably a dark grey color) or something to show the player they can’t select it.
I’m not sure how your save game is set up, but say you have an integer that represents the highest level completed. Retrieve that integer from your save game and get a compare int node, then compare that integer to the level that the UMG widget is supposed to represent. Make a color variable.
Pull off the < exec pin from the compare node and set the color variable to whatever you want the locked out level to be tinted. With the = and > exec pins, set the color variable to anything, but with an alpha of 0 so no tint is applied. Bind the level widget tint to the coresponding color variable.
I imagine the player won’t make any progress in the main menu so you won’t need to check this on tick or anything. Just do it on Begin Play in the UMG blueprint.
This is what I’ve come up with. It loads the levels, but even the ones that aren’t “saved” yet, even though I’m calling it forth out of the saveprogress node from my save system, which doesn’t really make sense to me.
Penhoat, I use a boolean array in my game to flag each level as complete or not. As you complete a level, the value is set to true and saved. At my level select menu, it checks to see if the level has been completed. If so, the next level is unlocked. Not sure if it’s the best way, but it works like a charm. Check the video series in my sig…I think video 12 shows the way mine is done.
Tearl everything you did works like a charm, I’d like to know one thing though. I can’t get text to display in my level ending menu (you beat the high score, boohoo). I followed the video exactly, so didn’t make a mistake as far as I can see. You did however in the video, not show how you made that variable (video 11), now I assume it’s nothing special, but just to be sure, is any box in that variable ticked on?
Simply put, the set text won’t display, only text set as default in the variable
EDIT: Nevermind, had to do with pausing the game before it could cast