Save System (variables + conversation states)

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
GreenConure
Posts: 26
Joined: Sun Oct 24, 2021 10:32 am

Save System (variables + conversation states)

Post by GreenConure »

Hello Tony!

Thank you so much again for your help last time!

I just have a question regarding the save system. I'm currently in the stage of testing out a demo builds to see if the dialogues are working. I've run the demo in Unity and I see that the variables/quest states are working well via the watcher tab for DS. I've given the build to testers and while it works most of the time; there are chances where variables/quest states are not saved which prevent them from accessing other dialogue system triggers with conditions or having dialogue retriggered whenever they load a game.

I'm currently using the Save System prefab that's available for download (placed in the first scene) + Menu framework and having conversation state/position/active savers (they're all set to unique keys) and a Dialogue System saver on my DS manager (which is set to keep only one instance.)I'm also using the LoadLevel() sequencer command for changing scenes.

My dialogue game objects have 2d box colliders + conversation zones from Corgi Engine + Dialogue triggers for start conversation + "set game object inactive" once the conversation is finished + active + conversation state savers.

I've been able to make huge progress thanks to Dialogue System so thank you so much for having such wonderful support!

Let me know what you think.
Last edited by GreenConure on Tue Dec 07, 2021 9:09 am, edited 1 time in total.
User avatar
Tony Li
Posts: 22154
Joined: Thu Jul 18, 2013 1:27 pm

Re: Save System (variables + conversation states) - Build issues

Post by Tony Li »

From your description, it sounds like you've set up everything perfectly.

Is the Dialogue Manager that first appears in build settings (e.g., in the first scene) configured with the correct database(s)?
GreenConure
Posts: 26
Joined: Sun Oct 24, 2021 10:32 am

Re: Save System (variables + conversation states) - Build issues

Post by GreenConure »

Hello!

Oh gosh, I'm so sorry to disturb you so late! No rush for this ;

But yes, the dialogue manager is in the first scene along with the menu framework and has the correct database.

1. Just checked again in Unity editor. During conversations nodes that check for conditions, the variables are returning false even if they should be true as the conversation before sets that variable to true. However, there is a scene change via LoadLevel () so could that be the one resetting the variables? I attached a picture that shows the console blocking on the false link, but in the watches tab, the variable is true.

2. I was wondering too, for Corgi conversation zone / number of activations / is Disable after use something that can work with the save system? I haven't been able to make it work so I've been relying more on variables from the post on having conversations run only once. Though if that's a better way, that's totally fine!

3. Is the save system able to save cinemachine zone cameras that are active and focused on the player? Or would that need a custom saver script? There's some moments where upon loading, the camera focuses correctly, but some times as well that it activates another camera that's far from the player.

Have a good night.
Thank you!
Attachments
6.JPG
6.JPG (9.48 KiB) Viewed 728 times
5.JPG
5.JPG (13.52 KiB) Viewed 728 times
Last edited by GreenConure on Tue Dec 07, 2021 9:25 am, edited 1 time in total.
User avatar
Tony Li
Posts: 22154
Joined: Thu Jul 18, 2013 1:27 pm

Re: Save System (variables + conversation states) - Build issues

Post by Tony Li »

Hi,
GreenConure wrote: Tue Dec 07, 2021 3:39 am1. I made a development build to check. During conversations nodes that check for conditions, the variables are returning false even if they should be true as the conversation before sets that variable to true. However, there is a scene change via LoadLevel () so could that be the one resetting the variables? I also checked in unity editor, and the variables are being reset on scene change even if I have the conversation savers set to save across scene changed.
Changing scenes shouldn't reset variables.

Does your project use one dialogue database or multiple?

Does your Dialogue Manager use the default Don't Destroy On Load setting (ticked)?

Can you narrow down what scenarios cause it to not save variables? Is it possible that it's not actually saving at that point, and that the player is really loading an old save?
GreenConure wrote: Tue Dec 07, 2021 3:39 am2. I was wondering too, for Corgi conversation zone / number of activations / is Disable after use something that can work with the save system? I haven't been able to make it work so I've been relying more on variables from the post on having conversations run only once. Though if that's a better way, that's totally fine!
The ConversationZone script is a subclass of Corgi's ButtonActivated script. Number Of Activations and Disable After Use are defined in ButtonActivated. You could write a custom Saver class that saves these values on ButtonActivated components (including their subclasses, such as ConversationZone). For Disable After Use, there's no need for any scripting; you can add an EnabledSaver component and assign the ConversationZone component.
GreenConure wrote: Tue Dec 07, 2021 3:39 am3. Is the save system able to save cinemachine zone cameras that are active and focused on the player? Or would that need a custom saver script? There's some moments where upon loading, the camera focuses correctly, but some times as well that it activates another camera that's far from the player.
That'll require a custom Saver.
GreenConure
Posts: 26
Joined: Sun Oct 24, 2021 10:32 am

Re: Save System (variables + conversation states)

Post by GreenConure »

Hello!

1. I only have 1 dialogue database. The dialogue manager also has the don't destroy on load ticked.
I attached a picture that shows the console blocking on a false link but the watch tab having the variable set to true.
I apologize, I think the issue is not only limited to save/loads but even during gameplay when a scene is loaded. I didn't notice before as I was setting variables to true via the watch tab in runtime.

I have Dialogue managers on each scene so that might be causing it? I'll see if disabling/deleting them and only having a dialogue manager from the first scene will help.

2. Understood, thank you for clarifying!
3. Understood as well, I'll look into writing custom savers.

Thank you so much!
Attachments
6.JPG
6.JPG (9.48 KiB) Viewed 728 times
5.JPG
5.JPG (13.52 KiB) Viewed 728 times
User avatar
Tony Li
Posts: 22154
Joined: Thu Jul 18, 2013 1:27 pm

Re: Save System (variables + conversation states)

Post by Tony Li »

It should be fine to have Dialogue Managers in other scenes. At runtime, the first one to come into existence will survive scene changes and supplant Dialogue Managers in subsequent scenes.

You could try setting the Dialogue Manager's Other Settings > Debug Level to Info. Then reproduce the problem, and review the Console window. It might show what operation is resetting variable values.
GreenConure
Posts: 26
Joined: Sun Oct 24, 2021 10:32 am

Re: Save System (variables + conversation states)

Post by GreenConure »

Hi!

Understood. I checked the console and screenshot the related parts. I listed the events below:

1. Conversation happens. The last node loads the next level using LoadLevel()
8.JPG
8.JPG (33.14 KiB) Viewed 726 times
2. Scene loads. Another Conversation plays. In the Watch tab, the variables are reset.
9.JPG
9.JPG (35.09 KiB) Viewed 726 times
Here's what the reset log looks like.

Code: Select all

Dialogue System: Resetting Lua environment.
UnityEngine.Debug:Log (object)
PixelCrushers.DialogueSystem.PersistentDataManager:ApplySaveData (string,PixelCrushers.DialogueSystem.DatabaseResetOptions) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Save System/PersistentDataManager.cs:243)
PixelCrushers.DialogueSystem.DialogueSystemSaver:ApplyData (string) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Save System/DialogueSystemSaver.cs:87)
PixelCrushers.SaveSystem:ApplySavedGameData (PixelCrushers.SavedGameData) (at Assets/Plugins/Pixel Crushers/Common/Scripts/Save System/SaveSystem.cs:674)
PixelCrushers.SaveSystem/<LoadSceneCoroutine>d__111:MoveNext () (at Assets/Plugins/Pixel Crushers/Common/Scripts/Save System/SaveSystem.cs:785)
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)
Is the scene applying the data from the save file instead of the previous scene?

Let me know what you think.
Thank you!
User avatar
Tony Li
Posts: 22154
Joined: Thu Jul 18, 2013 1:27 pm

Re: Save System (variables + conversation states)

Post by Tony Li »

I think that looks fine. When changing scenes, the save system records data to memory, then loads the new scene, then applies the in-memory data to the newly-loaded scene.

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