How can I use the APIs to set a quest to being tracked and get the same?
Also, is there a way to force run actions for a QuestNode? The reason I am asking is because I have a more complicated track objective system, so I need to know what quest node of a tracked quest is active and then run a custom function to set the objective tracking (which may be in a different scene).
Thanks
How to set and get if a Quest is being tracked or not
Re: How to set and get if a Quest is being tracked or not
Hi,
However, that may not be what you need. Here's some additional info that may be helpful:
When quest info changes, Quest Machine uses the MessageSystem to send a message QuestMachineMessages.RefreshUIs. You can add a message listener to do something when it hears that message.
It's possible for a quest to have more than one active node at a time. To get a list of all active nodes:
Use QuestMachine.GetQuestInstance() to get a reference to the player's instance of the quest. Then check/set its showInTrackHUD property:
Code: Select all
// Track the quest with ID "Get Maguffin" on the player journal with ID "Player":
var quest = QuestMachine.GetQuestInstance("Get Maguffin", "Player");
if (quest != null) quest.showInTrackHUD = true;
To answer your question first, it's not common to manually run a quest node's actions. But you can do it like:Obi wrote: ↑Fri May 13, 2022 1:38 amAlso, is there a way to force run actions for a QuestNode? The reason I am asking is because I have a more complicated track objective system, so I need to know what quest node of a tracked quest is active and then run a custom function to set the objective tracking (which may be in a different scene).
Code: Select all
var quest = QuestMachine.GetQuestInstance("Get Maguffin", "Player");
var questNode = quest.GetNode("Some Node ID");
var activeStateInfo = questNode.GetStateInfo(QuestNodeState.Active);
activeStateInfo.actionList.ForEach(action => action.Execute());
When quest info changes, Quest Machine uses the MessageSystem to send a message QuestMachineMessages.RefreshUIs. You can add a message listener to do something when it hears that message.
It's possible for a quest to have more than one active node at a time. To get a list of all active nodes:
Code: Select all
var activeNodes = quest.nodeList.FindAll(node => node.GetState() == QuestNodeState.Active);