what this is for is a stat system its supposed to get and change the label but is calling a null instance and i can’t figure out why i am spoon feeding its location to it but it still can’t find it
Leading forward slash in get node, like so get_node("/ means it’s looking from the very top of the scene tree, if this is intended then you need to look through the root node too. If you mean to be looking through children then remove the leading forward slash.
var from_root := get_node("/root/HBoxContainer/")
var from_children := get_node("HBoxContainer")
so i know the order in which it calls it goes
root/node/hbox/vbox/hbox/stat/background/stats/change
ive tried just using
hbox/vbox/hbox/ + stat + background/stats/change
but it came back as null instance as well
the error is
"attempted to call function ‘set_text’ in base ‘null instance’ on a null instance so im not understanding what going on
Seems like the Mainstats container was missing from all of your examples, is that a new addition? If not, your get_node will looks like this.
var stat := get_node("HBoxContainer/VBoxContainer/HBoxContainer/Mainstats/%s/Background/Stats/change" % stat) as Label
var add_value = get(stat.to_lower() + "_add")
stat.text = "+%d " % add_value
Of course make sure your stat variable matches the node’s name exactly, capitalized too. I just noticed Strength is the only capitalized name, might make it tough to access that one specifically.
but stat is already getting its name from the code in the ready function you can see it in the screenshot var button_parent_name: = string button.get_parent().get_parent().get_name() could you explain how yours is different would like to learn more
You’re right, that’s superb! At this point the main difference in my example is using string formatting with % instead of concatenation, could help with missing forward slashes like the one that should be after Mainstats
dude that is such a power move, i was missing a / after Mainstats thank you thank you i have no one to talk these things out with, im teaching myself how to code thank you so much