OH YES!!!! That's exactly what I want! This is actually like a simulation game for education where the player needs to collect the requirements from the NPCs. And what I want to save into txt file is the requirements collected by the player.
Anyways, thanks a lot Tony!!
Save in TXT file
Re: Save in TXT file
Hey Tony! Sorry for asking too many questions regarding this.
I just found out that this function is actually the same as Quest Journal, where it will replace the string when the quest state has changed.
Can I save the string value when the quest state is Active only? How should I fix it?
I just found out that this function is actually the same as Quest Journal, where it will replace the string when the quest state has changed.
Can I save the string value when the quest state is Active only? How should I fix it?
Re: Save in TXT file
I still don't understand. Can you provide some mock-up screenshots to illustrate what you want to do?
Re: Save in TXT file
I'm using the same code you gave and apply it on 3 levels, but it can only save the latest level that has played.
Each level has 1 quest giver (Total 3 of them). I wanna save every quest giver's last conversation in all levels. How can I do it?
Each level has 1 quest giver (Total 3 of them). I wanna save every quest giver's last conversation in all levels. How can I do it?
Re: Save in TXT file
You could try this to save each conversation in a separate file:
Or this to save each conversation according to its scene name:
Code: Select all
void OnConversationEnd(Transform actor)
{
var filename = Application.persistentDataPath + "/" + DialogueManager.lastConversationStarted + ".txt");
#if UNITY_STANDALONE_WIN || UNITY_EDITOR_WIN
filename = filename.Replace("/", "\\"); // Windows uses backslash.
#endif
Debug.Log("Saving: " + filename); //<-- ADD THIS LINE.
System.IO.File.WriteAllText(filename, transcript);
}
Code: Select all
using UnityEngine.SceneManagement;
...
void OnConversationEnd(Transform actor)
{
var filename = Application.persistentDataPath + "/" + SceneManager.GetActiveScene().name + ".txt");
#if UNITY_STANDALONE_WIN || UNITY_EDITOR_WIN
filename = filename.Replace("/", "\\"); // Windows uses backslash.
#endif
Debug.Log("Saving: " + filename); //<-- ADD THIS LINE.
System.IO.File.WriteAllText(filename, transcript);
}