Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | hrp |
So i have first inventory scene with item slots array
extends Node2D
onready var itemscene = preload("res://src/Items/Item.tscn")
var item
export var inventory = [null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, ]
func _ready():
inventory[28] = additem()
inventory[28].itemdata.type = "test28"
inventory[29] = additem()
inventory[29].itemdata.type = "test29"
print(inventory[28].itemdata.type)
print(inventory[29].itemdata.type)
pass
func additem():
var inputitem = itemscene.instance()
return inputitem
Then i have item scene with dictionary
extends Node2D
var itemType = ["armor","weapon","trincket","other"]
export var itemdata = {
"type": "weapon",
"damage": 10,
"attackSpeed": 0.4,
"strenght": 1,
"intelect": 1,
"dexterity": 1,
"texture": ""
}
but when i changing scene in one array’s slot all other slots are changing too
I had once this type of issue. Try if it works when itemdata is not export
type
Inces | 2022-08-24 20:28
Actually works. Thank you very much
hrp | 2022-08-25 06:13