I’m struggling about a very simple feature every old school FPS has which is switching between Weapons that have been picked up by the Player (or given at the start of a game).
I have these Variables in my Switching system :
• Weapon Index (Integer), which simply is the current Weapon Index number.
• Available Weapon Class Array (Class Array), which is an Array of Classes where the Weapons that have not been picked up (through Pickup Blueprints with Set Array Elem adding the proper Weapons in the “Inventory” so to speak) are set to None (21 in total) - and the picked up ones having the corresponding Weapon Blueprints.
What I want to do : Linearly skipping the Classes that are None (Invalid) when Switching, until it finds a Valid Class.
So that, for example, when I have the Weapons 1 and 3 in my Available Weapon Class Array, skip the Index 2 after 1 and all the rest after 3, comming back to Index 0 (which is always Valid).
I already know about the “Is Valid Class” and “Is Valid Index” nodes - but I have no idea what node should I use to loop an increment when switching.
I guess **For Loop **or For Loop with Break look like what I need, but I’m not sure how “Loop Body” works exactly and how to “Complete” the loop.