Hi Tony,
I'm creating a quest debug menu, and I have a button marked "Complete current quest node", and I'm deciding on how I should implement it. The "current quest node" in this case is the selected quest in the quest journal.
My current idea is to:
1. Get a reference to the QuestJournalUI by calling QuestMachine.GetQuestJournal()
2. Getting the selectedQuest property
3. Getting the active node by iterating on the nodeList
4. Setting the state via SetState.
Would this be the most efficient way of getting the current selected node?
How to set current selected/tracked node as 'True' programmatically
Re: How to set current selected/tracked node as 'True' programmatically
Hi,
I assume you mean UnityUIQuestJournalUI.selectedQuest?
If so, you can get it like this:
In a quest, multiple nodes can be active at the same time. For example, in the demo's Coin Race quest, two nodes are active:
I assume you mean UnityUIQuestJournalUI.selectedQuest?
If so, you can get it like this:
Code: Select all
UnityUIQuestJournalUI questJournalUI = QuestMachine.GetQuestJournal().questJournalUI as UnityUIQuestJournalUI;
Quest selectedQuest = questJournalUI.selectedQuest;
- Node that counts the number of coins collected. (Leads to Success if the player collects enough coins.)
- Node that runs the countdown timer. (Leads to Failure if countdown reaches zero.)
Code: Select all
var activeNodes = selectedQuest.nodeList.FindAll(node => node.GetState() == QuestNodeState.Active);
foreach (QuestNode activeNode in activeNodes)
{
activeNode.SetState(QuestNodeState.True);
}