Script getting wrong MAXHP from other script

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Newby

I made this game project on godot 3.0.6 and updated it to 3.1.0 and now the HP script doesnt work.

This is a script that i use to extend to my KinematicBody2D characters (Enemies, Player)

extends KinematicBody2D

export var DMG: int
export var MAXHP: int

var dmg_timer=0

func dmg():
	if dmg_timer>0:
	for area in $hitbox.get_overlapping_areas():
		var body=area.get_parent()
		for i in 1:
			if dmg_timer==0:
			if HP<=0:

Originally it worked, it got the HP and DMG i set for the characters that extend the script, like 10 for the Player and 5 for the enemy, but now it just get the data from itself and now the only get 0 HP

I dont really know a lot about godot and its scripting so how can i make it so that my script runs normally again. What did they change in scripting for extending scripts.

:bust_in_silhouette: Reply From: Vrzasq

Check if You have correct values in editor. From what I see script passes default value for int which is 0 or dont have required reference.

I use this script and extends it to my character scripts and the i edit the variables i exported of the character scene in script variables i set my play HP to 10 and enemy to 5 but the script isn’t getting the HP variable from the scenes only from itself.

Newby | 2019-09-11 23:54