Page 1 of 2

Delete Save Slot?

Posted: Sun Oct 08, 2023 7:04 pm
by GG-HSI
Tony, sorry, if I am posting this in the wrong place, but didn't see discussion about the save system that appears to be a part of Dialogue Manager's "Menu System". So maybe I should be posting this in Dialogue Manager discussion?

With Menu System, looks like there were 3 built in save slots. But, instead of using these slots for different saves of the same game, I decided to use each slot for saving the games of different characters. Not sure if this system is separate or is relevant to my questions, but I also use Dialogue Lua Save System to save most character variables (PersistentDataManager). And I also use PlayerPrefs, for basic character setup, when players use the Start/Continue buttons, in your Menu System. So, 2 questions:

1. Due to game bug, one of the 3 games (saved to slot 2) got corrupted. But, as it is, the only way to reset a game to default is to use the Restart button in your Menu System. But, doing this, resets ALL of the slots. Is there a function I can call to reset a single slot to default?

On my Mac desktop, "slots" appear to be files saved to a folder on my computer called "save_0.dat", "save_1.dat" and "save_2.dat". I also see a "saveInfo.dat", which I often see in Unity console logs, when I use your system to save or restore a character's game. In my own SaveGame function, I use your SaveGameNow(int slotNum) on SaveHelper script. And hoping there is a function with slotNum parameter that I can use to "Restart" only one of the games. Many different methods for Saving/Loading on SaveHelper, but only see ONE reset (Restart) option: RestartGame, which calls a ResetDatabase function to "Remove all but the default database and reset it to its initial state". Is "database" referring to the "save.dat" files I noted above? If so, doesn't appear to be any options for specifying a particular "database". Is this correct?

Re: Delete Save Slot?

Posted: Sun Oct 08, 2023 8:28 pm
by Tony Li
Hi,

You can use the C# method PixelCrushers.SaveSystem.DeleteSavedGameInSlot(#) to delete the save data in a slot.

Note that deleting the slot will delete the save_2.dat file, but it won't reset any save data that it currently in the Save System's runtime memory. To do that, call PixelCrushers.SaveSystem.ResetGameState(). Your Dialogue Manager should have a Dialogue System Saver component, which is what saves the dialogue database/Lua variables, quest states, etc.

Re: Delete Save Slot?

Posted: Sun Oct 08, 2023 8:58 pm
by GG-HSI
Thanks for reply, Tony! But not using SaveSystem. Using SaveHelper. And, while waiting for reply, I was trying to use SaveHelper.DeleteSavedGame(int slotNum). Does this do the same as the method you referenced? Also can't find anything like ResetGameState. Is there something equivalent in system I am using? Will see if I can find anything, after I submit this reply! Thanks again! You're the best!

Re: Delete Save Slot?

Posted: Sun Oct 08, 2023 9:11 pm
by GG-HSI
Looks like I DO have SaveSystem script. But can't find method you referenced. But I did find this function on the script. Do you think this might work for me? Will this reset Lua values to default? If I am not using SaveSystem for saving, can I use SaveSystem functions at all?

/// <summary>
/// Clears the SaveSystem's internal saved game data cache.
/// </summary>
public static void ClearSavedGameData()
{
m_savedGameData = new SavedGameData();
}

Re: Delete Save Slot?

Posted: Sun Oct 08, 2023 9:31 pm
by Tony Li
Hi,

The Menu Framework (including its SaveHelper script) is built on top of the Save System. You can use the SaveSystem C# methods. If you don't have SaveSystem.ResetGameState(), please:

1. Back up your project.
2. Make sure the backup is good.
3. Update to the current version of the Dialogue System.

Re: Delete Save Slot?

Posted: Mon Oct 09, 2023 2:34 am
by GG-HSI
Thought u might say that! Thought I had updated to the latest, but might have been a while ago! Thx, Tony! Will let u know, if that works!

Re: Delete Save Slot?

Posted: Mon Oct 09, 2023 3:07 am
by GG-HSI
Ready to import, but then recalled that you no longer officially support S-Inventory. So, before I import, I need to know whether or not old S-Inventory code still exists in the latest version. I was using version from 2020. So I know that S-Inventory functions still worked, at that time. But worried, because I don't see anything about S-Inventory in the Import list. Not sure if this is going to overwrite existing Third Party Support folder or not. I don't think I need any of the third party support packages I see in the list. So will plan to uncheck anything that is checked. Assume uncheckable items will be imported. Anyway, I will move forward, if you haven't removed S-Inventory support code from latest version. Too many files to check visually, but I definitely still need SInventoryLua! Not sure what else I might need. But I will hold off, until you get a chance to reply! Thx again, Tony! You are the best!

Re: Delete Save Slot?

Posted: Mon Oct 09, 2023 8:12 am
by Tony Li
Your existing S-Inventory integration should remain and continue to work.

Re: Delete Save Slot?

Posted: Mon Oct 09, 2023 2:02 pm
by GG-HSI
Perfect! Thanks again, Tony! Will let you know, if any issues!

Re: Delete Save Slot?

Posted: Mon Oct 09, 2023 2:39 pm
by Tony Li
Glad to help!