Page 1 of 1

Trigger Quest on Dialogue

Posted: Sat Feb 10, 2018 9:00 pm
by raz818
I have been playing around with the evaluation version and have a bit of an implementation question.
In the game I am currently working on I would like to have quests activated upon hearing about it through conversation.
For example, the player is talking to the local barkeep who happens to mention there is a wolf problem. After hearing that line a quest to investigate the wolf problem appears in the player's quest log.

I was playing around in the demo scene with the autostart settings and having the quest autostart when receiving the "Discussed Quest" message with the quest ID as the parameter. It worked fine if I clicked the accept quest button but if I declined it the quest status was set to active but would not appear as an active quest and disappears from the quest giver's dialogue.
Any insight would be great!

Re: Trigger Quest on Dialogue

Posted: Sun Feb 11, 2018 12:18 am
by Tony Li
Hi,

The built-in UI assumes dialogue will take the form: <quest list> --> <quest offer> --> <accept/decline>

For example, the barkeep might say, "Villagers have been complaining about a wolf. Are you interested in investigating the wolf problem?" And the player can click Accept or Decline.

To do something different, you could:
  • Make a subclass of UnityUIQuestDialogueUI that overrides some of the built-in behavior,
  • Or use the Dialogue System for Unity integration to give the quest to the player in a more freeform branching-dialogue conversation,
  • Or manually call QuestGiver.GiveQuestToQuester() in a script.
  • Or, if this is a follow-up to an earlier quest, you could add the wolf quest to the player's quest journal at design time (still set to Waiting To Start) and use the Set Quest State action in the earlier quest to activate the wolf quest.
Alternatively, you could use two quests to do this. Let's say your existing quest's ID is "Investigate Wolf Problem". Create another quest with ID "Wolf Rumors". Connect its <Start> node directly to a <Success> node. Assign this quest to the barkeep.

Assign the original "Investigate Wolf Problem" quest to the player's quest journal. Leave its state set to Waiting To Start. Set the quest's Autostart > Conditions to listen for the message "Discussed Quest" : "Wolf Rumors" (i.e., the barkeep's quest).

As soon as the player discusses the "Wolf Rumors" quest with the barkeep, the "Investigate Wolf Problem" quest will activate. If you then want to get rid of the barkeep's "Wolf Rumors" quest, you could use the Set Quest State action to set "Wolf Rumors" to successful or abandoned, whichever you prefer.

If you'd like clarification on any of this, just let me know.