SetTimeout Callbacks

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
ar4wy
Posts: 26
Joined: Fri Nov 15, 2019 10:16 pm

SetTimeout Callbacks

Post by ar4wy »

Hi Tony!

Is there callbacks for...

Code: Select all

SetTimeout(5); Delay({{end}})
This kind of thing? I know I set something like this in the Conversations Editor, under Sequences.

However, I'm looking for callbacks like... "OnTimerStart" and "OnTimerEnd." This way, I can trigger sound files on each occasion, and more.

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

Re: SetTimeout Callbacks

Post by Tony Li »

Hi,

The timer starts when the response menu starts, so you can use the OnConversationResponseMenu message for when the timer starts. Use OnConversationTimeout to be notified if/when the timer runs out.

More info: Script Messages
ar4wy
Posts: 26
Joined: Fri Nov 15, 2019 10:16 pm

Re: SetTimeout Callbacks

Post by ar4wy »

Hi Tony,

Apologies if this is documented somewhere -- if the Timer runs out, how do I redirect the dialogue branching towards another NPC Dialogue?

For example, a message that says something like, "What's taking you so long?" Do I have to do this manually with Conditions? Or is there something built in for this?

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

Re: SetTimeout Callbacks

Post by Tony Li »

Hi,

If you set the Dialogue Manager's Display Settings > Input Settings > Response Timeout Action to anything except Custom, it will follow one of the response menu options (first, last, current, or random).

If you set it to Custom, add a script to the Dialogue Manager that has an OnConversationTimeout() method that does something. For example, when writing your conversation you could set the Title (or a custom field) of a dialogue entry to a specific value. In OnConversationTimeout(), find this dialogue entry and go to it. Rough example:

Code: Select all

void OnConversationTimeout()
{
    var conversation = DialogueManager.masterDatabase.GetConversation(DialogueManager.currentConversationState.subtitle.dialogueEntry.conversationID);
    var timeoutEntry = conversation.dialogueEntries.Find(entry => entry.Title == "OnTimeout");
    DialogueManager.conversationController.GotoState(DialogueManager.conversationMode.GetState(timeoutEntry));
}
ar4wy
Posts: 26
Joined: Fri Nov 15, 2019 10:16 pm

Re: SetTimeout Callbacks

Post by ar4wy »

Thanks for this, Tony.

I've set Response Timeout Action to "Choose Current Response," but it keeps choosing the First Response anyways. I looked into the ConversationController Script, and it seems this occurs when selected response null?

I'm not using mouse, just WASD and Gamepad for my Dialogue system -- is there a reason why my "highlighted/selected" response is not registering?
User avatar
Tony Li
Posts: 22140
Joined: Thu Jul 18, 2013 1:27 pm

Re: SetTimeout Callbacks

Post by Tony Li »

Hi,

Please import this fix for "Choose Current Response":

DS_TimeoutCurrentResponsePatch_2020-12-01.unitypackage

It isn't in the just-released version 2.2.14, so if you import 2.2.14 you'll want to import this patch on top of it. This fix will be in 2.2.15.
ar4wy
Posts: 26
Joined: Fri Nov 15, 2019 10:16 pm

Re: SetTimeout Callbacks

Post by ar4wy »

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

Re: SetTimeout Callbacks

Post by Tony Li »

Happy to help!
Post Reply