Cycling inventory in the proper order, whether i have three or fifteen of the items

Might be a bit of a strange title, but hopefully gets the point across. Basically I have several weapon pickups spread around a map. I am working on a quick switch function which actually works right now if i have every weapon - the weapons cycle in a predictable order with each tap of the button; I cycle through all the pistols first, then all the smgs to all the ar’s, a rocket launcher, and so on.

However I want this order preserved if i have say three weapons instead of all of them. For example, if i go pick up the knife, the rocket launcher, and an AR, when i tap to switch from unarmed i want to go knife > AR > launcher

I’m storing the weapons in an enum array and switching on enum to get the current version working, but if i’m missing any weapons i have to tap through some “blanks” until i hit an array index i actually have. Anyway hope this makes sense. Thanks in advance for any advice, it is greatly appreciated!

Actually thanks anyway, I was overthinking it. I wrote a function that runs through branches in the proper order every time the button is tapped, checking to see which weapons are held, and whichever ones turn out to be “true”, that weapon gets equipped.

I use an integer array to loop this…

​​​​​​​