Loading the Next Level (UE 4.27)

Just drag from the cast node blue output pin and select Promote to variable. This will create the correct variable type automatically.

Some additional logic to change color and text of the specific blueprint instance, you can see in the video I shared here:

  • In editor it says “Text” and it’s grey, the default color.
  • When in Play it says “Level Incomplete” in yellow.
  • When completed it changes to “Level Complete” and green.

I could share it later but it’s not relevant to what you are trying to achieve. Was done just for debug / demo purposes.

I’ll have a look at that video when I get the chance. In the meantime, does all this new code go on the BP for the game instance, or on the Goal actor’s BP?

This in Game Instance, because it manages the levels:


This in the actor that will call the Game Instance to tell it the level has been completed:

So far, here are the BPs I have.

For Goal:

For PuzzleGameInterface:

Right now, the Goal one is complaining that it “could not find the function ‘CompleteLevel’ called from CompleteLevel,” even though that function does exist in the interface.

Idk if this is because of Blueprintue, but this needs to expose the variable you are changing:
Screen Shot 2022-02-08 at 6.11.55 PM


Just to clarify: In my case BPI Simple Interact is a blueprint interface I used to have it trigger with the character. You can do anything here as long as it triggers CompleteLevel event to move to next level. It could be reaching max point, arriving at X location, overlapping X actor, etc…
Screen Shot 2022-02-08 at 6.14.50 PM


Aside from that think it’s the same from what I shared. Is it working as you expect or giving you any problems?

I haven’t been able to test it yet, since I get an error or caution when I compile what I have. So, the BPI Simple Interact is a custom event, or do I need to do more than just make it a custom event?

I’m not sure how the “LevelStructure” there has an end quotation mark on the end, but it doesn’t in the actual program. Would I have add a Set Level Structure (by ref) to connect the “Set members”’ linking and Struct Out nodes?

I just did a test run, and the game does not load the next level when the goal is triggered.

If there are no errors or warning in you log, we need to go step by step focusing on BP communication… so here goes a small wall of text :rofl::

  1. We have a BP that is able to know when a level has been completed, then comunicates to Game Instance.
  • we need to confirm it is able to know level has been completed, se we need to print from that BP when he is being informed.
  • This BP then calls Game Instance. We need to know the funcion to call is being properly executed, so a print node after this call could tell us that.
  • This BP has instances with a variable that tells Game Instance what level has been completed. We should check if they are all set accordingly.
  1. Game Instance recieves the call.
  • Add print from Game Instance when it recieves the call to know it did.
  1. We then check a condition: if the level thathas been completed is not marked as completed, mark as completed and load next level.
  • we need to check if this condition returns true or false. Another print node. :grimacing:
  1. When the condition returns true, we update the variable to reflect level status.
  • we need to check if said variable is being updated properly… another print nore after the set…
  1. We have a branch that checks another condition.
  • we don’t have to do anything here because one of the condition has a print node, so if we don’t see that print it means it was the other option.
  1. We load the level by name from the struct.
  • Check if the struct name variable has the correct name that correspond with the level to load.
  1. And finally, everyrhing is driven by an integer in Game Instance.
  • we need to check if this int (LevelNumber) is updating accordi nly and not loading the same level.

Could be any one of those problems.

I put in a Print String node at crucial points to determine if the game would either go ahead and call parts of the BP or wait. But, every time I did a test run, the print string would print on the screen at the very start. This means the code must be doing everything at once when it isn’t supposed to. It occurs before the level is even supposed to be considered finished.

Good. Now you should have an idea what to search for and fix.

After checking the “IsCompleted” box under the first array member on the array variable in both the Goal and instance BPs, the game still started at Level 1. I even tried throwing in an int + int node in attempt to make the LevelNumber increase by 1 for each time the goal is reached, but nothing seems to work. I feel like I’m missing something, but I’m not sure what. Other than maybe throwing in a node that checks “IsCompleted” for an array member, if possible.

Share your current blueprint to see.

Okay. Here they are, along with the two other BPs for the sake of possible relevance:

PuzzleGameInstance:

Goal:

ConductorParent:

Conductor:

Hey!!

Now I remember this:

You need to find another way to trigger the Complete level event.

What condition have to be true for the level to be completed? If you can run a single print node when that happens, then you will also be able to call Complete Level.

The “Goal” actor must be powered; when it is powered, it changes from its “default” material to its “powered” material. When the Goal actor is triggered in this way, that is when the game must advance to the next level.

Make a text print 1 time when that happens and then you can replace with calling Complete Level event.

I have the Complete Level node after the BP Simple Interact event’s starting node. When I put in a Print String, it wasn’t triggered until the Goal object’s status changed. I think I’m on the right track, but I have a feeling I might be using the wrong variable.

Since nothing seems to trigger the BP Simple Interact event, I wonder if I should put in a Boolean that only applies to Goal objects that is set to true every time a Goal object is powered up. That way, whenever the Boolean is true, the program would know if the conductor is a goal object or not. Might that work?

Here is an update on the program, sharing the four BPs and clumping each set of nodes as cleanly and closely as possible.

After taking a break, fighting off a stomach bug and looking over the BPs, I figured that I would try declaring a Boolean variable that is supposed to help the demo distinguish between Conductor and Goal objects, so that the game would load the next level when the Goal object is triggered. As you will see in the BPs, there are several Print Strings I put in to test the process. Right now, all the Print Strings print at once, as soon as the Goal object changes to its “powered” material (as seen in the included screenshot), indicating virtually the entire program executes when parts of it aren’t supposed to.

Is there anything I’m missing or set up incorrectly?

ConductorParent BP:

Conductor BP:

Goal BP:

PuzzleGameInstance BP:

After finding this video – UNREAL ENGINE 4 - LOAD NEXT LEVEL - YouTube – I decided on what to do. What I will do is make copies of the Goal entity and have each one use the Open Level function by name, and each Goal entity will be assigned to a specific level.