Save System error

Announcements, support questions, and discussion for Quest Machine.
User avatar
nathanj
Posts: 303
Joined: Sat May 28, 2016 12:30 am

Save System error

Post by nathanj »

Hi Tony,

I've started getting this error and I can't figure out where it's coming from. I do suspect that it is because of my attempt to reset the database through a button press.

My button calls this method:

Code: Select all

public void ResetDS()
    {
       DialogueManager.ResetDatabase(DatabaseResetOptions.KeepAllLoaded);
        DialogueManager.SendUpdateTracker();
	uSurvivalQuestJournal.ResetToOriginalState

        foreach (var npc in FindObjectsOfType<PixelCrushers.QuestMachine.QuestGeneratorEntity>())
        {
            npc.GenerateQuest();
        }
       
    }
It appears to work, but I can't help but feel that it is causing the following error:

Code: Select all

NullReferenceException: Object reference not set to an instance of an object
PixelCrushers.SaveSystem.ApplySavedGameData (PixelCrushers.SavedGameData savedGameData) (at Assets/Plugins/Pixel Crushers/Common/Scripts/Save System/SaveSystem.cs:497)
UnityEngine.Debug:LogException(Exception)
PixelCrushers.SaveSystem:ApplySavedGameData(SavedGameData) (at Assets/Plugins/Pixel Crushers/Common/Scripts/Save System/SaveSystem.cs:502)
PixelCrushers.uSurvivalSupport.uSurvivalSaveLoadPixelCrushers:OnLoadingCharacter(GameObject) (at Assets/VSSurvival/Addons/Quest Machine Addon/Scripts/Save and Load/uSurvivalSaveLoadPixelCrushers.cs:44)
Database:CharacterLoad(String, List`1) (at Assets/VSSurvival/Scripts/Database.cs:461)
NetworkManagerSurvival:<MakeCharactersAvailableMessage>m__0(String) (at Assets/VSSurvival/Scripts/NetworkManagerSurvival.cs:245)
System.Linq.Enumerable:ToList(IEnumerable`1)
NetworkManagerSurvival:MakeCharactersAvailableMessage(String) (at Assets/VSSurvival/Scripts/NetworkManagerSurvival.cs:246)
NetworkManagerSurvival:OnServerCharacterCreate(NetworkMessage) (at Assets/VSSurvival/Scripts/NetworkManagerSurvival.cs:440)
Mirror.NetworkConnection:InvokeHandler(Int16, NetworkReader) (at C:/projects/hlapi-community-edition/Mirror/Runtime/NetworkConnection.cs:295)
Mirror.NetworkServer:InvokeBytes(ULocalConnectionToServer, Byte[]) (at C:/projects/hlapi-community-edition/Mirror/Runtime/SyncList.cs:243)
Mirror.ULocalConnectionToServer:SendBytes(Byte[], Int32)
Mirror.NetworkConnection:Send(Int16, MessageBase, Int32) (at C:/projects/hlapi-community-edition/Mirror/Runtime/LocalClient.cs:56)
Mirror.NetworkClient:Send(Int16, MessageBase) (at C:/projects/hlapi-community-edition/Mirror/Runtime/NetworkClient.cs:329)
UICharacterCreation:<Update>m__1() (at Assets/VSSurvival/Scripts/_UI/UICharacterCreation.cs:43)
UnityEngine.EventSystems.EventSystem:Update()
Is it possible that settings are being reset and some are not,, thus causing this error?

Thanks in advance,
Nathan
User avatar
Tony Li
Posts: 22104
Joined: Thu Jul 18, 2013 1:27 pm

Re: Save System error

Post by Tony Li »

Hi Nathan,

I'm going to be out of the office for several hours today. As soon as I get back, I'll look into this.

What''s the sequence of events? When does the error occur in relation to when you press the reset button?
User avatar
nathanj
Posts: 303
Joined: Sat May 28, 2016 12:30 am

Re: Save System error

Post by nathanj »

Hi Tony

So I made a new scene with DS, QM and USurvival and tried my reset script in it and everything is fine. No errors.
So it means it's something in the main build.

I'll try working through this but is there anything in the error message that suggests where I might look?

Thank you,
Nathan
User avatar
nathanj
Posts: 303
Joined: Sat May 28, 2016 12:30 am

Re: Save System error

Post by nathanj »

Hi Tony,

Dialogue System's USurvival integration has the USurvivalLua script that runs an update method at the end of every conversation and quest state change. This is what saves the DS data to the save system.

I can't find the equivalent update method run from the Quest Machine.

I just noticed that in the scene with the fresh installs of QM, DS and USurvival that while I'm not getting an errors the Quest Machine's Quests are not being saved an loaded. Is it possible that something in the files has changed recently?

Thanks in advance,
Nathan
User avatar
Tony Li
Posts: 22104
Joined: Thu Jul 18, 2013 1:27 pm

Re: Save System error

Post by Tony Li »

Hi Nathan,
nathanj wrote: Tue Dec 18, 2018 6:50 pmI'll try working through this but is there anything in the error message that suggests where I might look?
It means the saved game data is null. This could happen if Quest Machine receives bad saved game data. (See below for info about how it gets saved game data.)
nathanj wrote: Tue Dec 18, 2018 9:13 pmDialogue System's USurvival integration has the USurvivalLua script that runs an update method at the end of every conversation and quest state change. This is what saves the DS data to the save system.

I can't find the equivalent update method run from the Quest Machine.
The Dialogue System is more contained in what it does, so it can raise events whenever something relevant happens (e.g., conversation ends or quest state changes). The Dialogue System's uSurvival integration can just hook into these events.

Quest Machine tracks a broader list of things that can happen in scenes, and not everything can raise an event. Instead, modifications to uSurvival's Database.cs script tell Quest Machine when to save and load. When uSurvival loads a character, the modification will tell Quest Machine to retrieve its saved game data from uSurvival's database.
nathanj wrote: Tue Dec 18, 2018 9:13 pmI just noticed that in the scene with the fresh installs of QM, DS and USurvival that while I'm not getting an errors the Quest Machine's Quests are not being saved an loaded. Is it possible that something in the files has changed recently?
Double-check that you've made all of the uSurvival script modifications on page 4 of the Quest Machine uSurvival Addon manual. If you've double-checked the modifications and everything looks correct, please let me know. I'm scheduled to test the uSurvival Addon with the very latest version of uSurvival tomorrow. It's possible that something changed that will require an update to those script modifications.
User avatar
nathanj
Posts: 303
Joined: Sat May 28, 2016 12:30 am

Re: Save System error

Post by nathanj »

Thanks for the response, Tony

So I doubled checked my test scene and I had originally forgot to add one line to the Database.cs script. Once I had correctly edited it I got the error in the new scene as well.

I'll send you an email with a more detailed response.

Nathan
User avatar
Tony Li
Posts: 22104
Joined: Thu Jul 18, 2013 1:27 pm

Re: Save System error

Post by Tony Li »

What versions of the Dialogue System, Quest Machine, and uSurvival are you using?

Did you set the scripting define symbol?
User avatar
nathanj
Posts: 303
Joined: Sat May 28, 2016 12:30 am

Re: Save System error

Post by nathanj »

Hi Tony

I’ll have to check the test build when I get into the office but I’m prett sure I have the right symbols defined. I do in the main build for sure and the error occurs in both builds.

I have versions:
QM 1.12
DS 2.1
USurvival I’m not sure but it’ll be one of the recent ones for sure. I’ll check when I get into the office in the morning.

Nathan
User avatar
Tony Li
Posts: 22104
Joined: Thu Jul 18, 2013 1:27 pm

Re: Save System error

Post by Tony Li »

Hi Nathan,

uSurvival tends to have breaking changes with each update. I just sent you links to updated uSurvival integration packages. They're also on the Extras pages.
User avatar
nathanj
Posts: 303
Joined: Sat May 28, 2016 12:30 am

Re: Save System error

Post by nathanj »

Happy to report that the latest package resolves the issues.

Thanks Tony!
Post Reply