Added a level to the beginning and the quite game node now crashes

I wanted to make an easy first level to get things started so I added a new level and renamed all levels in sequence from 1 to 4 but now the level win blueprint gives errors and the game crashes when I get to the the end of level 3. It may just be closing somehow not seeing level 4, which is dumb design, but the errors are still troubling me and I can’t test a print screen to see if level 4 is called in the array as it closes the game before anything would print. Saving all tells me:

The asset ‘/Game/BluePrints/Volumes/bp_levelWin’ (bp_levelWin.uasset) failed to save.

Cancel: Stop saving all assets and return to the editor.
Retry: Attempt to save the asset again.
Continue: Skip saving this asset only.

All I can do is skip saving or I get an error

Error saving ‘…/…/…/…/…/…/Users/User/Documents/Unreal
Projects/CrystalCavern/Content/BluePrints/Volumes/bp_levelWin.uasset’

I did a print log and I can see the levels names increase up to the last level 3 and crash when trying to go to level 4.

If I play from level 4 completion takes me to level 1 and then when I end level 2 completion crashes and says “none” in the print screen. However if playing from level 1 I can get to level 3 and then completion closes the game with no print screen. I have checked each levels name and they are accurate and saved with the updated names?

Edit:
I added level names to the array and checked my macro library but now I also get

The following assets failed to save correctly:
/Game/BluePrints/Actors/Library/cc_MacroLibrary ←
/Game/BluePrints/Volumes/bp_levelWin

Did you manage to get this resolved? There’s not really enough information here to troubleshoot and would probably need access to the project

No this error bricked the project. What would help trouble shoot? I gave the errors and the blueprints.

Really need the whole project. If you share, I can pull down and try find you a solution. Something like this shouldn’t kill a project.

Are you using 4.27?

Thank you. I used 4.20 as it is wat was used in the video. How do I upload/share an entire project

best way is to zip it up and add to google drive or onedrive or something along those lines and share a link. I will then be able to download and have a look for you.
I may upgrade to 4.27 to test.

Sorry for the long delay, got busy with other projects. Below is a link. I will remove this from my drive later as its taking up a lot of space but hopefully this will help you see what’s happening first. https://drive.google.com/file/d/1Yo1IcYC-0L_bCBxbJUyk4ehTJ4Z1dek6/view?usp=sharing

1 Like

I have the files. Thanks for that. I’m taking a look but it may take a little while to track down the issue.

EDIT I actually found the solution. You have a bug in GetNextLevelName. Your BP_LevelWin has an array with 2 items, of which Level2 is the second item. The code tries to increment the level index to 2 (0 based) so looking for a third item in the array and throws an exception. Now, assuming you want to loop back to the start, it’s simple. if you take the new index and perform a modulus based on the array of level names’ length, you will reset the index back to 0.
e.g. you are on Level2, you increment the index which becomes 2. The array length is also 2 so a modulus would result in 0, i.e. back to Level1

See the circled section

Great! Thank you so much for taking a look at this and getting back to me. I never would have found that on my own. One new question from looking at your solution… What is the ++ node your using? Also why would changing level2 to level2a correct this? I added level 3 and 4 to the array but I also like the idea of looping back to the begging with a modulus for now so I’m implementing that but I’m not sure how your passing the get level name through an add node?

Not sure why renaming level 2 to 2a worked but it did. I think it’s related to the find function and if it cannot find the level it returns -1 and so becomes 0 when 1 is added.

Anyway, ++is shorthand for adding 1 to something. There’s a – as well which decreases by one.

As for the add node, it actually returns the index first, which you increment, then look at the array to get the name from the index Now, if you don’t want it to loop, you need to add a different win volume on your last level or something like that - you could even add a final level redirect to the array which shows the win message but a whole level for that seems a lot. It depends what you want to do or how you want the game to finish.

Thanks I found the " IncrementInt " node and set up for now and will set the final level end game script when ready. Thank you again!

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms