Page 1 of 1

[HOWTO] How To: Save Quest Journal Without Save System

Posted: Fri Jan 07, 2022 10:14 am
by Tony Li
If your project already uses a different save system and you only want to save the current state of the player's quest journal, use QuestJournal.RecordData(). This returns a string representation of the quest journal's quests and their states. To restore the quests, use QuestJournal.ApplyData().

If you don't already have a reference to the Quest Journal component, use QuestMachine.GetQuestJournal().

Example:

Code: Select all

string s = QuestMachine.GetQuestJournal().RecordData(); // Your own save system can now save string 's'.
and

Code: Select all

QuestMachine.GetQuestJournal().ApplyData(s);
---

If you want to save all Quest Machine data, including not only the Quest Journal but also Quest Givers, Spawners, etc., you can use the full save system to record and apply the data. However, instead of calling SaveSystem.SaveToSlot(#) to save to permanent storage, use these methods to record the save data to a string and restore it from a string:

Code: Select all

string s = SaveSystem.Serialize(SaveSystem.RecordSavedGameData());
and

Code: Select all

SaveSystem.ApplySavedGameData(SaveSystem.Deserialize<SavedGameData>(s));