Dialogue System variable values not being saved.

Announcements, support questions, and discussion for the Dialogue System.
User avatar
bohemian pulp
Posts: 26
Joined: Wed Apr 21, 2021 7:01 am

Re: Dialogue System variable values not being saved.

Post by bohemian pulp »

Hi Tony,

Sorry if this is not the place to post this, but I have a similar issue like this, so I figured to keep it in the same space.

Basically, when I am in the play mode, saving and loading works, but when I stop the play mode and restart, it breaks.
Some variables are saved and some are not. I'm not 100% sure about it, but I'd say quests states stay, and location variables are reset.

The same thing occurs if I go to the main menu when "Reset Game On Return To Title" is checked, if I uncheck it, it works. But, again, when I restart play mode, it probably does the "in-memory" reset and it breaks again.

I was using the Visual Novel template. I see that it's set up to save the dialogue line and continue from there, but we changed the hierarchy a bit and now we are saving outside conversations. I tried to clean up all the VN template's save specifics and replace them with the Menu Framework, I set it up but still have the exact same problem. I guess the problem lies somewhere else, but I can't pinpoint it.

Another factor that can play a role is that we're importing from Articy, and I have some suspicions that some of the setters from articy lua are not persisting, but I might be wrong.

Any suggestions?
Creator of "Let Bions be bygones"
https://linktr.ee/bohemianpulp
User avatar
Tony Li
Posts: 23251
Joined: Thu Jul 18, 2013 1:27 pm

Re: Dialogue System variable values not being saved.

Post by Tony Li »

Hi,

Are you using an Auto Save Load component? The Dialogue System will only save values if you're using any of these techniques:

1. Set up the save system and use an Auto Save Load component.

2. Or set up the save system and manually call SaveSystem.SaveToSlot() (as the Menu Framework and VN starter framework do, via the SaveHelper component). Or use a SaveSystemMethods component to connect, for example, a UI Button's OnClick() to this method.

3. Or manually call PersistentDataManager.GetSaveData(), which bypasses the complete save system and only returns a string containing the dialogue database runtime values (variable values and quest states).
User avatar
bohemian pulp
Posts: 26
Joined: Wed Apr 21, 2021 7:01 am

Re: Dialogue System variable values not being saved.

Post by bohemian pulp »

I'm not using autosave, it's pretty much set up like case #2. It was VN default, and when I changed it to the Menu Framework it behaves exactly the same.



So, here are some screenshots I took during testing.
1. is the default state when the game is first started
2. and 3 (are the same) it's when the game starts, and also when we're first presented with a map and the first time when the dialogue ends (between dialogues)
4. this is after the second conversation where we get a quest, we found out about 2 locations, and did a mandatory event
5. is after I load the game after stopping play mode, or restarting the game and then loading

What I see as a player in the 5th state is as if it was in 2nd, but actually some variables are kept and not restarted.
Locations are not known - but they should be
Quest state is changed and stored - as they should be
Game started is true - as it should be
Mandatory event is restarted to Prologue - and it should be "none"

Hopefully this helps identify the problem
Creator of "Let Bions be bygones"
https://linktr.ee/bohemianpulp
User avatar
bohemian pulp
Posts: 26
Joined: Wed Apr 21, 2021 7:01 am

Re: Dialogue System variable values not being saved.

Post by bohemian pulp »

We did some QA-ing today and found out that it doesn't save location variables at all. We'll hack it for this occasion through variables as there are not many locations, but no idea what's going on. We checked save files, it has no info on location variables, they just don't exist, and it seems that it just takes the last value it has, but there are occasions when it refreshes - I have no idea when, we tried so many things today.
Creator of "Let Bions be bygones"
https://linktr.ee/bohemianpulp
User avatar
Tony Li
Posts: 23251
Joined: Thu Jul 18, 2013 1:27 pm

Re: Dialogue System variable values not being saved.

Post by Tony Li »

Hi,

Inspect the Dialogue Manager GameObject/prefab's Persistent Data Settings. Tick Include Location Data to save your dialogue database's location values.

Temporarily tick the Debug checkboxes on the Save System and PlayerPrefs Saved Game Data Storer components. Then play in the Unity editor's play mode and save the game. You should see something like this in the Console:

Save System: Storing in PlayerPrefs key Save1: {"m_version":0,"m_sceneName":"DemoScene1","m_list":[{"key":"ds","sceneIndex":-1,"data":"Variable={Alert=\"\", enemiesKilled=0, hasLaunchCodes=false, password=\"\", Actor=\"\", Conversant=\"\", ActorIndex=\"\", ConversantIndex=\"\"}; Item[\"Get_the_Launch_Codes\"].State=\"unassigned\"; Item[\"Get_the_Launch_Codes\"].Track=true; Item[\"Enemy_Attack\"].State=\"unassigned\"; Item[\"Enemy_Attack\"].Track=true; Item[\"Enemy_Attack\"].Entry_1_State=\"active\"; Actor={Player={Name=\"Player\", ...

In the example above, I set the Dialogue System Saver component's Key value to "ds", which you can see in:

{"key":"ds","sceneIndex":-1,"data":"Variable={Alert=\"\", ...

The remainder of the data in this {"key":"ds"...} text are the variable values, quest states, etc.

In your Console output, do you see something similar?
User avatar
bohemian pulp
Posts: 26
Joined: Wed Apr 21, 2021 7:01 am

Re: Dialogue System variable values not being saved.

Post by bohemian pulp »

Yeah, it does. Wow, so it was the simple checkbox all along... Why would a default not save location data? :|
Anyways, "All Items & Quest Data" is also unticked, but it saves that data for some reason.
Creator of "Let Bions be bygones"
https://linktr.ee/bohemianpulp
User avatar
Tony Li
Posts: 23251
Joined: Thu Jul 18, 2013 1:27 pm

Re: Dialogue System variable values not being saved.

Post by Tony Li »

Hi,

Most people don't care to save location data, so it's off by default to keep saved game files smaller.

Most people do want to save quest states, so when "All Items & Quest Data" is unticked it does save quest states. If the checkbox is ticked, it saves all quest data (descriptions, etc.) and other item data.
User avatar
bohemian pulp
Posts: 26
Joined: Wed Apr 21, 2021 7:01 am

Re: Dialogue System variable values not being saved.

Post by bohemian pulp »

Okay, thanks, good to know :)
Creator of "Let Bions be bygones"
https://linktr.ee/bohemianpulp
Post Reply