Skip to main content
GameDev.net gamedev.net
Using GameDev.net for your class this semester?
Learn more →
🔒 Locked 🎯 Unreal

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

Started by GameDev.net Jun 24, 2019 at 2:02 AM 0 replies 2.2k views
Original Post
GameDev.net
GameDev.net

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!

Read more

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.