Custom Resource made Variables of parent needed in child node

Godot Version

`Godot 4.3

Question

This problem involves three scripts.

one script is my Character_statistics_sheet. it has been made into a custom resource. containing many variables.

second script is my Blue Golum, that uses the Character_statistics_sheet .
the code for that looks like so.

@export var statistics : Character_Statistics_Sheet

third script is my enemy_damage_caster. It exists so that the hitbox only initiates during a specific part of the attack animation.

THE PROBLEM: I need to get a variable from my Blue Golum, that resides within my Character_statistics_sheet custom resouce and use it within my enemy_damage_caster.

I’m trying to get the “attack” variable from that.
into the DAMAGE constant of this.

Off the cuff, I would say you can’t assign ‘variable’ things to a constant.
Try:

var DAMAGE

func _ready():
  ...
  DAMAGE = blue_golum.attack
1 Like

I found a workaround by simply putting the same custom resource into the 2D area node and script that I’m working with instead of trying to get it from a parent. I also made the variable a variable the whole time and use the _ready function to make sure my custom resource is getting attention. screen shot bellow.

it works.

thank you for the help.

1 Like