[HOWTO] How To: Get content of state quest isn't in

Announcements, support questions, and discussion for Quest Machine.
Post Reply
User avatar
Tony Li
Posts: 22849
Joined: Thu Jul 18, 2013 1:27 pm

[HOWTO] How To: Get content of state quest isn't in

Post by Tony Li »

Under normal uses, you'll call Quest.GetContentList() to get the quest content (dialogue , journal, or HUD) for the quest's current state.

If you need to get the quest content for a state that the quest isn't currently in, you can get it manually:

Code: Select all

// We'll accumulate the content in this list:
var contentList = new List<QuestContent>();

// Get the main quest info for the Active quest state:
var mainStateInfo = quest.GetStateInfo(QuestState.Active);
AddToContentList(contentList, mainStateInfo.GetContentList(QuestContentCategory.Journal));

// Get each node's Active quest state content:
for (int i = 0; i < quest.nodeList.Count; i++)
{
    var node = nodeList[i];
    var nodeStateInfo = QuestStateInfo.GetStateInfo(node.stateInfoList, QuestNodeState.Active);
    var nodeContentList = nodeStateInfo.GetContentList(category);
    AddToContentList(contentList, nodeContentList);
}
Post Reply