[HOWTO] How To: Use Save System with other save system assets
Posted: Fri Jul 17, 2020 7:50 am
The Dialogue System, Quest Machine, and Love/Hate share the same save system. So if you set it up for DS, then you won't have to do anything extra for QM or LH. The save system plays nicely with other save systems, such as Bayat's or Easy Save. (DS includes an integration for Easy Save.)
It also saves only specified pieces. It doesn't save whole components or whole scenes. You get to specify exactly what gets saved by adding and configuring Saver components.
(See: Pixel Crushers Save System. There's also a dedicated Save_System_Manual.pdf file in the Dialogue System's Common/Documentation folder.)
Briefly, to set it up to work with another save system:
1. Set up the save system using the link above or by following the video tutorial shown in the link.
2. Assuming you're using the other system to keep track of which scene you saved in and go to that scene when loading a save, untick the Save System component's Save Current Scene checkbox. Also set Apply Save Data After Frames to zero.
3. To save a game, call:
4. To load a game:
At runtime, the Dialogue System's dialogue database(s) are read-only. Changes such as:
go into the Dialogue System's Lua environment.
When you set up the save system with a Dialogue System Saver component, it will save specified parts of the Lua environment -- by default, the Actor[] table, Variable[] table, quest states, and a few other things. You can customize this in the Dialogue Manager's Persistent Data Settings section.
It also saves only specified pieces. It doesn't save whole components or whole scenes. You get to specify exactly what gets saved by adding and configuring Saver components.
(See: Pixel Crushers Save System. There's also a dedicated Save_System_Manual.pdf file in the Dialogue System's Common/Documentation folder.)
Briefly, to set it up to work with another save system:
1. Set up the save system using the link above or by following the video tutorial shown in the link.
2. Assuming you're using the other system to keep track of which scene you saved in and go to that scene when loading a save, untick the Save System component's Save Current Scene checkbox. Also set Apply Save Data After Frames to zero.
3. To save a game, call:
Code: Select all
using PixelCrushers;
string data = SaveSystem.Serialize(SaveSystem.RecordSavedGameData());
// Save 'data' using other system.
Code: Select all
string data = // Get from other save system.
SaveSystem.ApplySavedGameData(SaveSystem.Deserialize<SavedGameData>(data));
Code: Select all
Variable["Did_Something"] = true;
When you set up the save system with a Dialogue System Saver component, it will save specified parts of the Lua environment -- by default, the Actor[] table, Variable[] table, quest states, and a few other things. You can customize this in the Dialogue Manager's Persistent Data Settings section.