Dialogues save with custom save system

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
MadScientist11
Posts: 3
Joined: Mon Dec 04, 2023 5:17 am

Dialogues save with custom save system

Post by MadScientist11 »

Hi!

I would like to know what would be the best way to tie dialogues save with custom save system I implemented.
The save system uses odinserializer and I have a class GameState with a bunch of subclasses saved info is going into.
I want to save dialogues in the GameState class, specifically, I want to save where in the conversation the player was, what dialogue line etc.
I'm really knew to the dialogue system and it's hard for me to grasp how everything works :(
I tried this, gameState.PlayerData.DialogueSaveData = PersistentDataManager.GetSaveData(), because in the docs it says, that I can bypass using save system this way, but I think it doesn't include conversation info. I'm just not sure how to tie everything together, I see conversation state saver, should I write my own saver for this or is there a way to not use save system?
User avatar
Tony Li
Posts: 21679
Joined: Thu Jul 18, 2013 1:27 pm

Re: Dialogues save with custom save system

Post by Tony Li »

Hi -

Set up the full save system. It's just a few components on the Dialogue Manager GameObject:
  • Save System: UNtick "Save Current Scene".
  • Json Data Serializer
  • PlayerPrefs Saved Game Data Storer: Not used, but its presence silences a warning.
  • Dialogue System Saver: Saves Dialogue System variables, quest states, etc. Assign a unique key such as "ds".
  • Conversation State Saver: Saves the position in the current conversation. Assign a unique key such as "conversationState".
Then, to get the Dialogue System's state as a string:

Code: Select all

using PixelCrushers;
...
string s = SaveSystem.Serialize(SaveSystem.RecordSavedGameData());
Store that string in your custom save system.

To restore the Dialogue System to a saved state:

Code: Select all

SaveSystem.ApplySavedGameData(SaveSystem.Deserialize<SavedGameData>(s));
MadScientist11
Posts: 3
Joined: Mon Dec 04, 2023 5:17 am

Re: Dialogues save with custom save system

Post by MadScientist11 »

Hey,

Thanks a lot, works like a charm! Just wanted to clarify is this all I have to do, to save quest progress from QuestMachine too or does it require some more setup?
User avatar
Tony Li
Posts: 21679
Joined: Thu Jul 18, 2013 1:27 pm

Re: Dialogues save with custom save system

Post by Tony Li »

To save Quest Machine, inspect the player's Quest Journal. In Save Settings, make sure Include In Saved Games is ticked and a unique key is assigned (e.g., "playerJournal"). You can also configure Quest Giver components to save their info if needed -- for example, if a Quest Giver has a quest with a cooldown before it can offer it again.
MadScientist11
Posts: 3
Joined: Mon Dec 04, 2023 5:17 am

Re: Dialogues save with custom save system

Post by MadScientist11 »

Awesome, thanks!
User avatar
Tony Li
Posts: 21679
Joined: Thu Jul 18, 2013 1:27 pm

Re: Dialogues save with custom save system

Post by Tony Li »

Glad to help!
Post Reply