Page 1 of 1

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

Posted: Fri Apr 15, 2022 12:39 pm
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!

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

Posted: Fri Apr 15, 2022 2:12 pm
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;

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

Posted: Sat Apr 16, 2022 3:05 am
by athasiop
Works like a charm! I didn't expect this to be that simple. Thanks a lot for the help!

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

Posted: Sat Apr 16, 2022 8:31 am
by Tony Li
Glad to help!