[HOWTO] How To: Check If Quest Giver Has Any Quests

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

[HOWTO] How To: Check If Quest Giver Has Any Quests

Post by Tony Li »

This is a basic method to return the number of quests that a quest giver can currently offer to the player. In version 1.2.14, the QuestGiver class will have a similar method to return the number of quests offerable and number of quests active.

Code: Select all

public int GetNumOfferableQuests(QuestGiver questGiver)
{
    QuestJournal playerQuestJournal = QuestMachine.GetQuestJournal();
    int count = 0;
    foreach (Quest quest in questGiver.questList)
    {
        if ((quest.GetState() == QuestState.WaitingToStart) && 
            (playerQuestJournal.FindQuest(quest.id) == null))
        {
            count++;
        }
    }
    return count;
}
Post Reply