Flow of One Way Conversations

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
Aislin
Posts: 4
Joined: Fri Dec 29, 2017 4:27 pm

Flow of One Way Conversations

Post by Aislin »

Hello! This may be a silly question, but I am working on a tutorial for my game. I've watched several videos and looked at the example scene, and I'm struggling how to figure out how to do a couple of things:

1) How can I make the dialogue boxes fade out, do various things with my game, then go to the next node? So essentially creating a delay between nodes. I'm using Playmaker, and in Playmaker I would just use various actions to fade out the Canvas Group alpha, do a bunch of things, receive an event, and then fade the Canvas Group alpha back in.

2) Is there a way to wait for a user input other than writing a script that waits for it and sends a message to the Sequencer? Instead of using a "Continue" button to advance text boxes, I'd like to allow the user to left click anywhere (or allow the user to configure whatever button they want for this purpose). Or for a tutorial on how to use an attack, I may want to wait for the player to press whatever key is mapped to "Fire 1" before continuing.

I'm pretty new here, so just looking for some best practices.

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

Re: Flow of One Way Conversations

Post by Tony Li »

Hi!
I'll answer #2 first, since I think my explanation might be clearer that way.
Aislin wrote: Fri Dec 29, 2017 4:36 pm2) Is there a way to wait for a user input other than writing a script that waits for it and sends a message to the Sequencer? Instead of using a "Continue" button to advance text boxes, I'd like to allow the user to left click anywhere (or allow the user to configure whatever button they want for this purpose). Or for a tutorial on how to use an attack, I may want to wait for the player to press whatever key is mapped to "Fire 1" before continuing.
To do this, you're going to use the node's Sequence field.

Here's the short answer:

1. Set the node's Sequence field to:

Code: Select all

Continue()@Message(Advance)
2. When the player does what you want (e.g., presses Fire1, builds a supply depot, etc.), use the Send Sequencer Message PlayMaker action to send the message "Advance".


Here's the long version, which explains the steps above:

(See here for general info about sequences.)

When you're not using a continue button, each dialogue entry node runs the sequencer commands in its Sequence field. When all of the commands finish, the conversation progresses to the next node. For example, if the Sequence field is:

Code: Select all

Delay(5)
then the node will wait 5 seconds before the conversation progresses. If the Sequence field is blank, the node uses the Dialogue Manager's Camera Settings > Default Sequence.

When you are using a continue button, the conversation progresses when you click the continue button or when the Sequence field runs the command "Continue()".

The "@" syntax lets you specify when a sequencer command should run. For example, to automatically continue after 3 seconds:

Code: Select all

Continue()@3
You can also tell a sequencer command to run when it receives a sequencer message (which is any string of your choosing). To do this, you use the "@Message(message)" syntax.

The Tutorial Example scene in the Examples folder uses the "@Message" sequencer command syntax.

In your case, you can tell the node to Continue() when it receives a sequencer message "Advance". Set the Sequence field to:

Code: Select all

Continue()@Message(Advance)
You can send this sequencer message from PlayMaker. First make sure you've imported the PlayMaker Support package. Then use the Send Sequencer Message action to send the sequencer message "Advance".
Aislin wrote: Fri Dec 29, 2017 4:36 pm1) How can I make the dialogue boxes fade out, do various things with my game, then go to the next node? So essentially creating a delay between nodes. I'm using Playmaker, and in Playmaker I would just use various actions to fade out the Canvas Group alpha, do a bunch of things, receive an event, and then fade the Canvas Group alpha back in.
You can still use PlayMaker to do this. Set up the fade-out, etc. to run when an event occurs in your FSM. Let's say you name that event "HideDialogue".

In your node's Sequence field, use the FSMEvent() sequencer command, which sends an event to a PlayMaker FSM. If your FSM is on a GameObject named "Tutorial Manager", set the Sequence to:

Code: Select all

FSMEvent(HideDialogue, Tutorial Manager);
Continue()@Message(Advance)
The first line runs the "HideDialogue" event on the FSM on Tutorial Manager. The second line continues the conversation when the sequencer receives the message "Advance", presumably from your FSM's Send Sequencer Message action.


I realize that's a lot of info. If you have any questions about it, please let me know.
Aislin
Posts: 4
Joined: Fri Dec 29, 2017 4:27 pm

Re: Flow of One Way Conversations

Post by Aislin »

Perfect, makes sense. Thank you so much for helping :) This'll definitely help me move forward. I hope you had a great New Year!
User avatar
Tony Li
Posts: 22061
Joined: Thu Jul 18, 2013 1:27 pm

Re: Flow of One Way Conversations

Post by Tony Li »

Glad to help! Happy New Year!
Post Reply