Saving only quests and quest variables
Saving only quests and quest variables
Hi everyone!
So I've been playing around the dialogue system the whole day today and I finally decided okay, let's check out the save system. As I previously already had saving system implemented in my game I didn't really need much of it. What I do need is to save quests and it's variables. Now, I tried researching this topic and found this forum post: https://pixelcrushers.com/phpbb/viewtop ... ave#p40173
Sadly, it didn't work for me. I tried implementing the whole saving system too, and after I do it quests do kind of save, but I can't open the quest log nor interact with npcs (plus the game is like 10 times slower). I would love to save only the quests though if that is possible. So if anyone has an idea of what to do, please do leave a comment!Thank you in advance!
So I've been playing around the dialogue system the whole day today and I finally decided okay, let's check out the save system. As I previously already had saving system implemented in my game I didn't really need much of it. What I do need is to save quests and it's variables. Now, I tried researching this topic and found this forum post: https://pixelcrushers.com/phpbb/viewtop ... ave#p40173
Sadly, it didn't work for me. I tried implementing the whole saving system too, and after I do it quests do kind of save, but I can't open the quest log nor interact with npcs (plus the game is like 10 times slower). I would love to save only the quests though if that is possible. So if anyone has an idea of what to do, please do leave a comment!Thank you in advance!
Re: Saving only quests and quest variables
Hi,
What part of
and
didn't work for you? After applying save data, you may also want to call DialogueManager.SendUpdateTracker() to tell the quest tracker HUD to update its display with the restored data.
What part of
Code: Select all
string s = PixelCrushers.DialogueSystem.PersistentDataManager.GetSaveData();
Code: Select all
PixelCrushers.DialogueSystem.PersistentDataManager.ApplySaveData(s);
Re: Saving only quests and quest variables
After using those lines of code and saving it in the string variable s, after I try to retrieve the data next time I load up the game (I do it at the start method in the script, not with a public method with a button) nothing happens. I'm not sure what I'm doing wrong.
Re: Saving only quests and quest variables
Try waiting until the Dialogue System is initialized. There are a few ways to do this, such as hooking into the DialogueManager.instance.initializationComplete C# event in an Awake() method, or waiting for DialogueManager.instance.isInitialized to be true. But the easiest is to wait until the end of the start frame:
Code: Select all
IEnumerator Start()
{
yield return new WaitForEndOfFrame();
PixelCrushers.DialogueSystem.PersistentDataManager.ApplySaveData(s); // Assumes 's' contains save data
}
Re: Saving only quests and quest variables
I did that. I set the string s to public to see what is going on, it saves it but when i restart play mode it does not load it. It's values remain empty. I even tried making a public LoadQuest method to try to load it from the button, it doesn't do anything. I followed your tutorial on youtube so I know the quest is set up properly. I'm sorry for taking so much of your time, I feel like an idiot haha.
Re: Saving only quests and quest variables
Hi,
After you run this code:
Are you saving the value of s anywhere in your own saving system?
Make sure to retrieve the value of s from your own saving system before passing it to:
Otherwise you'll just be passing an empty string, which will do nothing.
After you run this code:
Code: Select all
string s = PixelCrushers.DialogueSystem.PersistentDataManager.GetSaveData();
Make sure to retrieve the value of s from your own saving system before passing it to:
Code: Select all
PixelCrushers.DialogueSystem.PersistentDataManager.ApplySaveData(s);
Re: Saving only quests and quest variables
I think I figured it out, I was at fault all along, being such an newbie I had an issue with my SaveSystem script. Thank you so much for your time!
Re: Saving only quests and quest variables
Glad you got it figured out!