Page 1 of 2
Quest tracking and Dialogue Trigger in VR
Posted: Mon Feb 25, 2019 12:14 pm
by celsius9
Hi Tony / All,
I'm developing a VR app and have been using Dialogue Manager very successfully in On Trigger Enter mode together with Bubble Template Menu and associated Subtitle panel. I've now set myself a new challenge and am struggling to visualise the exact set up I need.
Basically I'm wanting to track a series of processes to ensure they're done in a set sequence. A very basic one for now is simply to ensure each of a series of GameObjects are selected and 'clicked' in the correct order with the headset controller. If the sequence is correct then it's a quest success. I'm not asking for assistance with the VR aspect, it's converting the process to a Quest event that has caused me some issues. I'm pretty sure it's simply a lack of knowledge on my part as to how to achieve this...
Currently I have a couple of test objects together with the bubble dialogue set up like this. There may be a better way and I'm open to suggestions!:
- Screen Shot 2019-02-25 at 15.35.02.jpg (126 KiB) Viewed 990 times
There are 3 paths for dialogue depending on quest unassigned, active or success.
I've a variable set up for each item:
- Screen Shot 2019-02-25 at 15.41.25.jpg (34.72 KiB) Viewed 990 times
I've a quest set up as Trackable and Track on Start. And a Dialogue System Trigger configured as follows:
- Screen Shot 2019-02-25 at 15.55.08.jpg (214.68 KiB) Viewed 990 times
Is there a simple way, perhaps a script, that I can attach to each item to both update the variable and issue an OnUse trigger for the Dialogue System Trigger? Or maybe something much simpler that I'm missing?
Thanks!
Re: Quest tracking and Dialogue Trigger in VR
Posted: Mon Feb 25, 2019 1:46 pm
by Tony Li
Rather than using variables, it might be tidier to use quest entries (aka subtasks). Here's an example of how I might set up the quest:
Create an empty GameObject named something like "Check PPE Complete".
- Add a Dialogue System Trigger set to OnUse.
- Configure the Condition to require that all three quest entries are successful.
- Configure the Actions to set the main quest successful.
Like this:
To handle the gloves entry, create a usable (clickable) GameObject named "Gloves". Configure a Dialogue System Trigger like this:
For this one, you could use OnTriggerEnter instead of OnUse if you want to tick off this entry when the player enters a trigger collider.
Re: Quest tracking and Dialogue Trigger in VR
Posted: Mon Feb 25, 2019 2:59 pm
by celsius9
Thanks for coming back to me so quickly! I'll try this approach tomorrow and update with the outcome.
Re: Quest tracking and Dialogue Trigger in VR
Posted: Tue Feb 26, 2019 5:39 am
by celsius9
Hi Tony,
Thanks for the extremely detailed reply you put together - its very much appreciated, and most certainly a much more robust and tidy solution.
You'll have seen I'm using your 'custom' subtitle and menu Bubble UI's set up to create my UI in world space for VR use. Could you please advise how I'd also include an Alert UI and Quest UI as part of that same 'Dialogue Actor' GameObject?
Re: Quest tracking and Dialogue Trigger in VR
Posted: Tue Feb 26, 2019 8:37 am
by Tony Li
Hi,
The alert and quest UIs aren't typically tied to a specific NPC. You can either put them on a "Screen Space - Camera" Canvas or a "World Space" Canvas.
The quickest solution is to set the Dialogue Manager's Canvas to Screen Space - Canvas, and set the Plane Distance to, say, 3. This will make it appear 3 units away from the player's eyes. Assuming the Basic Standard Dialogue UI is still assigned to this Canvas, alerts will appear on it.
The alternative is to put it in a world space canvas. But you'd need to write code to reposition the world space canvas relative to the player whenever showing an alert or opening the quest log window.
Re: Quest tracking and Dialogue Trigger in VR
Posted: Tue Feb 26, 2019 10:22 am
by celsius9
Thanks Tony,
I'll test with your first solution and implement the second later. It's all working just fine. Another happy customer!
Re: Quest tracking and Dialogue Trigger in VR
Posted: Tue Feb 26, 2019 10:33 am
by Tony Li
Glad to help!
Re: Quest tracking and Dialogue Trigger in VR
Posted: Fri Mar 15, 2019 3:26 am
by celsius9
Hi Tony,
Hope the following doesn't duplicate an existing question elsewhere, but unable to locate it so far:
I've now implemented your recommended approach above across multiple quests and they're all working just fine.
As the Dialogue I'm developing is intended as a training aid I now also need a system to guide the user should they make an error. I'm therefore wanting to generate a series of alerts if all the relevant preconditions of a process haven't been met, but I don't want to simply disable the user from making the wrong selection in the first place (a sort of 'learning by your mistakes' scenario).
So far I've used your model to create a 'test' for each of the separate 'error' conditions. For example on the 'Got gloves' QuestEntry example above it's necessary to have washed hands and put on an apron first, so I also OnUse trigger additional GameObjects with a DialogueSystemTrigger test on each. One for example checks if QuestEntry 2 is 'success' and QuestEntry3 is 'active' and launches the alert "You haven't washed your hands yet", the next checks if neither QuestEntry 2 and 3 = success etc.
It all works fine, but this is a simple example with only 3 error triggers. It feels like there must be a much more efficient and tidy way in DSU to pick up all the varying combinations of error in one place, perhaps some sort of 'elseif' statement with an alert message for each condition?
Thanks for any guidance you can offer!
Re: Quest tracking and Dialogue Trigger in VR
Posted: Fri Mar 15, 2019 11:44 am
by Tony Li
Hi,
Since you need to specify different messages for different conditions, there's not too much you can do to shorten it.
You could take a few different approaches. Let's say your "good" Condition looks like this:
Code: Select all
CurrentQuestEntryState("PPE & Hand Hygiene", 1) == "success" and
CurrentQuestEntryState("PPE & Hand Hygiene", 2) == "success" and
CurrentQuestEntryState("PPE & Hand Hygiene", 3) == "active"
One way to phrase your "fail" Condition is to copy the good condition, wrap it in parentheses, and then check if the whole thing is false:
Code: Select all
(CurrentQuestEntryState("PPE & Hand Hygiene", 1) == "success" and
CurrentQuestEntryState("PPE & Hand Hygiene", 2) == "success" and
CurrentQuestEntryState("PPE & Hand Hygiene", 3) == "active") == false
1. Here's one way you could show different messages: Use the "fail" condition above (that is, the success condition wrapped in parentheses and then checked against false). For the Actions, only add a Run Lua Code action. Specify your individual failure messages in "if statement"
Lua code, like this:
Code: Select all
washedHands = CurrentQuestEntryState("PPE & Hand Hygiene", 1)
gotApron = CurrentQuestEntryState("PPE & Hand Hygiene", 2)
if (not washedHands and not gotApron) then
ShowAlert("Wash your hands and put on an apron first.")
elseif (washedHands and not gotApron) then
ShowAlert("Put on an apron first.")
elseif (not washedHands and gotApron) then
ShowAlert("Wash your hands first.")
end
(To shorten the code, I saved the values of quest entries 1 and 2 to temporary variables.)
2. Another way is to create a separate set of empty GameObjects, each with a Dialogue System Trigger set to OnUse. Specify the minimum Condition necessary to uniquely identify when it should show a specific message. For example:
Code: Select all
CurrentQuestEntryState("PPE & Hand Hygiene", 1) == "success" and
CurrentQuestEntryState("PPE & Hand Hygiene", 2) ~= "success"
Then add a Show Alert action such as:
Code: Select all
"You already washed your hands, but you need to put on an apron first."
Then add a "fail" Dialogue System Trigger to Gloves. Add an OnExecute() event, and configure it to call each of the alert message Dialogue System Triggers' OnUse method.
3. A third way, similar to #1, is to do this in C# code. Write a C# script with a method that mimics the Lua code in #1. Configure the OnExecute() event to call this method.
Re: Quest tracking and Dialogue Trigger in VR
Posted: Wed Mar 27, 2019 8:08 am
by celsius9
Thanks Tony. Much appreciated. Yet again you've not only provided great support, but educated me further at the same time! Apologies for delay in replying...
G