Skip Level mechanism

How would you create a Skip Level mechanism?

For my game I’ve got twenty odd levels, how would I create a skip level on key press mechanism if it was too hard for the player.

So for example if level 12 was too hard they can press X and they go to the next level and what would this look like as a BP?

Maybe something like this. You would just need to keep track of what level your currently on as an integer, and add one to it to select the correct level to load.

Thanks for that, only issue is all my levels are in the same map, is there a way I could get it to work like that?

Yes, instead of open level, you can use load level.

Thanks again Steve!

But I think I may need to explain a bit more, the levels at the minute are a bunch of similar scripts in my level BP that each start with a “sequence” node, do I need to set these up as “levels”, if so how is this done?

All I need to do is get the right section of code to fire in the level bp in the right order on the player pressing X.

I hope that explains it a bit more and apologies for the hassle, but I really appreciate your very kind help.

No problem.

It would help if you could provide a screen shot of what you mean. The way I would do it is have each level inside its own level map. That way each level could have its own logic. Then you could just call open level which would move the player to that level. Same for when the level is completed, or skipped.

Hi Steve,

In my level bp (don’t laugh) this constitutes as 1 level, theres 24 of these!

I fully recognise and appreciate it would be far better, logical and more efficient to have each of these sections as a separate level, but is there anyway to keep everything in 1 BP (as it is) and get the skip level functionality to work as needed?

Would appreciate your help massively.

Unfortunately no, and no I’m not gonna laugh, we all start somewhere and it takes practice.

So the screenshot is kind of low resolution so I can only make out some of the things you are doing, and I see a lot of things you really shouldn’t be doing, because your just fighting unreal. There is a massilly better way to do this, and won’t cause as much trouble and limit you as much as this.

First, level blueprint (in my opinion) is not a good place to do just about anything. I almost never find a need to use it. It is good for quickly testing things, and occasionally its a good place to put some startup logic, or loading logic (even then id probably use another class like game mode, game state, or game instance). The biggest problem is that other classes cannot really communicate easily with level blueprint and any logic that is inside cannot be reused between levels. (causing you to redo work 24 times)

To give you an example of how to improve this, and make it work so that you can do what you are trying to achieve:

  1. Player input like level skipping should be handled inside the player controller class.
  2. Widget stuff should be moved to a player HUD class (which the player controller has easy access to call functions on, like add and removing widgets).
  3. The console commands can probably stay, but if its something your doing in every level, then move to game instance or a similar overarching class.
  4. I see a get all actors of class being called but not doing anything. (Should probably remove that as its an expensive call.)
  5. I’m not sure what all the delays are doing, but if it is for order of execution reason then that should probably be fixed (because that’s not a reliable way to always guarantee the order will be the same every time). If its cosmetic reasons then that’s okay.
  6. and finally it looks like your changing a material a bunch of times on an actor that is in the world, that actor should hold that logic by being its own blueprint, which you can get a reference to and call on it whenever you need it to happen. (Also that’s a prime candidate for using a loop and select node.) This also means you can use it in every level if you wanted to without rewriting the logic.

I know it’s not the exact answer you wanted to hear, and it sucks you have already built this 24 times, but there is a reason it’s this way. There is no magic solution to fix a foundational issue. You are much better off fixing the main issue, it will make you a better programmer, and make your program a better program. (not to mention also get the desired results you want).

I wish I had a magic solution to give you but, I do not. I’m not sure anybody else will be able to either.

No problem, I’m just trying to give you the best answer I can, and I think you just answered it yourself :slight_smile:

Yeah, I understand it’s not feasible to re-due all this when there is deadlines, so in the mean time the only thing you really can do is use a variation of what I first mentions. Switches and selects go hand in hand and are some of my favorite nodes.

The main thing you need is to know what your current level is, by name or by int will work. You can do a switch on either, but int would probably be better for what you are doing because you can just add one to it. (Or you could even run the output of the select I first showed to a switch). Then just hook up the correct logic to the correct switch output.

It’s probably really your only option with your current setup.

I really appreciate that, thanks again!

You are welcome, I’m glad I could help. I just ask that if your happy with the solution to please mark it as correct, so that others with a similar issue may find the answer. Thank you!

Hi Steve,

I fully appreciate the answer and I promise I’ll follow your suggestions.

Although because I need to show something working to some research students on Thursday, could I use a switch on int node and hardwire it’s outputs to the beginning of each level sequence, could that work?

This coupled (like your initial example shows) to an int variable to store the current level number and activated on key Press?

I promise this would be a temporary fix, I’m just being killed by deadlines atm and a very tiny mind when it comes to most things.

Please don’t let a bald guy get even more bullied by students!

Massively appreciate all your very kind help