Page 1 of 5
start a simaltaneous conversation in an entry
Posted: Thu Feb 25, 2021 9:57 am
by CHOPJZL
Hello!
I am thinking about a situation, A&B are talking, after they pass a certain dialogue entry1, C&D start talking in the background. Although A&B's conversation is not affected, after they reach another certain entry2, they must wait for C&D's progress.
I think maybe this should be done by sequence. Use a command in entry1 to start conversation C&D, Then wait for certain message from C&D in A&B's entry2. Is this a proper way?
By the way, what will happen if a message is sent before the waiting command is running? Is there a command to wait until a certain variable become a desire value?
Re: start a simaltaneous conversation in an entry
Posted: Thu Feb 25, 2021 10:23 am
by Tony Li
Hi,
First, make sure you've ticked the Dialogue Manager's Allow Simultaneous Conversations checkbox.
Normally a node in the A&B conversation could use the WaitForMessage() sequencer command, and C&D could send the message. However, if it's possible the C&D could send the message before A&B get to that node, you should instead write a custom sequencer command. Setting a variable is a good idea. In C&D, use the Script field to set the variable. In the A&B node, use a custom sequencer command like this:
Code: Select all
public class SequencerCommandWaitForVariableTrue : SequencerCommand
{
private WaitForSeconds waitDuration = new WaitForSeconds(0.2f); // Check 5x/second
IEnumerator Start()
{
string variableName = GetParameter(0);
if (!string.IsNullOrEmpty(variableName))
{
while (DialogueLua.GetVariable(variableName).asBool != true)
{
yield return waitDuration;
}
}
Stop();
}
}
Then, to check for a variable "xxx", set the A&B node's Sequence to:
Re: start a simaltaneous conversation in an entry
Posted: Thu Feb 25, 2021 9:58 pm
by CHOPJZL
Thanks for the fast reply!
About sequence, if continued called before a required command's turn, It will act during the next entry, am I right? If so, it could be conflict with the entry's command which has the same actor.
And the commands without required, will they just be skipped?
Re: start a simaltaneous conversation in an entry
Posted: Thu Feb 25, 2021 10:05 pm
by Tony Li
The command does not have 'required', it will be skipped.
If the command has 'required', it will run as soon as the player clicks the continue button. It will run before the next entry.
Re: start a simaltaneous conversation in an entry
Posted: Thu Feb 25, 2021 10:12 pm
by CHOPJZL
I mean other kinds of sequence command that will take time to finish. For example, a timeline() command
Re: start a simaltaneous conversation in an entry
Posted: Thu Feb 25, 2021 10:23 pm
by Tony Li
Those will stop immediately. Only use 'required' with commands that stop immediately, such as Timeline() with the 'nowait' option.
Re: start a simaltaneous conversation in an entry
Posted: Fri Feb 26, 2021 3:10 am
by CHOPJZL
Is it able for you to make the sequence running like the node map of Quest Machine?I think sequence command could be node based too, like dialogue entry. This is part of the reason I ask the simaltaneous conversation question. Although open a new conversation only have sequence commands in each node is a way, but dialogue is different from cutscenes as it should't run multiple nodes at the same time, and seems not performant. Then I thought the way that Quest Machine operates is just fit.
Please feel free to tell me if I am asking too much, for now I think use below will satisfy many cases,It's just not quite powerful as node, such as seeding a Message only when a group of commands all finish
SomeCommand()@Message(section1)->Message(section2);
SomeCommand()@Message(section2)->Message(section3)
And I 'd like to know your opinion on which one has better performance?
1. Around 23 commands all wait for parent message like SomeCommand()@Message(section23)->Message(section24) in an entry
2.A simaltaneous conversation to run those commands
Re: start a simaltaneous conversation in an entry
Posted: Fri Feb 26, 2021 8:49 am
by Tony Li
23 commands in the same conversation is more efficient than running a separate conversation.
If the sequencing gets too complex, you can use an interactive sequencer such as Unity Timeline or SLATE. However, Timeline and SLATE are not good for conditional instructions. They always run a linear sequence from beginning to end without waiting for conditions.
If you don't know when sequencer commands will finish, you can write a custom sequencer command to wait for them. For example, say you have sequencer commands AAA(), BBB(), and CCC(). You want to run CCC() only after AAA() and BBB() are both finished, but you don't know how long AAA() and BBB() will take. (Maybe they both depend on player action, such as in a tutorial.)
For example, say you write a sequencer command that waits for a Dialogue System variable reach a minimum value:
The command above could set the variable "numCompleted" to zero when it starts. Then it would wait until "numCompleted" is 2 or greater. If AAA() and BBB() increment "numCompleted" when they're done, your sequence might look like:
Code: Select all
AAA();
BBB();
WaitForValue(numCompleted, 2)->Message(Done);
CCC()@Message(Done)
Re: start a simaltaneous conversation in an entry
Posted: Fri Feb 26, 2021 9:19 am
by CHOPJZL
Good idea! Then how about loops? For example, the sequencer runs AAA(), BBB(), AAA(), BBB()......after certain condition become true, the sequencer runs CCC() after last BBB().
By the way, do you have plan to integrate MoreMountains's MMFeedbacks? It is kind of a sequencer that is a gift of Corgi and TopDown engine.
Re: start a simaltaneous conversation in an entry
Posted: Fri Feb 26, 2021 9:24 am
by Tony Li
MMFeedbacks integration is a good idea. I'll add that to the roadmap.
I may also add a newly-released asset called
Cutscenes to the roadmap. I know nothing about it except for a glance at its store page, but it looks useful. It's a visual sequencer like Unity Timeline, but it's based on action completion, not time.
For loops, it might be best to write a single custom sequencer command that handles the entire loop.