Branching Logic Implementation

Announcements, support questions, and discussion for Quest Machine.
Post Reply
Obi
Posts: 3
Joined: Fri Apr 15, 2022 10:20 am

Branching Logic Implementation

Post by Obi »

Hello,

I am using your Quest Machine along with the Dialogue System. I am trying to implement a common scenario where you talk to an NPC, who gives you a sub-quest. If you accept it, say Node 2 gets activated, if you do not accept it (dialogue choice), Node 3 gets activated.

Also note that if you go to the Node 2 route, you will eventually get the option to activate Node 3. So Node 2 - Node 2.1 - Node 2.3 etc is an optional branching.

example -> Talk to Tom the Trader -> (Trader asks you to inspect tree) -> [you agree -> (examine tree) -> (go back to tom/success) -> Go talk to Mayor -> next sub quests]; ->[you disagree -> Go talk to Mayor -> next sub quests]

How can I implement this? It seems all child Nodes automatically get activated when the parent node is set to true.

Let me know if this makes sense or if you need more information on this. Note that I want this to write under a single quest using quest nodes.
User avatar
Tony Li
Posts: 22102
Joined: Thu Jul 18, 2013 1:27 pm

Re: Branching Logic Implementation

Post by Tony Li »

Hi,
Obi wrote: Fri Apr 15, 2022 10:29 amHow can I implement this? It seems all child Nodes automatically get activated when the parent node is set to true.
That's correct. That's the primary rule: when a parent becomes true, its children automatically become active.

Without the Dialogue System, you'd normally set up the quest like this:

multistageQuest.png
multistageQuest.png (32.77 KiB) Viewed 659 times

When the quest starts, two nodes will be active: Accept Task 1 and Decline Task 1.
  • Accept Task 1 has a condition that the player accepts task 1. If so, Accept Task 1 becomes true, and Complete Task 1 becomes active.
    • When the player completes task 1, Complete Task 1 becomes true, and Offer Task 2 becomes active.
  • If the player declines, Decline Task 1 becomes true, and Offer Task 2 immediately becomes active.
Since you're using the Dialogue System, you can manage the quest node states through the NPC's conversation. I still recommend setting up the nodes like above, but now you can use the Quest Machine integration's Lua functions to set Accept Task 1, etc., true.

If you haven't watched the Dialogue System + Quest Machine + Love/Hate video series, you might find it helpful. Only the last video covers Love/Hate. The others cover Quest Machine + Dialogue System. It's a good supplement to the Quest Machine + Dialogue System Integration Overview video.
Obi
Posts: 3
Joined: Fri Apr 15, 2022 10:20 am

Re: Branching Logic Implementation

Post by Obi »

Thanks that looks good!
User avatar
Tony Li
Posts: 22102
Joined: Thu Jul 18, 2013 1:27 pm

Re: Branching Logic Implementation

Post by Tony Li »

Glad to help!
Post Reply