This might be a bit confusing, but I'm trying to pull a value off a variable based on it's name. I have two variables that help with this.
weap_id (Weapon ID from 0 to 11)
Etc. (These contain the amount of ammo each weapon has)
Basically what I want the script to do is this:
if $ammo.value != weapon+weap_id:
$ammo.value = weapon+weap_id
Attempting this give the following error, though:
Invalid get index 'weapon' (on base: 'Node (global.gd)').
Is there a way to combine these two so I can pull the value without typing each one out? I can get it to spit out the name if contained in str(). But that doesn't help pull the data either.