Controlling a Conversation through script~

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
SystemId
Posts: 30
Joined: Thu Aug 08, 2019 1:31 pm

Controlling a Conversation through script~

Post by SystemId »

Hello,
I'm still fairly new to Dialogue system, and I am currently using a different than normal input system. I need to script my Input Manager to control conversations.

I am having trouble figuring out how to manipulate conversations through scripting:
I know you can stop the current conversation with:
DialogueManager.StopConversation();

but I cannot seem to find how to:
1) Progress a Conversation
2) Control branching dialogue options (Cycling through the options or binding specific buttons for specific options)
3) Completing typewriting effects. (So I can then progress a conversation.)
4) Skipping to specific point within a Conversation?

Sorry to ask a question that was more than likely answered somewhere, but I can't seem to figure these out. I tried going through the scripting section in the documentation, and I tried looking around for examples in the Extras section.

If someone can point me in the right direction for examples, or know the answers it would be really helpful~
User avatar
Tony Li
Posts: 22055
Joined: Thu Jul 18, 2013 1:27 pm

Re: Controlling a Conversation through script~

Post by Tony Li »

Hi,
Thanks for using the Dialogue System!
SystemId wrote: Mon Aug 19, 2019 11:25 am1) Progress a Conversation
2) Control branching dialogue options (Cycling through the options or binding specific buttons for specific options)
3) Completing typewriting effects. (So I can then progress a conversation.)
Are you using a dialogue UI? If so, then the simplest approach is to script your input to work with the dialogue UI, typically by writing a small subclass of StandardDialogueUI. There are examples of doing this for speech-to-text input, VR input, etc. If you can provide more details, I can point you to more specific resources.
SystemId wrote: Mon Aug 19, 2019 11:25 am4) Skipping to specific point within a Conversation?
Three ways:

1. In the Dialogue Editor, make a link to the specific dialogue entry. Set Conditions so the conversation follows that link when under specific conditions.

2. Or, stop the conversation and start it again at a specific dialogue entry using DialogueManager.StartConversation() or by setting the entry ID in a Dialogue System Trigger (Add Action > Start Conversation).

3. Or, get a conversation state and tell the conversation to go to that state. Conversations use a Model-View-Controller architecture. Get the conversation state from the model and tell the controller to go to it, such as:

Code: Select all

var state = DialogueManager.conversationModel.GetState(dialogueEntry);
DialogueManager.conversationController.GotoState(state);
SystemId
Posts: 30
Joined: Thu Aug 08, 2019 1:31 pm

Re: Controlling a Conversation through script~

Post by SystemId »

wow that was a fast response..
I am using the Dialogue UI yes. I am using Unity new input system, so it isn't really complex what I need to do. But yes .. I can have my input manager work with the Dialogue UI. It's honestly using basic keyboard mouse / controller controls still.

Thank you for the reply about skipping to a specific point. That works fine.~
User avatar
Tony Li
Posts: 22055
Joined: Thu Jul 18, 2013 1:27 pm

Re: Controlling a Conversation through script~

Post by Tony Li »

Glad to help!

If you get stuck on it, just let me know. Official support for Unity's new input system will be introduced some time after version 2.2.0 is released (when the new input system is more of a final release and less of a beta feature).
SystemId
Posts: 30
Joined: Thu Aug 08, 2019 1:31 pm

Re: Controlling a Conversation through script~

Post by SystemId »

Sorry Tony, still a little stuck on this issue. I do have conversations working now, but I still couldn't figure out:


1) Controlling branching Dialogue options. I lose my controls when I reach a point in Dialogue where it branches. I'm not sure what kind of commands I should be sending the Dialogue manager. (Cycling through the options) with scripts. "Accepting" that option when you have it highlighted.

2) I am also having a problem with using my controls to End a Bark with WaitForContinue button option checked.

If you can give me any insight on how this works, it would be much appreciated. I've already got my Player starting conversations working since the last hint. : ) , and my barks / alerts are working properly.
User avatar
Tony Li
Posts: 22055
Joined: Thu Jul 18, 2013 1:27 pm

Re: Controlling a Conversation through script~

Post by Tony Li »

SystemId wrote: Wed Aug 21, 2019 1:52 am1) Controlling branching Dialogue options. I lose my controls when I reach a point in Dialogue where it branches. I'm not sure what kind of commands I should be sending the Dialogue manager. (Cycling through the options) with scripts. "Accepting" that option when you have it highlighted.
Call the dialogue UI's OnClick(Response) method.

The dialogue UI's ShowResponses(Response[]) method receives an array of Responses that it typically shows in a menu of buttons. When the player clicks a button, the button calls the dialogue UI's ShowResponses method, passing the corresponding Response.
SystemId wrote: Wed Aug 21, 2019 1:52 am2) I am also having a problem with using my controls to End a Bark with WaitForContinue button option checked.
Call the bark UI's OnContinue() method.
Post Reply