Show one quest at a time

Announcements, support questions, and discussion for Quest Machine.
Post Reply
cyber
Posts: 5
Joined: Wed Jul 10, 2024 3:28 am

Show one quest at a time

Post by cyber »

Hi sir , I have one more issue that Suppose I put 10 hand written independent quest under quest giver. Now I want to show only 1 quest at a time in dialouge. currently it is showing multiple quest with "can u help me out of these" text. How can I achive that.
User avatar
Tony Li
Posts: 22085
Joined: Thu Jul 18, 2013 1:27 pm

Re: Show one quest at a time

Post by Tony Li »

Hi,

You can make a subclass of QuestGiver to use on that NPC in place of the original QuestGiver class. Override the StartMostRelevantDialogue() method. Something like:

Code: Select all

public class MyQuestGiver : QuestGiver
{
    protected override void StartMostRelevantDialogue()
    {
        bool mustShowSpecificQuest = string.IsNullOrEmpty(overrideQuestIDToShowInDialogue);
        bool onlyHasMultipleOfferableQuests = !mustShowSpecificQuest &&
            offerableQuests.Count > 1 &&  
            activeQuests.Count == 0 && 
            nonOfferableQuests == 0;
         if (onlyHasMultipleOfferableQuests)
        {
            // If NPC only has offerable quests to show, show only the first offerable quest:
            ShowOfferQuest(offerableQuests[0]);
        }
        else        
        {
            // Otherwise use the default dialogue behavior:
            base.StartMostRelevantDialogue();
        }
    }
}
Post Reply