Variable inheritance

Godot Version

Godot 4.2.2

Question

How do we modify an inherited variable ? ( I’m aware of the init method, but it didnt fit well in my case)
Here an exemple:

extends Node

class_name _Tool

var damage = 0.0

extends _Tool

class_name _Hands

func _ready():
	damage = 1.0

func use(object: Node):
	print(damage) # here damage is 0
	if object is _Tree:
		object.interact(damage)

That looks like it should work.

Did you add the _hand instance to the scene tree? _ready will only be called if your node was added.

if you really want it to be damage =1.0
then just

extends _Tool

class_name _Hands

var damage=1.0

func use(object: Node):
	print(damage) # here damage is 0
	if object is _Tree:
		object.interact(damage)