Hello guys. I have a problem with swapping weapons with one button. I have a variable that turns my weapons on, but each is hooked to a separate key. I want to be able to cycle through my weapons with one button. Like 1press 1st weapon, second press 2nd weapon and so on. Here is a pic of my graph:
Enums are pretty much like arrays of integers (bytes actually), but they have a friendly name. In your case, you have (if you set it up in order in the screen) something like this:
So what you have to do is, whenever you press the key you want to get to the next weapon, to add +1 to your Weapon Type (but only if you are not on the last index, e.g. you’re not in rocket launcher; otherwise you will be in index “5” which is empty). So you’ll have to:
When you press a key (e.g. mouse wheel up), check if we are in the last item.
1.A) If we are NOT in the last item, add +1 to the enum.
1.B) If we are in the last item, reset the enum (get back to 0).
I made a simple set up with a similar enum, hope this helps.