Save System Question

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
hillka28
Posts: 4
Joined: Thu Jan 07, 2021 11:04 pm

Save System Question

Post by hillka28 »

Hi Tony,

I'm working on implementing the save system into my game, and I'm running into the following error when I try to load the data:

Code: Select all

Dialogue System: Lua code 'Variable={Alert="", activeHuntQuest="Pest Removal", Deck=2, enemiesKilled=0, enemiesToKill=5, enemyTypeToKill="goblin", ["chest.0"]=false, ["chest.1"]=false, ["chest.2"]=false, Actor="Guard", Conversant="Player", ActorIndex="Route_1_West_Guard", ConversantIndex="Player"}; Item["My_First_Deck"].State="success"; Item["Pest_Removal"].State="active"; Item["Pest_Removal"].Track=true; Item["Pest_Removal"].Entry_1_State="active"; Item["Definitely_Not_Bribery"].State="active"; Actor={Player={Name="Player", Pictures="[]", Description="You", IsPlayer=true}, Eredith={Name="Eredith", Pictures="[]", Description="Wisewoman", IsPlayer=false}, Route_1_West_Guard={Name="Route 1 West Guard", Pictures="[]", Description="Guard", IsPlayer=false, Display_Name="Guard"}, Dolores={Name="Dolores", Pictures="[]", Description="Baker", IsPlayer=false}, Sana={Name="Sana", Pictures="[]", Description="Healer", IsPlayer=false, HasMet=false}, Tabor={Name="Tabor", Pictures="[]", Description="Shopkeeper", IsPlayer=false, HasMet=false}, Blackbread={Name="Blackbread", Pictures="[]", Description="Banker", IsPlayer=false, HasMet=false}}; StatusTable = ""; RelationshipTable = ""; ' threw exception 'Cannot assign to a null value. Are you trying to assign to a nonexistent table element?.'
UnityEngine.Debug:LogError(Object)
PixelCrushers.DialogueSystem.Lua:RunRaw(String, Boolean, Boolean) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Lua/Lua Wrapper/Lua Interpreter/Lua.cs:228)
PixelCrushers.DialogueSystem.Lua:Run(String, Boolean, Boolean) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Lua/Lua Wrapper/Lua Interpreter/Lua.cs:129)
PixelCrushers.DialogueSystem.Lua:Run(String, Boolean) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Lua/Lua Wrapper/Lua Interpreter/Lua.cs:139)
PixelCrushers.DialogueSystem.PersistentDataManager:ApplyLuaInternal(String, Boolean) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Save System/PersistentDataManager.cs:260)
PixelCrushers.DialogueSystem.PersistentDataManager:ApplySaveData(String, DatabaseResetOptions) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Save System/PersistentDataManager.cs:246)
MainMenu:ContinueGame() (at Assets/Scripts/MainMenu.cs:13)
UnityEngine.EventSystems.EventSystem:Update() (at D:/Unity_Dev/2019.4.6f1/Editor/Data/Resources/PackageManager/BuiltInPackages/com.unity.ugui/Runtime/EventSystem/EventSystem.cs:377)
I am saving the data in one file via: string save =

Code: Select all

PixelCrushers.DialogueSystem.PersistentDataManager.GetSaveData();
        ES3.Save<string>("dbSave", save);
Then I am loading the data via:

Code: Select all

PixelCrushers.DialogueSystem.PersistentDataManager.ApplySaveData(ES3.Load<string>("dbSave"));
The error is promising since it appears to be holding the right data, I'm just not sure why it won't then apply that data. Any insight would be much appreciated!
User avatar
Tony Li
Posts: 22051
Joined: Thu Jul 18, 2013 1:27 pm

Re: Save System Question

Post by Tony Li »

Hi,

What versions of Unity and the Dialogue System are you using?

If you're not on DS version 2.2.14 (current version as of this reply), can you back up your project and update DS?

Does the scene with your MainMenu script also contain a Dialogue Manager GameObject?
hillka28
Posts: 4
Joined: Thu Jan 07, 2021 11:04 pm

Re: Save System Question

Post by hillka28 »

Once again, the obvious solution was right in front of me. My main menu scene did not contain a Dialogue Manager game object as you pointed out, and once I added it everything is working perfectly. Thanks for such great support!
User avatar
Tony Li
Posts: 22051
Joined: Thu Jul 18, 2013 1:27 pm

Re: Save System Question

Post by Tony Li »

Glad to help!
Post Reply