Page 1 of 1

Save System marking in-progress quests as deleted

Posted: Wed Sep 01, 2021 7:08 pm
by FableTech
Hi there,

We recently started setting up the Save System for use with Quest Machine, and we've hit a snag trying to save and restore quests.

When the scene starts, if we immediately save, all of the quests appear in the save data under the staticQuestIds section as expected:

"m_sceneName": "GlobalScene",
"m_list": [
{
"key": "Hephaestus_Forge_QuestGiver",
"sceneIndex": -1,
"data": "{\n \"staticQuestIds\": [\n \"Hephaestus_Forge-FindIron\"\n ],\n \"staticQuestData\": [\n {\n \"bytes\": [\n 0,\n 2,\n 0,\n 0,\n 0,\n 12,\n 123,\n 81,\n 85,\n 69,\n 83,\n 84,\n 71,\n 73,\n 86,\n 69,\n 82,\n 125,\n 31,\n 72,\n 101,\n 112,\n 104,\n 97,\n 101,\n 115,\n 116,\n 117,\n 115,\n 32,\n 116,\n 104,\n 101,\n 32,\n 71,\n 111,\n 100,\n 32,\n 111,\n 102,\n 32,\n 116,\n 104,\n 101,\n 32,\n 70,\n 111,\n 114,\n 103,\n 101,\n 14,\n 123,\n 81,\n 85,\n 69,\n 83,\n 84,\n 71,\n 73,\n 86,\n 69,\n 82,\n 73,\n 68,\n 125,\n 16,\n 72,\n 101,\n 112,\n 104,\n 97,\n 101,\n 115,\n 116,\n 117,\n 115,\n 95,\n 70,\n 111,\n 114,\n 103,\n 101,\n 16,\n 72,\n 101,\n 112,\n 104,\n 97,\n 101,\n 115,\n 116,\n 117,\n 115,\n 95,\n 70,\n 111,\n 114,\n 103,\n 101,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 1,\n 0,\n 0\n ]\n }\n ],\n \"proceduralQuests\": [],\n \"deletedStaticQuests\": []\n}"
}..."

However, as soon as this QuestGiver gives his quest, and I save again, the quest now appears in deletedStaticQuests:

"m_sceneName": "GlobalScene",
"m_list": [
{
"key": "Hephaestus_Forge_QuestGiver",
"sceneIndex": -1,
"data": "{\n \"staticQuestIds\": [],\n \"staticQuestData\": [],\n \"proceduralQuests\": [],\n \"deletedStaticQuests\": [\n \"Hephaestus_Forge-FindIron\"\n ]\n}"
},..."

I noticed that GiveQuestToQuester() actually calls DeleteQuest() internally, so maybe this is the desired behavior. If so, how do you save the progress of an in-progress quest?

As a side note, we're not using the save system's scene loading system but are instead applying the data directly like this:
var saveData = SaveSystem.storer.RetrieveSavedGameData(0);
SaveSystem.ApplySavedGameData(saveData);

For saving the data we're calling:
SaveSystem.SaveToSlot(0);

Re: Save System marking in-progress quests as deleted

Posted: Wed Sep 01, 2021 8:05 pm
by FableTech
Looks like I've answered my own question so I'll post the answer here for posterity.

In my scene I didn't give the QuestJournal a unique key which caused a conflict with the player character since it also had a PositionSaver component. After giving the QuestJournal a unique Save Key, I could see that the quest object was not actually deleted, but had been moved to the QuestJournal save data, and now everything loads as expected.

Re: Save System marking in-progress quests as deleted

Posted: Wed Sep 01, 2021 9:36 pm
by Tony Li
Thanks for posting the resolution to your issue. I've done the same thing myself. So, in Quest Machine 1.2.18+, if a GameObject has more than one Saver and the Keys aren't unique (e.g., both blank), the inspector view will now show a warning to remind you to set the Keys.