Page 1 of 1
How to close a conversation by script
Posted: Mon May 23, 2022 6:01 pm
by rauljl1
Hi Tony.
Some of my conversations have an Scene Event methods/functions on execute them.
But, while the function is executed, the Dialogue panel is still showing.
How can I close the panel or finish the conversation just an instant after calling the Scene Event?
Thanks in advance!
Re: How to close a conversation by script
Posted: Mon May 23, 2022 8:51 pm
by Tony Li
Hi,
If the Scene Event is on the last dialogue entry node, the conversation will end as soon as that node's Sequence finishes. If you want the Sequence to end immediately, set it to: Continue()
If it's not on the last node and you want to force the conversation to stop anyway, set the Sequence to: StopConversion()
Re: How to close a conversation by script
Posted: Mon May 23, 2022 9:59 pm
by rauljl1
Yes, the scene event is on the last node. Is an option that the player can choose. Have two On Execute Scene Events.
The problem is when I click the option which contains it, the convarsation it doesn't end like others. The Dialogue panel is still showing.
Re: How to close a conversation by script
Posted: Mon May 23, 2022 10:18 pm
by Tony Li
Are there any errors or warnings in the Console window? If your Scene Event calls a method that runs into an error, it's possible that this might prevent the Dialogue System from continuing.
Otherwise, temporarily set the Dialogue Manager's Other Settings > Debug Level to Info. When the Scene Event runs, look for this message in the Console:
Dialogue System: Conversation ending.
If you see that message, the conversation has ended. If you don't, then the conversation is still active.
Re: How to close a conversation by script
Posted: Sun Oct 30, 2022 11:44 pm
by rauljl1
Hi, Tony.
I have one more question.
I have a conversation with 4 possible answers.
each answer have other dialogue entry.
If the player doesn't respond within 10 seconds, how do I force the conversation to follow a specific dialogue entry?
I've already done the time thing.
Re: How to close a conversation by script
Posted: Mon Oct 31, 2022 7:52 am
by Tony Li
Hi,
The easiest way is to:
1. Set the Dialogue Manager's Display Settings > Input Settings > Response Timeout to 10 and Response Timeout Action to Choose First Response.
2. Make the default response dialogue entry the first in the question node's Links To list.
Other options:
- If you don't want to make the entry the first in the Links To list, there are other Response Timeout Actions.
- If you don't want every player response menu to time out after 10 seconds, leave Response Timeout set to 0. Instead, use the SetTimeout() sequencer command.
Re: How to close a conversation by script
Posted: Mon Oct 31, 2022 10:27 am
by rauljl1
It worked very well. But I have a problem now. I shuffle my answers, so not picking first or last doesn't work for me. What I can do?
Re: How to close a conversation by script
Posted: Mon Oct 31, 2022 12:07 pm
by Tony Li
You could set the Response Timeout Action to one of the other values (see ResponseTimeoutAction
here). If you change it to Custom, assign a method to
DialogueManager.customResponseTimeoutHandler. In this method, you can decide what to do. The list of responses is in DialogueManager.currentConversationState.pcResponses[]. You can call DialogueManager.standardDialogueUI.OnClick(Response) to choose a response, such as:
Code: Select all
DialogueManager.customResponseTimeoutHandler = ChooseFirstResponse;
...
void ChooseFirstResponse()
{
DialogueManager.standardDialogueUI.OnClick(DialogueManager.currentConversationState.pcResponses[0]);
}
Re: How to close a conversation by script
Posted: Mon Oct 31, 2022 12:39 pm
by rauljl1
Works perfectly. Thanks!