Page 1 of 1

Starting at different start nodes (with multiple quest givers or a single quest giver)

Posted: Sun Jun 20, 2021 9:13 am
by maxvsthegames
Hi,

I was wondering it was possible to create a quest that has multiple start point depending on who is giving you the quest.

The example I have is a quest where the player must either capture or kill a thief.
There are two ways to start this quest:
1 - Talk to the victim who will ask you to find the thief.
2 - Find the thief by yourself (without talking to the victim first).

Image


In the first case, there's an extra condition to "Find the thief". And once you find the thief, the same two conditions (Capture or Kill) are active.

So, there are two quest givers, the victim or the thief himself, but right now, whether I write down GiveQuest("Victim","ThiefQuest") or GiveQuest("Thief","ThiefQuest"), I have no way to tell them which "Start" I want to activate and they will both activate the same one regardless.

I saw a place I could put "Quest Giver ID" in the Quest Info, but it seems to be for the whole quest and not specifically for each different Start node.

I guess I could create two different quests, or I could manually input stuff like "SetQuestNodeState("ThiefQuest","Start (Victim)","active"), to explicitly tell Quest Machine which node I want active and inactive, but I was wondering if there was already another simpler implementation for those cases.

PS: I haven't encountered that situation yet in my quests, but I could also see a situation where a single NPC could give a quest that starts at a different Start Node depending on the situation. (Ex: The sheriff normally asks you to go talk to the victim, which would start the quest at "Talk to the victim", but if you have already talked to the victim before you talked to the sheriff, he would instead start the quest at "Find the thief").

I don't know if the solution would be the same for both cases.

Thanks again!

Re: Starting at different start nodes (with multiple quest givers or a single quest giver)

Posted: Sun Jun 20, 2021 10:42 am
by Tony Li
Hi,

Quests should only have one Start node. You could set up the quest like this:

qmDifferentGivers.png
qmDifferentGivers.png (30.77 KiB) Viewed 639 times

where the "Is Victim" and "Is Thief" nodes have a custom quest condition that check the quest giver ID, something like:

Code: Select all

public class IsQuestGiverQuestCondition : QuestCondition
{
    public StringField requiredQuestGiver;

    public override void StartChecking(System.Action trueAction)
    {
        base.StartChecking(trueAction);
        if (quest.questGiverID == requiredQuestGiverID) SetTrue();
    }
}
Note that I also used a passthrough node. It doesn't do anything on its own (although it can have text content and actions). In this case, it just reduces the number of link lines.