Well, everything works fine now with all the updates on my custom action quest scrips.
They save fine and load fine the enum (actual state) ant the int (counter).
If I play a loading game WITHOUT ANY CUSTOM NODE works fine also (it loads the game ok)
BUT, if I try to load a game where in the editor I have some any custom node where I create counters in runtime, the journal doesn't load (at least is always in waiting to start). The rest of the elements load fine (all my custom savers), but not the progress on the quest.
You advise me yesterday that creating counters in real time could cause issues, but I'm not using those counters for the conditional quests, only to update the UI. The counting is on my side now. So that's the reason I decided to keep going with this (everything works fine except this) as I supposed that the issue would be that the counters would't update (And I don't care as I have mines and they work fine with the savers), but not the Journal loading.
Those are the warnings I'm getting (no errors at all)
The first one is 49 times and the second one just one:
Quest Machine: While deserializing quest tags, found a tag with a blank name in Start.
UnityEngine.Debug:LogWarning(Object)
PixelCrushers.QuestMachine.QuestStateSerializer:ReadTagDictionaryFromStream(BinaryReader, TagDictionary, String) (at Assets/Plugins/Pixel Crushers/Quest Machine/Scripts/Quest/Quest Serialization/QuestStateSerializer.cs:198)
PixelCrushers.QuestMachine.QuestStateSerializer:ReadQuestNodeDataFromStream(BinaryReader, QuestNode) (at Assets/Plugins/Pixel Crushers/Quest Machine/Scripts/Quest/Quest Serialization/QuestStateSerializer.cs:179)
PixelCrushers.QuestMachine.QuestStateSerializer:ReadQuestDataFromStream(BinaryReader, Quest) (at Assets/Plugins/Pixel Crushers/Quest Machine/Scripts/Quest/Quest Serialization/QuestStateSerializer.cs:167)
PixelCrushers.QuestMachine.QuestStateSerializer:DeserializeInto(Quest, Byte[], Boolean) (at Assets/Plugins/Pixel Crushers/Quest Machine/Scripts/Quest/Quest Serialization/QuestStateSerializer.cs:58)
PixelCrushers.QuestMachine.QuestListContainer:ApplyData(String) (at Assets/Plugins/Pixel Crushers/Quest Machine/Scripts/Quest MonoBehaviours/Quest List/QuestListContainer.cs:361)
PixelCrushers.QuestMachine.QuestJournal:ApplyData(String) (at Assets/Plugins/Pixel Crushers/Quest Machine/Scripts/Quest MonoBehaviours/Quest List/QuestJournal.cs:128)
PixelCrushers.SaveSystem:ApplySavedGameData(SavedGameData) (at Assets/Plugins/Pixel Crushers/Common/Scripts/Save System/SaveSystem.cs:516)
PixelCrushers.<LoadSceneCoroutine>d__89:MoveNext() (at Assets/Plugins/Pixel Crushers/Common/Scripts/Save System/SaveSystem.cs:622)
Quest Machine: Unable to restore quest: Main_Flooded 3(Clone). Message: Unable to read beyond the end of the stream.
UnityEngine.Debug:LogWarning(Object, Object)
PixelCrushers.QuestMachine.QuestListContainer:ApplyData(String) (at Assets/Plugins/Pixel Crushers/Quest Machine/Scripts/Quest MonoBehaviours/Quest List/QuestListContainer.cs:367)
PixelCrushers.QuestMachine.QuestJournal:ApplyData(String) (at Assets/Plugins/Pixel Crushers/Quest Machine/Scripts/Quest MonoBehaviours/Quest List/QuestJournal.cs:128)
PixelCrushers.SaveSystem:ApplySavedGameData(SavedGameData) (at Assets/Plugins/Pixel Crushers/Common/Scripts/Save System/SaveSystem.cs:516)
PixelCrushers.<LoadSceneCoroutine>d__89:MoveNext() (at Assets/Plugins/Pixel Crushers/Common/Scripts/Save System/SaveSystem.cs:622)
Error in Loading Journal
Re: Error in Loading Journal
That was the problem I had in mind. Can you change your script to an editor script that adds the counters and UI content in the editor instead of at runtime? If not, can you add the counters after loading the game? You'll need to remove them again before saving the game.
-
- Posts: 178
- Joined: Fri Sep 21, 2018 8:38 pm
Re: Error in Loading Journal
Can you change your script to an editor script that adds the counters and UI content in the editor instead of at runtime?
AHHH, that can be a good idea, but....I have no idea how to do it, can you please show me how to do it? Or some references to look for....
This is the one I use right now for your reference: I call UpdateUI()just before Execute() ends.
private void UpdateUI()
{
//Recorre todos los ChestInteractableParent hasta encontrar el que tiene la misma string ChestInteractableParent, así no tenemos que pedir algunos datos en el Action de nuevo en el editor
var foundObjects = FindObjectsOfType<ChestInteractableParent>();
if (foundObjects != null)
{
foreach (ChestInteractableParent objetInteractable in foundObjects)
{
if (objetInteractable.QuestParameterMessage == QuestParameterMessage) CounterMaxSoloParaUI = objetInteractable.CounterChestToOpenlMax;
}
}
else Debug.Log("No se ha encontrado ningun Chest Parent con el parametro: " + QuestParameterMessage);
//Obtiene la quest donde estamos
questActual = this.quest;
//Obtiene el Nodo donde estamos
questNodeActual = this.questNode;
//Obtiene el estado del Nodo donde estamos
var stateInfo = questNode.GetStateInfo(QuestNodeState.Active);
// get the content list for a specific category
var hudContentList = stateInfo.GetContentList(QuestContentCategory.HUD);
var journalContentList = stateInfo.GetContentList(QuestContentCategory.Journal);
var dialogueContentList = stateInfo.GetContentList(QuestContentCategory.Dialogue);
var alertContentList = stateInfo.GetContentList(QuestContentCategory.Alert);
var content = BodyTextQuestContent.CreateInstance<BodyTextQuestContent>();
var contentSecundario = BodyTextQuestContent.CreateInstance<BodyTextQuestContent>();
content.bodyText = new StringField("Now go find the chest");
//Add Counter--------------------------------------------------
// Permite añadir un counter ahora, cuando se ejecuta el Action, en Real Time, con lo cual no hay que crear un Counter en modo edición por cada Action nueva.
//NOTA IMPORTANTE: eL de Pixel me comenta que haciendolo asi no se va asincronizar bien los contadores en SAVE / LOAD, por lo que si lo usamos, debería ser solo para refrescar automáticamente el UI, y no para utilizarlo de verdad en la CONDITION, con lo cual deberíamos de hacer nuestro propio COUNTER en nuestro código y solo mandar un evento cuando nuestro Counter ha llegado al Máximo
// Al ser producida en tiempo real tampoco nos permite poner una condición de contador en el editor, ya que en modo edición simplemente no existe:)
// -------------------------------SOLO SIRVE PARA REFRESCAR EL UI ---------------------------------------------------------------------------------
var counter = new QuestCounter(new StringField(CounterName), 0, 0, CounterMaxSoloParaUI, QuestCounterUpdateMode.Messages);
counter.messageEventList.Add(new QuestCounterMessageEvent(new StringField(CounterName), new StringField("ChestOpened"), new StringField(CounterName), QuestCounterMessageEvent.Operation.ModifyByLiteralValue, 1));
quest.counterList.Add(counter);
counter.SetListeners(true);
//-------------------------------------------------------------
if (quest.GetCounter(CounterName) != null)
{
content.bodyText = new StringField(NombreUI + ": " + "{#"+ CounterName + "} / {>#"+ CounterName + "}");
content.SetRuntimeReferences(quest, questNodeActual);
content.AddTagsToDictionary();
}
if (hudContentList != null) hudContentList.Add(content);
//if (hudContentList != null) hudContentList.Add(content1);
if (journalContentList != null) journalContentList.Add(content);
if (dialogueContentList != null) dialogueContentList.Add(content);
if (alertContentList != null) alertContentList.Add(content);
//Refresca los UIs
QuestMachineMessages.RefreshUIs(this);
}
AHHH, that can be a good idea, but....I have no idea how to do it, can you please show me how to do it? Or some references to look for....
This is the one I use right now for your reference: I call UpdateUI()just before Execute() ends.
private void UpdateUI()
{
//Recorre todos los ChestInteractableParent hasta encontrar el que tiene la misma string ChestInteractableParent, así no tenemos que pedir algunos datos en el Action de nuevo en el editor
var foundObjects = FindObjectsOfType<ChestInteractableParent>();
if (foundObjects != null)
{
foreach (ChestInteractableParent objetInteractable in foundObjects)
{
if (objetInteractable.QuestParameterMessage == QuestParameterMessage) CounterMaxSoloParaUI = objetInteractable.CounterChestToOpenlMax;
}
}
else Debug.Log("No se ha encontrado ningun Chest Parent con el parametro: " + QuestParameterMessage);
//Obtiene la quest donde estamos
questActual = this.quest;
//Obtiene el Nodo donde estamos
questNodeActual = this.questNode;
//Obtiene el estado del Nodo donde estamos
var stateInfo = questNode.GetStateInfo(QuestNodeState.Active);
// get the content list for a specific category
var hudContentList = stateInfo.GetContentList(QuestContentCategory.HUD);
var journalContentList = stateInfo.GetContentList(QuestContentCategory.Journal);
var dialogueContentList = stateInfo.GetContentList(QuestContentCategory.Dialogue);
var alertContentList = stateInfo.GetContentList(QuestContentCategory.Alert);
var content = BodyTextQuestContent.CreateInstance<BodyTextQuestContent>();
var contentSecundario = BodyTextQuestContent.CreateInstance<BodyTextQuestContent>();
content.bodyText = new StringField("Now go find the chest");
//Add Counter--------------------------------------------------
// Permite añadir un counter ahora, cuando se ejecuta el Action, en Real Time, con lo cual no hay que crear un Counter en modo edición por cada Action nueva.
//NOTA IMPORTANTE: eL de Pixel me comenta que haciendolo asi no se va asincronizar bien los contadores en SAVE / LOAD, por lo que si lo usamos, debería ser solo para refrescar automáticamente el UI, y no para utilizarlo de verdad en la CONDITION, con lo cual deberíamos de hacer nuestro propio COUNTER en nuestro código y solo mandar un evento cuando nuestro Counter ha llegado al Máximo
// Al ser producida en tiempo real tampoco nos permite poner una condición de contador en el editor, ya que en modo edición simplemente no existe:)
// -------------------------------SOLO SIRVE PARA REFRESCAR EL UI ---------------------------------------------------------------------------------
var counter = new QuestCounter(new StringField(CounterName), 0, 0, CounterMaxSoloParaUI, QuestCounterUpdateMode.Messages);
counter.messageEventList.Add(new QuestCounterMessageEvent(new StringField(CounterName), new StringField("ChestOpened"), new StringField(CounterName), QuestCounterMessageEvent.Operation.ModifyByLiteralValue, 1));
quest.counterList.Add(counter);
counter.SetListeners(true);
//-------------------------------------------------------------
if (quest.GetCounter(CounterName) != null)
{
content.bodyText = new StringField(NombreUI + ": " + "{#"+ CounterName + "} / {>#"+ CounterName + "}");
content.SetRuntimeReferences(quest, questNodeActual);
content.AddTagsToDictionary();
}
if (hudContentList != null) hudContentList.Add(content);
//if (hudContentList != null) hudContentList.Add(content1);
if (journalContentList != null) journalContentList.Add(content);
if (dialogueContentList != null) dialogueContentList.Add(content);
if (alertContentList != null) alertContentList.Add(content);
//Refresca los UIs
QuestMachineMessages.RefreshUIs(this);
}
Re: Error in Loading Journal
Will do. I'll need a little time to put it together and test it. I'll try to post it here by the end of the day.
-
- Posts: 178
- Joined: Fri Sep 21, 2018 8:38 pm
Re: Error in Loading Journal
Thanks very much
Re: Error in Loading Journal
Hi,
Here's an editor window version: QM_ExtrasWindow_2019-02-23.unitypackage
It adds this menu item: Tools > Pixel Crushers > Quest Machine > Extra Tools. The menu item opens this window:
It has an Add Counter section. You could add more sections to add other things to the quest.
It works on the quest that is currently selected in the Quest Editor window.
I plan to build more features like this into the next major Quest Machine update. I may release a small bug fix update before then, though.
Here's an editor window version: QM_ExtrasWindow_2019-02-23.unitypackage
It adds this menu item: Tools > Pixel Crushers > Quest Machine > Extra Tools. The menu item opens this window:
It has an Add Counter section. You could add more sections to add other things to the quest.
It works on the quest that is currently selected in the Quest Editor window.
I plan to build more features like this into the next major Quest Machine update. I may release a small bug fix update before then, though.
-
- Posts: 178
- Joined: Fri Sep 21, 2018 8:38 pm
Re: Error in Loading Journal
Thanks very much! Testing now.....
-
- Posts: 178
- Joined: Fri Sep 21, 2018 8:38 pm
Re: Error in Loading Journal
Checking the code now in QuestMachineExtraToolsWindow to create my custom one.
One more thing... if I create lets say 4 or 5 new ones, how do I call them? I mean how do I do to have a reference in Tools/Opsive,.....
For easier access, would be possible to access them on the same editor, right click, and create a new section adding to the actual: (new nodes, arrange nodes, etc...) lets say external tools... that would be muck quicker
One more thing... if I create lets say 4 or 5 new ones, how do I call them? I mean how do I do to have a reference in Tools/Opsive,.....
For easier access, would be possible to access them on the same editor, right click, and create a new section adding to the actual: (new nodes, arrange nodes, etc...) lets say external tools... that would be muck quicker
Re: Error in Loading Journal
No need to create a separate window for each function, although you can if you want. I figured you'd just add more sections to the same window, like this:
I added code above for a scroll bar, too.
This would make the window look something like this:
As I mentioned before, I'm also going to build some of these into the Quest Editor window itself, hopefully in time for the next update.
Code: Select all
private Vector2 scrollPosition = Vector2.zero;
private void OnGUI()
{
scrollPosition = EditorGUILayout.BeginScrollView(scrollPosition);
DrawCounterSection();
DrawMessageNodeSection();
DrawReturnNodeSection();
EditorGUILayout.EndScrollView();
}
This would make the window look something like this:
As I mentioned before, I'm also going to build some of these into the Quest Editor window itself, hopefully in time for the next update.