Page 1 of 1

Dialogues save with custom save system

Posted: Mon Dec 04, 2023 6:12 am
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?

Re: Dialogues save with custom save system

Posted: Mon Dec 04, 2023 8:31 am
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));

Re: Dialogues save with custom save system

Posted: Tue Dec 05, 2023 6:46 am
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?

Re: Dialogues save with custom save system

Posted: Tue Dec 05, 2023 7:53 am
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.

Re: Dialogues save with custom save system

Posted: Tue Dec 05, 2023 8:10 am
by MadScientist11
Awesome, thanks!

Re: Dialogues save with custom save system

Posted: Tue Dec 05, 2023 9:15 am
by Tony Li
Glad to help!