[Solved!] Loading a Game at the last Dialogue Entry Read

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
CodePrincess
Posts: 111
Joined: Thu Sep 27, 2018 11:06 pm

[Solved!] Loading a Game at the last Dialogue Entry Read

Post by CodePrincess »

Good afternoon, everybody!

So, I made my menus able to save-mid conversation, but it doesn't automatically start the loaded game with the conversation running at the last entry read. Should I ask how to find out which conversation is active, and the ID of the currently running entry via script, or is there a more direct way to achieve the same results?

Besides Dialogue System for Unity v 2.2.7, I'm also using Adventure Creator v. 1.71.7, if that's important.
Last edited by CodePrincess on Wed Sep 16, 2020 8:36 pm, edited 2 times in total.
Thank you so much for your help.

Oh! My stats!
Unity 2020.1.10f1
Adventure Creator 1.72.2
Dialogue System for Unity 2.2.12
User avatar
Tony Li
Posts: 21721
Joined: Thu Jul 18, 2013 1:27 pm

Re: Loading a Game at the last Dialogue Entry Read

Post by Tony Li »

Hi,

What if you add a ConversationStateSaver component to the Dialogue Manager? I haven't actually tested this with AC, but I think it should work depending on how you're setting up saved games.
CodePrincess
Posts: 111
Joined: Thu Sep 27, 2018 11:06 pm

Re: Loading a Game at the last Dialogue Entry Read

Post by CodePrincess »

What if you add a ConversationStateSaver component to the Dialogue Manager?
It... looks like I have added one already. Why Didn't it...
Oh! Okay, I just needed to run the load action list through a script with one of those OnFinishLoading() methods.

Oh. Oh, no. Big stack overflow. Wait, why would my load script-

Code: Select all

public void LoadTheGame()
    {
        Debug.Log("DialogueProgressManager.LoadTheGame(): Attempting game load.");
        int slot = AC.GlobalVariables.GetIntegerValue(slotindex); // 8 = AC var "save Slot Index"
        PersistentDataManager.LevelWillBeUnloaded();
        var saveSystem = FindObjectOfType<SaveSystem>();

        if (saveSystem != )
        {
            if(SaveSystem.DoesSaveExist(slot) == true)
            {
                SaveSystem.LoadGame(slot);
                Debug.Log("DialogueProgressManager.LoadTheGame(): Game loaded.");
            }
            else { DialogueManager.ShowAlert("Save a game first."); }
        }
    }
- cause a stack overflow?!
Thank you so much for your help.

Oh! My stats!
Unity 2020.1.10f1
Adventure Creator 1.72.2
Dialogue System for Unity 2.2.12
User avatar
Tony Li
Posts: 21721
Joined: Thu Jul 18, 2013 1:27 pm

Re: Loading a Game at the last Dialogue Entry Read

Post by Tony Li »

If I understand you correctly, when it finishes loading it calls LoadTheGame(). But LoadTheGame() calls SaveSystem.LoadGame(), which starts the load process again, creating an infinite loop.

Have you added a Remember Dialogue System component to your Dialogue Manager?

Try these components on the Dialogue Manager:
  • Dialogue System Controller, Input Device Manager (the usual)
  • Save System, Json Data Serializer, PlayerPrefs Saved Game Data Storer, Dialogue System Saver, Conversation State Saver
  • Adventure Creator Bridge, Remember Dialogue System
I don't think you'll need your load script if you have those components.
CodePrincess
Posts: 111
Joined: Thu Sep 27, 2018 11:06 pm

Re: Loading a Game at the last Dialogue Entry Read

Post by CodePrincess »

... Okay, and check Remember Dialogue System's "Retain in prefab?" check box and ...it works!

Whoo! Thanks again, Mr. Li! :mrgreen:
Thank you so much for your help.

Oh! My stats!
Unity 2020.1.10f1
Adventure Creator 1.72.2
Dialogue System for Unity 2.2.12
User avatar
Tony Li
Posts: 21721
Joined: Thu Jul 18, 2013 1:27 pm

Re: [Solved!] Loading a Game at the last Dialogue Entry Read

Post by Tony Li »

Happy to help! :-)
Post Reply