Custom Quest Actions
-
- Posts: 178
- Joined: Fri Sep 21, 2018 8:38 pm
Re: Custom Quest Actions
This is awesome, thanks very much for your support.
-
- Posts: 178
- Joined: Fri Sep 21, 2018 8:38 pm
Re: Custom Quest Actions
Well, finally I'm almost making the Automatic custom Actions and conditions and UI.
Finally I'm getting the Hud UI doing the following (instead of the counters):
On ChestQuestAction, on execute, I save the UI content <QuestContent> on my component chestInteractableParent, passing a reference to <QuestContent> hudContent that I created on my script.
if (hudContentList != null) hudContentList.Add(content);
chestInteractableParent.hudContent = hudContentList[hudContentList.Count - 1];
Finally on my script I do the following: (recover that info and show)
hudContent.originalText.value = NombreUI + ": " + counterChestOpened.ToString() + " / " + CounterChestToOpenlMax.ToString();
QuestMachineMessages.RefreshUIs(this);
So I can show on your UI panel the info.
Everything works great (no errors loading game as the real time counters) BUT, I can't load <QuestContent> when I load the game.... it comes null even when I do the following on the saver:
Saving:
m_data.hudContent = chestInteractableParent.hudContent;
return SaveSystem.Serialize(m_data);
and Loading:
chestInteractableParent.RefreshStateSaver(m_data.EstadoChestParentActual, m_data.countChestOpened, m_data.hudContent);
So basically, do you think I can show the <QuestContent> once I load the game? Any ideas? It doesn't work till I get a new node, that then executes and creates new <QuestContent>, but meanwhile I don't have any UI to show
EDIT: Ok, I start to understand better, when the game loads, it doesn't execute the Execute() on our actual node, therefore it doesn't create again the hudContentList = stateInfo.GetContentList(QuestContentCategory.HUD) so there is nothing to show, as it was created in real time.
So, is not possible that Quest Machine save also the UI created in Real Time? If not... what can be the workaround? Is there any method that execute when the node is active so I can create again the hudContentList and <QuestContent> so I can pass it again to my script?
Thanks!!
Finally I'm getting the Hud UI doing the following (instead of the counters):
On ChestQuestAction, on execute, I save the UI content <QuestContent> on my component chestInteractableParent, passing a reference to <QuestContent> hudContent that I created on my script.
if (hudContentList != null) hudContentList.Add(content);
chestInteractableParent.hudContent = hudContentList[hudContentList.Count - 1];
Finally on my script I do the following: (recover that info and show)
hudContent.originalText.value = NombreUI + ": " + counterChestOpened.ToString() + " / " + CounterChestToOpenlMax.ToString();
QuestMachineMessages.RefreshUIs(this);
So I can show on your UI panel the info.
Everything works great (no errors loading game as the real time counters) BUT, I can't load <QuestContent> when I load the game.... it comes null even when I do the following on the saver:
Saving:
m_data.hudContent = chestInteractableParent.hudContent;
return SaveSystem.Serialize(m_data);
and Loading:
chestInteractableParent.RefreshStateSaver(m_data.EstadoChestParentActual, m_data.countChestOpened, m_data.hudContent);
So basically, do you think I can show the <QuestContent> once I load the game? Any ideas? It doesn't work till I get a new node, that then executes and creates new <QuestContent>, but meanwhile I don't have any UI to show
EDIT: Ok, I start to understand better, when the game loads, it doesn't execute the Execute() on our actual node, therefore it doesn't create again the hudContentList = stateInfo.GetContentList(QuestContentCategory.HUD) so there is nothing to show, as it was created in real time.
So, is not possible that Quest Machine save also the UI created in Real Time? If not... what can be the workaround? Is there any method that execute when the node is active so I can create again the hudContentList and <QuestContent> so I can pass it again to my script?
Thanks!!
Re: Custom Quest Actions
It's possible to hook into events and add it at runtime, but I recommend adding it in an editor script. I ran out of time yesterday to edit your counter script to work as an editor script, but I'm just about to start working on it this morning.
-
- Posts: 178
- Joined: Fri Sep 21, 2018 8:38 pm
Re: Custom Quest Actions
Yes thank you, I'll wait for your editor code (I have never coded for the editor, only for gameplay) although the option I mentioned you and It's almost finished on my end its quite goo also (only if possible to accomplish)