Page 1 of 1

Press a button to complete quest

Posted: Sat Jul 30, 2016 11:17 pm
by ricjonsu098
Hello, I'm new to Dialogue System.

So here's the scenario. On Run-time, a quest will appear which states that "Press W to walk forward"

And my problem is, how can I make it so that the quest will be finished when the W button is pressed? Thanks

Re: Press a button to complete quest

Posted: Sun Jul 31, 2016 12:49 am
by Tony Li
Hi,

Thanks for using the Dialogue System!

You could put a trigger collider in front of the player and add a Quest Trigger component. Set the Trigger property to OnTriggerEnter, and set the Quest State to success.

Another way is to write a script that listens for Input.GetKeyDown(KeyCode.W) and calls QuestLog.CompleteQuest("your quest name"). Or you can use an equivalent visual scripting action (such as in PlayMaker) if you don't want to write a script.

Re: Press a button to complete quest

Posted: Sun Jul 31, 2016 1:03 am
by ricjonsu098
thanks a lot. I have another question, what makes the game pause when the main menu is opened? Like the one's in the feature demo/quest example, whenever I open the menu (ESC button), the game stops/pauses. But when I tried to put the menu in my scene, whenever I press ESC, I can still control the camera and the player.

Re: Press a button to complete quest

Posted: Sun Jul 31, 2016 3:37 am
by ricjonsu098
and also how can I start another dialogue (actually, it's a monologue) after I finished a quest? Here's the scenario.

at runtime, a monologue runs, then after that a quest has started. I press W, then the quest finishes. After that I want another monologue to run

Here's how it's supposed to run:
Game Start > Monologue: Guide me to my house > (after monologue) Quest: Press W to start > *Presses W* > Quest finishes > Monologue: Good! Now next please.

Re: Press a button to complete quest

Posted: Sun Jul 31, 2016 10:33 am
by Tony Li
ricjonsu098 wrote:thanks a lot. I have another question, what makes the game pause when the main menu is opened? Like the one's in the feature demo/quest example, whenever I open the menu (ESC button), the game stops/pauses. But when I tried to put the menu in my scene, whenever I press ESC, I can still control the camera and the player.
The Feature Demo and Quest Example scenes use a script named "FeatureDemo". This script was originally designed just to drive the demo scenes, but some people have modified it to actually run their games' main menus. In this script, if you press ESC it sets Time.timeScale to 0 to pause the game. If your camera and control scripts respect Time.timeScale, they should also pause.

If you want a more full-featured and robust menu system, the Dialogue System Extras page has a free Dialogue System Menu Template package. This package has Unity Events where you can assign actions when pausing and unpausing the game, similar to how you can assign actions to a Unity UI Button's OnClick event.
ricjonsu098 wrote:and also how can I start another dialogue (actually, it's a monologue) after I finished a quest? Here's the scenario.

at runtime, a monologue runs, then after that a quest has started. I press W, then the quest finishes. After that I want another monologue to run

Here's how it's supposed to run:
Game Start > Monologue: Guide me to my house > (after monologue) Quest: Press W to start > *Presses W* > Quest finishes > Monologue: Good! Now next please.
The Tutorial Example scene may be a good example to follow. The entire tutorial runs in a single conversation that stays active while waiting for the player to complete tutorial objectives.

Otherwise, if you don't want to do that, you can add a Dialogue System Events component to the Dialogue Manager. In the "Quest Events" section, add an action to the OnQuestStateChange event. You could point this to a new Conversation Trigger that's set to OnUse. Add a Condition to the Conversation Trigger that the first quest is in the success state.