Save everything but Conversation state and convo variables?

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
EpicMcDude
Posts: 24
Joined: Fri Sep 22, 2023 5:05 pm

Save everything but Conversation state and convo variables?

Post by EpicMcDude »

Hello!

Is there a way to save every saver component (position, active, destructible etc) except for the Dialogue state itself - conversation state, quests state and variables?

I want to save and load these ones separately, I've tried Record/Apply persistent data but they still apply the Saver component data to objects.
Just want to maintain object persistence between scenes but not the quests and conversation variables so that the player doesn't revert progress when completing a quest in a new scene and then loading back to the first scene when the quest was saved as not completed so it would load as not completed.

Thank you
User avatar
Tony Li
Posts: 22107
Joined: Thu Jul 18, 2013 1:27 pm

Re: Save everything but Conversation state and convo variables?

Post by Tony Li »

Hi,

You can remove the Dialogue System Saver component. This is the component that's responsible for saving Dialogue System data (quests, variables, etc.).
EpicMcDude
Posts: 24
Joined: Fri Sep 22, 2023 5:05 pm

Re: Save everything but Conversation state and convo variables?

Post by EpicMcDude »

Tony Li wrote: Tue Aug 13, 2024 12:12 pm Hi,

You can remove the Dialogue System Saver component. This is the component that's responsible for saving Dialogue System data (quests, variables, etc.).
Oh I don't want to remove the Saver component from the Dialogue system itself, I just want to be able to choose to save these ones separately, so only save the rest of the Saver components but not the Dialogue System saver and vice versa.

Or to rephrase it, a way to save and apply the Dialogue System's conversation, variables and quest status without saving or applying data to other component savers on game objects, and then save and apply data from these other Saver components separately
User avatar
Tony Li
Posts: 22107
Joined: Thu Jul 18, 2013 1:27 pm

Re: Save everything but Conversation state and convo variables?

Post by Tony Li »

Hi,

In that case, you could still remove the Dialogue System Saver, and manually call PersistentDataManager.GetSaveData() to get only the DS data:

Code: Select all

string s = PersistentDataManager.GetSaveData();
To restore that data, use PersistentDataManager.ApplySaveData():

Code: Select all

PersistentDataManager.ApplySaveData(s);
The Dialogue System Saver component is really just a Saver script wrapper around these two methods.
EpicMcDude
Posts: 24
Joined: Fri Sep 22, 2023 5:05 pm

Re: Save everything but Conversation state and convo variables?

Post by EpicMcDude »

Tony Li wrote: Tue Aug 13, 2024 2:32 pm Hi,

In that case, you could still remove the Dialogue System Saver, and manually call PersistentDataManager.GetSaveData() to get only the DS data:

Code: Select all

string s = PersistentDataManager.GetSaveData();
To restore that data, use PersistentDataManager.ApplySaveData():

Code: Select all

PersistentDataManager.ApplySaveData(s);
The Dialogue System Saver component is really just a Saver script wrapper around these two methods.
That's exactly it!I just had to make sure the Playmaker action was doing that function since it has an If/else statement where it can save all the components instead of just the dialogue status. thank you Tony!

I just have another question since I can't seem to find this on the documentation - what is the "Conversation State Saver" and how does it differ from Dialogue System Saver? I used to have it in my Dialogue Manager game object but I it's safe to delete it as well then?

EDIT: oops you've already asnwered this exact question here in the forums!
User avatar
Tony Li
Posts: 22107
Joined: Thu Jul 18, 2013 1:27 pm

Re: Save everything but Conversation state and convo variables?

Post by Tony Li »

To save future readers the trouble of looking it up: ConversationStateSaver saves the state of the active conversation (if any). So when you load the saved game it will resume the conversation in the saved state.
Post Reply