SaveSystem - Quest State loading but variables not

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
walczak
Posts: 10
Joined: Tue Oct 11, 2022 9:42 pm

SaveSystem - Quest State loading but variables not

Post by walczak »

Hello,

I am working on saving Dialogue System with Easy Save 3. I am using "Alternate Setup" from this documentation page:
https://www.pixelcrushers.com/dialogue_ ... _save.html

This is the code chunk for saving:

Code: Select all

ES3.Save("DialogueSystem", SaveSystem.Serialize(SaveSystem.RecordSavedGameData()), saveFileName);
And this for loading:

Code: Select all

SaveSystem.ApplySavedGameData(SaveSystem.Deserialize<SavedGameData>(ES3.Load<string>("DialogueSystem", savePath)));
While Quest states work like a charm, this seem not to load variables. I can see variables with correct values recorded in the save file though.

I tried using this for save:

Code: Select all

PersistentDataManager.ApplySaveData(ES3.Load<string>("DialogueSystemVariables", savePath));
And this for load:

Code: Select all

ES3.Save("DialogueSystemVariables", PersistentDataManager.GetSaveData(), saveFileName)
But no luck.
How can I make this variables work?

Thanks in advance :)
User avatar
Tony Li
Posts: 22200
Joined: Thu Jul 18, 2013 1:27 pm

Re: SaveSystem - Quest State loading but variables not

Post by Tony Li »

Hi,

Hmm, variables and quests should be saved in the same data string. Did you add a DialogueSystemSaver component to the Dialogue Manager and set a unique key value?
walczak
Posts: 10
Joined: Tue Oct 11, 2022 9:42 pm

Re: SaveSystem - Quest State loading but variables not

Post by walczak »

Yes I have DialogueSystemSaver with unique id added to Dialogue Manager.

Variables in the string saved in the save file have correct values. They just not being loaded. (Quest state is loaded though).
walczak
Posts: 10
Joined: Tue Oct 11, 2022 9:42 pm

Re: SaveSystem - Quest State loading but variables not

Post by walczak »

I am also using multiple databases, if that makes any difference.
User avatar
Tony Li
Posts: 22200
Joined: Thu Jul 18, 2013 1:27 pm

Re: SaveSystem - Quest State loading but variables not

Post by Tony Li »

Is it possible that something else is resetting the variable values after you load a saved game?
walczak
Posts: 10
Joined: Tue Oct 11, 2022 9:42 pm

Re: SaveSystem - Quest State loading but variables not

Post by walczak »

Is it possible to make database reset with some Component? Maybe there is something attached to Dialogue Manager?

I was indeed using:

Code: Select all

DialogueManager.ResetDatabase(DatabaseResetOptions.RevertToDefault);
on my start screen scene. However removing it did not help.
walczak
Posts: 10
Joined: Tue Oct 11, 2022 9:42 pm

Re: SaveSystem - Quest State loading but variables not

Post by walczak »

is it possible that DialogueSystemSaver Component does reset the Database?
What options have to be checked for "Alternate Setup" to work?
User avatar
Tony Li
Posts: 22200
Joined: Thu Jul 18, 2013 1:27 pm

Re: SaveSystem - Quest State loading but variables not

Post by Tony Li »

DialogueSystemSaver does reset the database and then uses the values in the save string. If the Dialogue Manager's Persistent Data Settings > Initialize New Variables checkbox is ticked, it then creates new variables (using their Initial Values) for any variables that were added since the game was saved.

Would it be possible for you to send a reproduction project to tony (at) pixelcrushers.com?
Post Reply