Suggestion for breaking up conversation into parts?

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
arvz
Posts: 8
Joined: Fri Aug 18, 2017 5:31 am

Suggestion for breaking up conversation into parts?

Post by arvz »

Hey,

So I'm putting together a cutscene (not using Dialogue System, we have our own cutscene system that starts dialogue system conversations through API call) and we want to be able to do something like this:

1. Character begins some dialogue
2. Character moves to some position
3. Character continues the dialogue from where they left off

What would be the best way of doing this? These would be 100% scripted so there's no need to dynamically pause at different points or anything like that.

I suppose we could break it up into multiple Conversations, but that seems like it'd get messy very quickly and would be annoying to work with. I would like to keep all the dialogue of this cutscene into 1 Conversation ideally.

So far I've got it kind of working by having a Conversation that has unlinked nodes, so the first bit of dialogue would reach an end node, then carry out the movement and then start the same conversation but from a specific entry ID. This isn't really that good of a solution though as it means we need to either know the specific entry ID to pick up from or keep track of the last entry ID that was spoken.

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

Re: Suggestion for breaking up conversation into parts?

Post by Tony Li »

You could make two branches from the START node. Set a dialogue database variable that specifies which branch to play, and use the Conditions field on the first node of each branch.

Then just play the conversation from the beginning each time, but make sure to set the variable first using DialogueLua.SetVariable().

Alternatively, you could make it all one straight conversation branch and in step #2 set the Sequence field to something like:

Code: Select all

SetActive(Dialogue Panel,false);
SetActive(Dialogue Panel,true)@Message(DoneMovingCharacter)
This will hide the Dialogue Panel and wait. When your character is in position, call Sequencer.Message("DoneMovingCharacter").
arvz
Posts: 8
Joined: Fri Aug 18, 2017 5:31 am

Re: Suggestion for breaking up conversation into parts?

Post by arvz »

Hey Tony,

If I put everything in 1 branch, is it possible to send OnConversationEnd message in the middle where it pauses? My scripts rely on that message to know when to do some things
User avatar
Tony Li
Posts: 22062
Joined: Thu Jul 18, 2013 1:27 pm

Re: Suggestion for breaking up conversation into parts?

Post by Tony Li »

No, but you could send a different message using the SendMessage() sequencer command, or write a custom sequencer command that calls your cutscene.

Using SendMessage():

Code: Select all

SetActive(Dialogue Panel,false);
SendMessage(StartCutscene,,MyGameObject);
SetActive(Dialogue Panel,true)@Message(DoneMovingCharacter)
Using a custom sequencer command:

Code: Select all

MyCutscene()
This assumes MyCutscene runs until the cutscene finishes, and that it also temporarily hides the Dialogue Panel. For example, it might look like:

Code: Select all

public class SequencerCommandMyCutscene : SequencerCommand {
 
    public IEnumerator Start() {
        GameObject.Find("Dialogue Panel").SetActive(false); // (Kludge for this example.)
        while (/*character is moving*/) {
            yield return null;
        }
        GameObject.Find("Dialogue Panel").SetActive(true);
        Stop();
    }
} 
arvz
Posts: 8
Joined: Fri Aug 18, 2017 5:31 am

Re: Suggestion for breaking up conversation into parts?

Post by arvz »

So couldn't I just go

Code: Select all

SetActive(Dialogue Panel,false);
SendMessage(OnConversationEnd);
SetActive(Dialogue Panel,true)@Message(DoneMovingCharacter)
That'd send an OnConversationEnd message to both actor and conversant wouldn't it?
User avatar
Tony Li
Posts: 22062
Joined: Thu Jul 18, 2013 1:27 pm

Re: Suggestion for breaking up conversation into parts?

Post by Tony Li »

No, sorry. The SendMessage() sequencer command is only designed to send a string or nothing as the parameter. But the OnConversationEnd method expects a Transform as the parameter. You could add something like this to your script:

Code: Select all

public void OnConversationEnd2() {
    OnConversationEnd(this.transform);
} 
and use this Sequence:

Code: Select all

SetActive(Dialogue Panel,false);
SendMessage(OnConversationEnd2);
SetActive(Dialogue Panel,true)@Message(DoneMovingCharacter)
Post Reply