Page 1 of 1

"Accept/Cancel" prompt panel in the middle of a conversation

Posted: Wed Aug 23, 2017 10:58 am
by MeneghettiFlux
Hello!

I'm doing a project where some conversations will require a confirmation from the player to proceed with that choice.

It should work like this: When the player chooses a response dialogue, the Confirmation panel should appear, warning the player that that choice will have a more serious repercussion and asking if he is sure to proceed and know the consequences (Like spending some important resource or generating some "no-turning-back" event).

Doing this on the end of a conversation is easy, just triggering a OnConversationEnd event, but I'm having difficulty doing this in the middle of a dialogue.

Does anyone have any idea if the Plugin have anything I can use or a way to implement it somehow?

Thanks in advance! :)

Re: "Accept/Cancel" prompt panel in the middle of a conversation

Posted: Wed Aug 23, 2017 1:02 pm
by Tony Li
Hi,

Here are two ways to do it:

1. Write a custom sequencer command that shows the confirmation panel and sets a variable, named "Confirm" for example, to true or false. Then write your conversation like this:
  • NPC: "Want to buy a $15 Rolex?"
    • Player: "No."
    • Player: "Yes."
      Sequence: ShowConfirmationPanel()
      • NPC: (blank) -- empty node delays evaluation
        Sequence: None()
        • NPC: "Nice doing business with you."
          Conditions: Variable["Confirm"] == true
          Script: RemoveCurrency(15); AddItem("Rolex")
This is very similar to how the TextInput() sequencer command works. A couple tips: (1) Use DialogueLua.SetVariable() to set the variable. (2) In your sequencer command, remember to call Stop(); when the command is done -- that is, when the player has clicked OK or Cancel.


2. Or, run the confirmation as part of the conversation, but override the UI elements. Let's say you have three actors -- Player, NPC, and Confirmation -- and your conversation looks like this:
  • NPC: "Want to buy a $15 Rolex?"
    • Player: "No."
    • Player: "Yes."
      • Confirmation: "Are you sure? This will remove $15 from your wallet."
        • Player: "Cancel"
        • Player: "OK"
          • NPC: "Nice doing business with you."
            Script: RemoveCurrency(15); AddItem("Rolex")
Find your Unity UI Dialogue UI component (under the Dialogue Manager) and tick Find Actor Overrides.

Create an empty GameObject (typically under Dialogue Manager) named "Confirmation" so it matches the actor name. (Or add an Override Actor Name component to the GameObject, and set the Override Name to "Confirmation".) Add an Override Unity UI Dialogue Controls component to the GameObject, and assign your confirmation panel's UI elements to it. When the actor named Confirmation "speaks" a line such as "Are you sure?...", the Dialogue System will show these UI elements instead of the regular dialogue UI.

Re: "Accept/Cancel" prompt panel in the middle of a conversation

Posted: Wed Aug 23, 2017 1:18 pm
by MeneghettiFlux
Hey! Thanks for the quick reply! 8-)

Both options are great! I'll have to check with the team how they prefer to show the confirmation to the player!