How to get levels to open in a specific order when the trigger is the same
I have created more than two levels to my game but the way I transition between them is when the enemy in the castle is hit then it opens the next level. The problem is that it only works to go to level 2 because of the way it is scripted in the blueprint already. I need to know if there is a shorter way to connect the levels in a certain order because the only way I know how to do it now is to create a separate final enemy blueprint for each level and pair each of them to the projectile (which is where the open level bp is working currently) and have an even more massive complicated blueprint.
asked Feb 21 '17 at 01:05 PM in Blueprint Scripting
You could assign an index to a level in an Int variable, for example: Level 1 = 0, Level 2 = 1, Level 3 = 2...
When you hit your final enemy, you could use a Switch on Int node, and load the level you want based on the index of your current level, for example. You can then, change your current level index and carry that value into the next level.
That said, you don't actually need to have an order saved in some place or configuration file, but of course, this is just a low-level solution and easy way to implement that.
A second approach would be to store the names of your levels in a string array in the order you want them to be presented to the player, and then just open level with your current index + 1 when you hit your enemy.
I haven't worked with levels in a while, so these may go wrong, but test them out. And please let me know if that helps.
answered Feb 21 '17 at 01:24 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here