Page 1 of 1

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

Posted: Sat Sep 12, 2020 3:37 pm
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.

Re: Loading a Game at the last Dialogue Entry Read

Posted: Sat Sep 12, 2020 7:09 pm
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.

Re: Loading a Game at the last Dialogue Entry Read

Posted: Mon Sep 14, 2020 3:41 pm
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?!

Re: Loading a Game at the last Dialogue Entry Read

Posted: Mon Sep 14, 2020 4:18 pm
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.

Re: Loading a Game at the last Dialogue Entry Read

Posted: Wed Sep 16, 2020 8:26 pm
by CodePrincess
... Okay, and check Remember Dialogue System's "Retain in prefab?" check box and ...it works!

Whoo! Thanks again, Mr. Li! :mrgreen:

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

Posted: Wed Sep 16, 2020 8:48 pm
by Tony Li
Happy to help! :-)