Creating a new Object returns Nothing/Null

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

Hey guys,
I have a problem creating a Object for my Player Skills. I have a external Script which has a Object for creating new Skills

class createSkill:
    var name: String
    var baseDemage: float

func _init(name: String, baseDemage: float):
	name = name
	baseDemage = baseDemage

and I’m creating a new Skill called Fireball with Base Demage 10.5

var   Skills   = preload("res://Scripts/")
const Fireball ="Fireball", 10.5)

But if I print out or Fireball.baseDemage i can’t see it

print("Name - " +
print("Demage - " + String(Fireball.baseDemage))


Name - 
Demage - 0

What I’m missing?
Thank you in advance!!

:bust_in_silhouette: Reply From: AspinBlack

print (“Name - %s” % (

It dosn’t work. I tried it multiple times. But when i use print Fireball i get back a reference




But print( or print(“Name - %s” % ( it wont work.

TroubleBeast | 2019-04-21 09:25

:bust_in_silhouette: Reply From: TroubleBeast

Ok I just found the solution…

If you define a new Class and use _init function to set the variables values you have to use the keyword self.varName = argument

func _init(name: String, baseDemage: float): = name
	self.baseDemage = baseDemage