Using: SugarCube 2.20 / Twine 2.1.3
I have an issue with (probably) saving and loading my game.
I implemented the inventory system mentioned here:
When saving and loading my game, the array in which my objects are saved becomes empty (and who knows what other black magic happens in the background). I know that StoryInit doesn't run when a game is loaded (which is good), but the question remains: how do I make sure that my arrays of complex objects get properly saved and when I do so, how do I reinitialize my items and restore their state after the game has been loaded?
I read something on MadExile's SugarCube2 documentation that I need to use the metadata variable, but there are no examples how this needs to be implemented for an array of objects.
I have a feeling the story doesn't just stop there and I need to serialize my objects "correctly". Which I somewhat do with JSON.strigify() to carry out integrity checks and to generate unique IDs for my objects, but I do 't use that information to make the object storable.
Some guidance would be appreciated on how to approach this issue, please.