Compare value to array index number.

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

I have a group saved into an array:

var get_nodes = get_tree().get_nodes_in_group('wpn_icons')

What I want to do is compare the INDEX number of that array to a value. If it matches, it changes the icon’s color to the needed palette. It not, it changes the color to a greyscale.

Example:

if get_nodes == weapon:
    get_nodes[weapon].material.set_shader_param('r_col1', Color(Blue)
else:
    get_nodes.material.set_shader_param('r_col1', Color(Grey)
:bust_in_silhouette: Reply From: Sir_Skurpsalot

something like:

if get_nodes[0] == weapon:
     Do stuff