Saving Items

Announcements, support questions, and discussion for the Dialogue System.
Muff
Posts: 20
Joined: Sat Mar 04, 2023 11:49 am

Re: Saving Items

Post by Muff »

Seems Like SaveGamePanel.cs can save an item and the item still on inventory when you continue the game but SaveHelper.cs can't save an item. The item vanished when you continue the game

I hope that you can help me to my problem, Thankyou in advance
User avatar
Tony Li
Posts: 22131
Joined: Thu Jul 18, 2013 1:27 pm

Re: Saving Items

Post by Tony Li »

Please undo all script changes. Then, as a quick test, in SaveHelper's SaveGameNow method, change SaveSystem.SlotToSlot to SaveSystem.SaveToSlotImmediate:

Code: Select all

public virtual void SaveGameNow(int slotNum)
{
    SaveSystem.SaveToSlotImmediate(slotNum);
    PlayerPrefs.SetString(GetSlotSummaryKey(slotNum), GetCurrentSummary(slotNum));
    ...

If this works, you can make a subclass of SaveHelper, like MyCustomSaveHelper, that overrides this method. Roughly:

Code: Select all

public class MyCustomSaveHelper : SaveHelper
{
    public override void SaveGameNow(int slotNum)
    {
        SaveSystem.SaveToSlotImmediate(slotNum);
        PlayerPrefs.SetString(GetSlotSummaryKey(slotNum), GetCurrentSummary(slotNum));
        PlayerPrefs.SetString(GetSlotDetailsKey(slotNum), GetCurrentDetails(slotNum));
        PlayerPrefs.SetInt(GetLastSavedGameKey(), slotNum);
    }
}
and replace the SaveHelper script on your MenuSystem with your custom class.
Muff
Posts: 20
Joined: Sat Mar 04, 2023 11:49 am

Re: Saving Items

Post by Muff »

It Workeeedddd!!! Thankyouuuusooomuchhh Tonyy :D
User avatar
Tony Li
Posts: 22131
Joined: Thu Jul 18, 2013 1:27 pm

Re: Saving Items

Post by Tony Li »

Glad to help!
Muff
Posts: 20
Joined: Sat Mar 04, 2023 11:49 am

Re: Saving Items

Post by Muff »

Hi Tony, How do i add 2 more quest in one npc conversation using DS

Like in my first quest: Get 5 potions
2nd Quest: Collect 5 Lumber jack
3rd Quest: Collect 5 horns
User avatar
Tony Li
Posts: 22131
Joined: Thu Jul 18, 2013 1:27 pm

Re: Saving Items

Post by Tony Li »

Write a conversation with multiple branches that check those quest states.
Muff
Posts: 20
Joined: Sat Mar 04, 2023 11:49 am

Re: Saving Items

Post by Muff »

Hi Tony,  I have some issues with invector items like a sword. I placed a sword gameobject and equipped it in the gameworld, and when I continue on the main menu, the sword is still there in the gameworld where the sword is located. How can I save the item that doesn't come back once it's taken? Thankyouu!
User avatar
Tony Li
Posts: 22131
Joined: Thu Jul 18, 2013 1:27 pm

Re: Saving Items

Post by Tony Li »

Hi,

Add a DestructibleSaver component to the sword, assign a unique Key, and set its dropdown to OnDisable.
Muff
Posts: 20
Joined: Sat Mar 04, 2023 11:49 am

Re: Saving Items

Post by Muff »

Hi tony , I have some issues with the title menu panel when I stop the game and open it. The continue button and new game button appear even though I don't have any game progress.

How can I integrate a function where the continue and new game button only shows up when I have game progress on it?
User avatar
Tony Li
Posts: 22131
Joined: Thu Jul 18, 2013 1:27 pm

Re: Saving Items

Post by Tony Li »

Those buttons appear because you have a saved game. You must delete the saved game using the Load Game menu.
Post Reply