Page 2 of 4

Re: Save in TXT file

Posted: Tue Feb 11, 2020 8:11 am
by Mchia_Soo
Hey Tony!

Have a doubt regarding the Journal text - how to display all the quest states in the Journal so that my txt file can save whatever data I have set in any quest state as well as other level?

Re: Save in TXT file

Posted: Tue Feb 11, 2020 9:52 am
by Tony Li
Quest Machine has a save system. Is that what you want to use? I'm not sure what your goal is. If you want to save the urrent states of quests when changing scenes and in saved games, use the save system. The save system is set up in the Demo scene.

Re: Save in TXT file

Posted: Tue Feb 11, 2020 10:36 pm
by Mchia_Soo
I haven't checked on the save system yet. I wanna save the data that displays in the Journal only, can the save system do that?

Re: Save in TXT file

Posted: Tue Feb 11, 2020 10:43 pm
by Tony Li
The information that displays in the journal is generated dynamically at runtime based on the quest's current states.

It's possible to get this information in your own scripts at runtime, too. For example:

Code: Select all

var quest = QuestMachine.GetQuestInstance("My Quest");
var journalContent = quest.GetContentList(QuestContentCategory.Journal);
foreach (var content in journalContent)
{
    Debug.Log(content.runtimeText);
}
However, you can configure the save system to only save the player's Quest Journal -- that is, the states of the player's quests.

Re: Save in TXT file

Posted: Thu Feb 13, 2020 10:23 pm
by Mchia_Soo
Yes, but is there any way to stop the Journal information from being generated at runtime as I prefer the information will be generated continuously instead of replacing it?

For the save system, where can I change to save the Quest Journal only?

Re: Save in TXT file

Posted: Fri Feb 14, 2020 8:27 am
by Tony Li
Mchia_Soo wrote: Thu Feb 13, 2020 10:23 pmYes, but is there any way to stop the Journal information from being generated at runtime as I prefer the information will be generated continuously instead of replacing it?
That's the way Quest Machine is designed. If you want to keep the same text when a node changes from Active to True, currently you can put the same text in the Active and True states' Dialogue Text. In the next update, there will be a new content type that points to another content. This way you can have the text in two places while only having one content of it.
Mchia_Soo wrote: Thu Feb 13, 2020 10:23 pmFor the save system, where can I change to save the Quest Journal only?
Tick the Quest Journal's Save Settings, and untick the others (such as Quest Givers, etc.). The save system will only save what you have specified to save.

Re: Save in TXT file

Posted: Sat Feb 15, 2020 1:10 am
by Mchia_Soo
Tony Li wrote: Fri Feb 14, 2020 8:27 am Tick the Quest Journal's Save Settings, and untick the others (such as Quest Givers, etc.). The save system will only save what you have specified to save
The Quest Journal in Player?

I have tried that and have set my save key is PlayerJournal. But I couldn't find any file related. Where am I supposed to get the Journal data?

Re: Save in TXT file

Posted: Sat Feb 15, 2020 2:39 am
by Mchia_Soo
Oh wait, do you mean this?
QuestJournal.PNG
QuestJournal.PNG (30.6 KiB) Viewed 1202 times
Or the save system script?

Re: Save in TXT file

Posted: Sat Feb 15, 2020 8:26 am
by Tony Li
We may be talking about different things.

Quest Machine has a save system.

The save system can save and restore the current state of the game. To do this, it relies in "saver" components. These are components that have 2 functions:

1. RecordData: Records some information about the game. The QuestJournal script is a saver. It records the states of the quests in its Quests list.

2. ApplyData: Restores previously-recorded information. The QuestJournal restores the Quests list to the state that was previously recorded.


To save the current state of the game, the save system works in 2 steps:

1. RecordSavedGameData: Tells all savers to record their data into a dictionary called SavedGameData.

2. Then it saves that dictionary to permanent storage such as disk or PlayerPrefs.


The information that QuestJournal records in the dictionary is not in an easily readable format. However, you can save it to JSON text format like this:

1. Make sure your scene has a GameObject with a SaveSystem component and a JsonDataSerializer component.

2. Call the QuestJournal's RecordData() method. This will return a string that contains the recorded data in JSON format.


I hope that information helps. If not, please provide more details or some screenshots/mockups that illustrate what you want to do.

Re: Save in TXT file

Posted: Sat Feb 15, 2020 9:16 am
by Mchia_Soo
Tony Li wrote: Sat Feb 15, 2020 8:26 am Call the QuestJournal's RecordData() method. This will return a string that contains the recorded data in JSON format.
Calling this method in JsonDataSerializer script?