[SOLVED]Radial weapon menu/inventory

So I’m trying to make a radial menu for selecting picked up weapons in my game. I have already made a menu pop up when a key is pressed, with icons working properly. Each segment of the menu is a separate object.

What I want is to able to pick up weapons and add them to an inventory and display them in order around the radial menu (clockwise). I must also be able to discard specific weapons and the display would change accordingly (gaps being filled by weapons further along the menu). Sort of like Ratchet & Clank
or RDR.

I was thinking of a variable for total number of weapons in inventory, defining which inventory segment should display each added weapon. I’d have to store that data though, so I can use it later to remove weapons and change the order.

It would be great if any of you superbrains could help me out. Thanks! :grinning:

remember the radial display is just that - a display.

Have a look at my inventory scroller, the source code is downloadable. It populates the display from a list of objects. When an inventory item is removed or added, it just refreshes the display.

As for swapping items over, add a button to do that, where the player clicks it, and then selects the 2 items to swap. You do that to the inventory list, and then refresh the display.

1 Like

Thanks! I’ll look it over.

Hi! Is there a way to check how many children an array variable has with conditions?

Each segment needs to know the order in the array and the name of the object. I cannot figure out how to do this.

The “RWM” is the first segment of the menu. There are eight, and each segment needs to display the corresponding item on the array. I’ve got an icon object, and I will change it’s animation to the appropriate weapon image.

Use the compare 2 numbers and VariableChildCount(arrayName):

image

image


Give each segment an id, from 0 to 7, in the order you want them filled. Then populate it with the matching array element.

Are there any expressions to find the string of a specific index of the array? Something equivalent to " string of (index number) of (array variable)". I installed array tools but it doesn’t seem to have an expression to get a specific string (or number) from its index. It has an expression to get an index from a string, but that is useless for what I’m trying to achieve.

Sorry for being a dumbbrain. I appreciate your help.

Use VariableString(ArrayName[Variable(ArrayIndex)]), where ArrayName is the array, and ArrayIndex is the index number you want to retrieve.

still not working

Not sure what I did wrong.

Ah, in hindsight I explained that rather poorly. ArrayIndex is a variable that holds the index value.

But if you know the index, for example it’s the first element, then use VariableString(ArrayName[0])

Thanks man. It works now. Absolute life saver!