[HOWTO] How To: Check If Quest Giver Has Any Quests
Posted: Wed Jan 20, 2021 10:02 pm
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;
}