0 votes

I have an Item list node that holds my quest and I want to know how I would save the node and all the items it’s currently holding. Thanks to the Godot docs I know how to save variables like my player stats but when it comes to a node like the Item list I can’t turn it to a var to store it. So that’s my question, how to save a node like the item list using something like the save method from the godot docs. Thanks!

https://docs.godotengine.org/en/3.2/tutorials/io/saving_games.html

in Engine by (655 points)
edited by

1 Answer

0 votes
Best answer

You can try using the inst2dict and dict2inst methods, see here: https://docs.godotengine.org/en/3.1/classes/class_@gdscript.html

If those don't work, your best bet is to manually serialize the properties of the nodes you know you will change, and manually deserialize them. Example:

func serialize():
    return {
        "position" : position
    }

func deserialize(dictionary):
    position = dictionary["position"]
by (96 points)
selected by
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.