Page 1 of 1

Priority of generated quests

Posted: Sat Mar 28, 2020 8:26 pm
by dancinggoat23
Hi Tony (and others)

I have a question regarding procedural quests. In my game, I plan on creating hand-written quests which are offered sequentially to the player. The first such quest is automatically assigned to the player (I hope to add a preference setting for that as well as perhaps a chooser to allow the player to pick a 'training' quest from a list). Anyway, while the hand-written quests are running, I want the procedural generator to create quests which are offered to the player, and they may involve the same NPCs as are part of the hand-written quests. There are also Dialogue System conversations in this brew.

What I'd like to happen is this. If an NPC has Dialogue associated with a hand-written quest, but the generator creates or assigns additional dialogue to that NPC, I want the procedural dialogue to take precedence. What's the best (or a good) way to design this?

Additional detail: I'm using custom code to add behavior components to NPCs when a hand-written quest is activated or changes states. These components modify the NPC's AI behavior (e.g. from patrolling waypoints to seeking the PC), and they are also responsible for attaching Dialogue System trigger components that in turn activate conversations that are part of that quest. I might be going about this the wrong way...

I'm sorry if this has been asked before; I couldn't find a topic that addressed this question.

thanks!

Re: Priority of generated quests

Posted: Sat Mar 28, 2020 9:57 pm
by Tony Li
Hi,

There are a couple of ways you could approach it.

First, I recommend starting the conversation by calling the quest giver's QuestGiver.StartDialogueWithPlayer() method. This is the cleanest way to tie Quest Machine into the conversation process.

By default, if you've ticked the DialogueSystemQuestDialogueUI component's "Generate Conversation For Quest Lists" checkbox and if the quest giver can talk about more than one quest (e.g., one hand-written and one procedural), then the Dialogue System integration will generate a basic conversation. This conversation shows a single subtitle from the quest giver ("Here are the quests to talk about:") followed by a response menu with a response button for each quest.

You can change this by making a subclass of DialogueSystemQuestDialogueUI. Override the ShowQuestList() method. In your overridden method:
  • Identify which quest you want to talk about. You can check each quest's isProcedurallyGenerated property to know if it's hand-written or procedurally-generated.
  • Once you've chosen a quest, get its content by calling the quest's
    GetContentList(QuestContentCategory.Dialogue) method.
  • Then pass this content list to the ShowContents() method.

Re: Priority of generated quests

Posted: Sun Mar 29, 2020 12:07 am
by dancinggoat23
Thanks, Tony! Very useful info.

How about NPCs which did not give the quest to the player, but still have roles to play? I've got a starter quest in which the player, a Forester, has a vision (misty, gigantic stag spirit, thundering on about broken agreements and such), goes out of his house, and encounters the Gardener, who complains that the deer are rampaging in the garden. So the deer spirit doesn't actually give the quest (there's no dialog, no menu, no option to accept), but the Gardener shows up after the quest itself has already begun. I'm using QM to coordinate each of these activities in its role as a multilayered state machine (very useful). Can the Gardener, who will likely have a continuing role to play, act as a 'quest giver', or is that reserved for the NPC who first provides the quest to the player?

I appreciate the time you're taking; I know you're busy!

Re: Priority of generated quests

Posted: Sun Mar 29, 2020 9:00 am
by Tony Li
Hi,

You can do that. Add a Quest Giver component to the Gardener. As long as the Gardener is assigned as the speaker in any of the quest's nodes, the quest will be included in the list that the Gardener can talk about.

For an example in Quest Machine's Demo scene, see the Food Delivery quest. The Villager gives this quest to the player. But one of the quest nodes requires the player to talk to the Pirate.

Re: Priority of generated quests

Posted: Sun Mar 29, 2020 2:32 pm
by dancinggoat23
Wonderful! I guess I missed that in the demo. This is great news; I'm happy to see how well the QM can coordinate the heart of my gameplay. Thanks for your help!

Re: Priority of generated quests

Posted: Sun Mar 29, 2020 2:48 pm
by Tony Li
Glad to help! If you have any questions about getting it to work, just let me know.