Hi everyone,
First time posting here, sorry if this is the wrong place.
I’m getting the following error in my code, I’ve been trying to figure it out for a few hours now but it’s set up exactly the same as another section of my game so I’m not sure what’s going on anymore!
Error:
Invalid call. Nonexistent function ‘heal’ in base ‘Nil’
I’m using a global script Instants.gd to filter through cards in my game, and then activate the cards effects. I was trying to call the function from each card’s script originally but I couldn’t get it working with my limited exp in godot, so moved to using this singleton instead.
Unfortunately it looks like the Instants script isn’t picking up the CharacterStats like the other scene.
Instants.gd script:
u/export var char_stats: CharacterStats
func _heal(value): #blessing_of_the_clearing:
char_stats.heal(value)
I’m not sure why the char_stats var is returning Null in this script, but my “campfire” scene & script seems to be set up identically but are working just as intended.
I suspected the Instants script needed to be attached to a node in it’s own scene to be able to link the u/export
in the inspector, but that hasn’t worked on testing either.
Hopefully this is an obvious fix for someone with more experience!