Implementing minigames/alternative menus

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
pixel-reverie
Posts: 15
Joined: Sun Oct 13, 2019 12:48 am

Implementing minigames/alternative menus

Post by pixel-reverie »

Hey guys!

I just started using the dialogue system, and I'm loving it so far. A lot of potential it seems!

Anyway I am struggling a bit with figuring out the best approach to inserting other interactive elements between nodes.

Here is the general idea:

DialogueNode -> CustomInteractiveSelectionMenu -> [Condition x] Dialogue Node

-

A more in depth description:

The player talks to an NPC:

Image


They get into a choice dialogue:

Image


They then enter a Beer selection menu:

Image


After the selection has been made, the dialogue will continue based on what was selected:

Image


--


I have a standalone manager for the Beer selection which has an entry and an exit which invokes either an OnCancel event or an OnSelected<Beer> event

I'm just having trouble figuring out how to tie it all together with the dialogue system.


Here's my current thinking:

-Run a LUA command that opens the panel and sets a "waiting for selection" variable
-When selected, set the "waiting for selection" to false, and a "beer taste result" variable to Nice,Average,Bad, Special1...etc
-Tell the current dialogue node to complete


I'm not sure if there is a better/easier way and would love some suggestions!
Thanks so much!
pixel-reverie
Posts: 15
Joined: Sun Oct 13, 2019 12:48 am

Re: Implementing minigames/alternative menus

Post by pixel-reverie »

UPDATE:

Right now here is how I am doing it:

>Run a script in the node: "OpenBeerRecommendation("Siegfried");"
>Run a sequence in the node: "SetContinueMode(false); WaitForMessage(Forever);"
-At this point everything is fine. The input has been disabled and my beer recommendation panel is the sole focus
>OnSelect/Cancel Play a sequence: "SetContinueMode(original);"
.And Stop the Conversation then Play a result conversation:
DialogueManager.Instance.StopConversation();
DialogueManager.Instance.StartConversation(string.Format("{0}/Tavern/BeerFinished", actor));


--

It is almost perfect except that the dialogue UI transitions out then back in.
Is there a way I can start a conversation in an existing UI panel?
User avatar
Tony Li
Posts: 22055
Joined: Thu Jul 18, 2013 1:27 pm

Re: Implementing minigames/alternative menus

Post by Tony Li »

Hi,

If you actually do want to hide the dialogue UI during the beer recommendation menu, here are two suggestions:

1. You can run OpenBeerRecommendation as a custom sequencer command instead of a registered Lua function. The Sequence might look like this:

Code: Select all

SetDialoguePanel(false);
OpenBeerRecommendation(Siegfried)->Message(Done);
SetDialoguePanel(true)@Message(Done)
  • The first line hides the dialogue UI.
  • The second line runs the sequencer command. It assumes that the sequencer command stays running until the beer recommendation menu is done. Then it sends the sequencer message "Done".
  • The third line waits until something sends the sequencer message "Done". Then it shows the dialogue UI, at which point the conversation continues.
If you're using a continue button, add a fourth line:

Code: Select all

Continue()@Message(Done)
This will also automatically continue at the same time that it makes the dialogue UI reappear.

2. Alternatively, you can continue using OpenBeerRecommendation as a Lua function. Change the Sequence to this:

Code: Select all

SetDialoguePanel(false);
SetDialoguePanel(true)@Message(Done)
When you close the beer recommendation menu, run this C# code

Code: Select all

Sequencer.Message("Done");
---

If you want to keep the dialogue UI visible but just hide the continue button, consider one of these suggestions (which are similar to the ones above):

1. You can run OpenBeerRecommendation as a custom sequencer command instead of a registered Lua function. The Sequence might look like this:

Code: Select all

SetContinueMode(false);
OpenBeerRecommendation(Siegfried)->Message(Done);
SetContinueMode(original)@Message(Done);
Continue()@Message(Done)
  • The first line hides the continue button.
  • The second line runs the sequencer command. It assumes that the sequencer command stays running until the beer recommendation menu is done. Then it sends the sequencer message "Done".
  • The third & fourth lines wait until something sends the sequencer message "Done". Then it shows the continue button and continues, at which point the conversation continues.
2. Alternatively, you can continue using OpenBeerRecommendation as a Lua function. Change the Sequence to this:

Code: Select all

SetContinueMode(false);
SetContinueMode(original)@Message(Done);
Continue()@Message(Done)
When you close the beer recommendation menu, run this C# code

Code: Select all

Sequencer.Message("Done");
---

One last tip: You may need to add an empty node between the beer menu node and the ones that check the player's selection variable. This is because conversations need to evaluate conditions one extra level ahead to accommodate certain continue button modes. Leave the empty node's text blank, and set the Sequence to: Continue()
pixel-reverie
Posts: 15
Joined: Sun Oct 13, 2019 12:48 am

Re: Implementing minigames/alternative menus

Post by pixel-reverie »

Hi Tony,

Thanks so much for the very detailed suggestions!

I ended up going with the Custom Sequencer Command since it seems generally cleaner and "correct".

I am only having a small problem with the SetContinueMode sequencer command now.

SetContinueMode(false);
OpenBeerRecommendation(Siegfried)->Message(Done);
SetContinueMode(original)@Message(Done); <- This here doesn't work correctly
Continue()@Message(Done)

If I put that line in the next node then it works just fine, so it's not a huge issue but it would be nice to know why that isn't running.

Thanks!
User avatar
Tony Li
Posts: 22055
Joined: Thu Jul 18, 2013 1:27 pm

Re: Implementing minigames/alternative menus

Post by Tony Li »

Hi,

Add the keyword "required" in front:

Code: Select all

required SetContinueMode(original)@Message(Done);
The Continue() command is skipping to the next entry before SetContinueMode(original) has a chance to run. The "required" keyword guarantees that it runs.
pixel-reverie
Posts: 15
Joined: Sun Oct 13, 2019 12:48 am

Re: Implementing minigames/alternative menus

Post by pixel-reverie »

That did the trick!

Thanks so much!

I'm super happy to have this up and running so quickly :D

Top quality support!
User avatar
Tony Li
Posts: 22055
Joined: Thu Jul 18, 2013 1:27 pm

Re: Implementing minigames/alternative menus

Post by Tony Li »

Glad to help!
Post Reply