Easy way to reset dialogue database?

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
marafrass
Posts: 36
Joined: Thu Jan 16, 2020 1:32 pm

Easy way to reset dialogue database?

Post by marafrass »

Heya Tony,

I had a look through the forum to see if this had been solved, but I couldn't find anything definitive - is there a simple way to reset the dialogue database? The use case for this is basically that I want to reset all quests, variables, and sim statuses whenever the player goes to the main menu. Quitting the game does this fine, obviously, and loading/saving (using Adventure Creator's save system and your bridge) works without any issues - but if I were to start a new game, gain a few quests, quit out, and then start a new game, the database still retains information from the previous run; quests are still in the same state they were in the first, and dialogue options that were chosen in the last run are still marked.

Here are my settings for both the bridge and the saver components;
Image
Image

Let me know if there are any other details you'd need and as always, thanks for the help!
marafrass
Posts: 36
Joined: Thu Jan 16, 2020 1:32 pm

Re: Easy way to reset dialogue database?

Post by marafrass »

Posted too soon - I think I have a solution for this already. Leaving this up in case someone else is looking for the same thing;

I just added an empty GameObject in my "main menu" Scene with the following script;

Code: Select all

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using PixelCrushers.DialogueSystem;

public class ResetDatabaseOnStart : MonoBehaviour
{
    void Start()
    {
        DialogueManager.ResetDatabase(DatabaseResetOptions.RevertToDefault);
    }
}
Everything seems to be working just fine now, including saving and loading.

Feel free to correct me or comment, in case there's a better way doing it or anything I should be aware of!
User avatar
Tony Li
Posts: 22107
Joined: Thu Jul 18, 2013 1:27 pm

Re: Easy way to reset dialogue database?

Post by Tony Li »

Hi,

Since you're using a Dialogue System Saver, I'm guessing that you're using the Dialogue System's full save system, tied into Adventure Creator through the Remember Dialogue System component.

If so, use this instead:

Code: Select all

PixelCrushers.SaveSystem.ResetGameState();
It will call the Dialogue System Saver component's ResetGameState() method, which will in turn call DialogueManager.ResetDatabase(). But it will also reset anything else that happens to be tied into the Dialogue System's save system.
marafrass
Posts: 36
Joined: Thu Jan 16, 2020 1:32 pm

Re: Easy way to reset dialogue database?

Post by marafrass »

Got it - replaced the other line of code with yours, and everything seems to work fine now as well. Huge thanks!
User avatar
Tony Li
Posts: 22107
Joined: Thu Jul 18, 2013 1:27 pm

Re: Easy way to reset dialogue database?

Post by Tony Li »

Happy to help!
Post Reply