u/Leading_Ad9565

▲ 5 r/godot

I am sorry if I am using the constructor stuff wrong, I am very much used to c++;
I made an item class

extends Node
class_name Item
var _item_name: String
var _rarity:float
func _init(item_name:String, rarity:float) ->void:
  _item_name = item_name
  _rarity = rarity

then the should be initilized by another script

var crossbow:Item = Item.new("crossbow",0.01)

but I keep getting the error "_create_instance: Error constructing a GDScriptInstance: 'Node(item.gd)::_init': Method expected 2 argument(s), but called with 0"

but I am clearly calling new with two arguments(?) I am not sure what is going wrong

reddit.com
u/Leading_Ad9565 — 9 days ago