how do you setup a index weapon selector with mouse wheeling?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By dannydev3d

Hello, i want to setup a simple weapon manager where selection is done by scrolling the mouse wheel.

What is the most efficient way to achieve this?

Let’s say, If i have a variety of weapons as children of the weapon manager, should I them reference as an array to use in a for loop? how do i then name each array’s element/indices & match to it’s children’s indices so i could later use both of them as one indices to change their values from the mouse wheel? Which in return will change the weapon…(Correct if I’m wrong but that’s what I understood on get_children from the Node doc):

For example(script is attached to the manager):
var weapons = self.get_children()
var weapon_index = 0

for weapon in weapons:
if weapon_index:
weapons = self.get_child_count()

am I in the direction? If so how do i continue on from this? thinking about it now, naming each slot will force me to get all the array’s & children indices one by one, am I correct? Is there a better & simpler way to achieve this ? Thanks in advance for your helping!