Page 1 of 1
Show one quest at a time
Posted: Wed Jul 24, 2024 1:11 am
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.
Re: Show one quest at a time
Posted: Wed Jul 24, 2024 8:14 am
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();
}
}
}