Do an action after player clicks on a choice and wait for the action to finish

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
athasiop
Posts: 2
Joined: Fri Apr 15, 2022 12:24 pm

Do an action after player clicks on a choice and wait for the action to finish

Post by athasiop »

I am a newbie to your plugin. Maybe this question has been answered before but i am a little bit confused on how to approach it. What i want to achieve is after the player clicks on an answer i want to record the player for 5 seconds and then after the recording finishes continue the conversation. So how can i do an action and wait for it to finish after the player chooses a response. Should i use the SequencerCommandTemplate or use custom logic with TemplateDialogueUI before calling SelectedResponseHandler? I should mention that I want to access the selected answer's text. Does the sequencer have access to the dialogue text of its node? Thanks in advance!
User avatar
Tony Li
Posts: 22149
Joined: Thu Jul 18, 2013 1:27 pm

Re: Do an action after player clicks on a choice and wait for the action to finish

Post by Tony Li »

Hi,

You're absolutely on the right track. Use a sequencer command. When the player clicks a choice (a dialogue entry assigned to the player actor), the Dialogue System will play the dialogue entry's Sequence. It won't advance the conversation until the Sequence is done.

The Tutorials manual section has a series of Cutscene Sequence Tutorials that explain how to use sequences and even how to write your own custom sequencer commands.

Your sequencer command will have access to all of the properties listed here, such as GetParameterAsType(#) and speaker and listener. You can also access the choice's dialogue text like this:

Code: Select all

string dialogueText = DialogueManager.currentConversationState.subtitle.formattedText.text;
athasiop
Posts: 2
Joined: Fri Apr 15, 2022 12:24 pm

Re: Do an action after player clicks on a choice and wait for the action to finish

Post by athasiop »

Works like a charm! I didn't expect this to be that simple. Thanks a lot for the help!
User avatar
Tony Li
Posts: 22149
Joined: Thu Jul 18, 2013 1:27 pm

Re: Do an action after player clicks on a choice and wait for the action to finish

Post by Tony Li »

Glad to help!
Post Reply