Godot Version
v.3.5.2.stable.official
Question
Hi, I am having a big issue with my code:
extends Node
signal player_initialised
var player
func _process(delta):
if not player:
initialise_player()
return
func initialise_player():
player = get_tree().get_root().get_node(“root/World/Player”)
if not player:
return
emit_signal("player_initialised", player)
player.inventory.connect("inventory_changed", self, "_on_player_inventory_changed")
var existing_inventory = load("user://inventory.tres")
if existing_inventory:
player.inventory.set_items(existing_inventory.get_items())
else:
player.inventory_add_item('Sword', 3)
func _on_player_inventory_changed(inventory):
ResourceSaver.save(“user://inventory.tres”, inventory)
The error message is in the title. I have tried removing the /root part and that doesn’t work. I am having issues with this.