[Solved] Dynamically saving the loading data from Storage

I am saving some data at the end of each level completion. If the data exists in the storage, it overwrites the data; otherwise it creates a new entry. I am using the below event sheets:

  1. ResetGameData: For changing the game variables to default values.
  2. SaveGameData : For saving the game variables
  3. LoadGameData: For loading the game variables.

My problem is with the data that I am saving at the end of the level with SaveGameDate. It does not update the LoadGameData event sheets unless I manually add the events. For instance, at the successful completion of each level, it successfully saves the values for the next level, but does not update the load value.

Reset game date:

Level1.Complete = 0

At the successful completion of Level 1:

Level1.Complete = 1
Level2.Complete = 0

But while loading the data, it only populates the data that has been triggered by the LoadGameData event sheet and not the new one that have been saved by SaveGameData, unless I manually add an entry to both SaveGameData and LoadGameData event sheet.

I would like to save/load data automatically in both event sheet based on the game’s progress and like to reset it (removing variables other than the default ones). The only solution that I can think of is to add ALL the values in Reset/Save/LoadGame event sheet and update them as game progress.

Does anyone know of a better solution?

Try as I may, I just can’t picture what you are doing.

Can you provide screen snips of the various sets of events for each game data action? Then we’ll have a clearer picture of what is happening and may be able to help.

Sure. This is a simple example of how I am saving the data in the Storage:

This is how I am loading the data from the Storage in a temporary var:

And from temporary var to global variable:

For adding additional levels, I have generalized the code to save the data to storage, like:

I m not sure if there’s a way to do something similar for loading the data from storage, except loading the data for each level as I am doing currently.

@MrMen: While explaining the problem, I realized that problem was due to the wrong assignment of global variable while saving.

Instead of saving the global variable in …“ToString(GlobalVariable(UnlockedLevel)”, I was saving it in “ToString(Variable(UnlockedLevel)”.

The issue is now resolved. Thank you!

1 Like