Page 2 of 4

Re: Saving Items

Posted: Tue Mar 14, 2023 1:21 pm
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

Re: Saving Items

Posted: Tue Mar 14, 2023 2:58 pm
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.

Re: Saving Items

Posted: Tue Mar 14, 2023 10:47 pm
by Muff
It Workeeedddd!!! Thankyouuuusooomuchhh Tonyy :D

Re: Saving Items

Posted: Wed Mar 15, 2023 8:40 am
by Tony Li
Glad to help!

Re: Saving Items

Posted: Thu Mar 16, 2023 11:43 am
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

Re: Saving Items

Posted: Thu Mar 16, 2023 2:10 pm
by Tony Li
Write a conversation with multiple branches that check those quest states.

Re: Saving Items

Posted: Sat Mar 18, 2023 4:45 pm
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!

Re: Saving Items

Posted: Sat Mar 18, 2023 7:45 pm
by Tony Li
Hi,

Add a DestructibleSaver component to the sword, assign a unique Key, and set its dropdown to OnDisable.

Re: Saving Items

Posted: Mon Mar 20, 2023 4:03 pm
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?

Re: Saving Items

Posted: Mon Mar 20, 2023 4:07 pm
by Tony Li
Those buttons appear because you have a saved game. You must delete the saved game using the Load Game menu.