How to Get the Last True Bool of an Bool Array

I have an array of bool which holds completed levels, there are 13 bools in it. A higher number bool cannot be true unless all the bools under them are true. When player completes a level the bool of that level becomes true. So what i am trying to do is get the latest completed level. How can i get the biggest numbered true bool from an array.

Hi, why not, instead of having an array of bools - seeing as they’re sequentially completed, just have an int32 that you increment each time - then you can just read the value to know which levels have been completed.

The player can play the same level again so if do it that way i would need to save a “LevelBeenCompleted” boolean in the level blueprint i think. So it would be almost the same thing.

player needs to beat the level 3 before playing level 4 but if player finished level 3 he can play the previous levels again

Yes that should work, if the player completes level 3 again, only increment if the counter is less than 3.

When the player completes level 4, the counter is at 3 so increment to 4 etc.

1 Like

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