Get Typwriter Updates into Bolt

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
F1foux
Posts: 26
Joined: Mon Jul 19, 2021 1:21 pm

Get Typwriter Updates into Bolt

Post by F1foux »

Hi Tony,
I'm still really enjoying your Dialogue System and it opened so many doors for me as a "Non-Programmer".

I've implemented animated characters that get triggered by Dialogue Entries. Now I want to be able to stop the talking animation when the Typewriter is done writing. Is it possible to trigger Bolt Custom Events in the Typewriter script? Could you push me into the right direction? :)

I want the Typewriter Script to send a custom event to my Dialogue Animation Control Script once the writing is done.

Thank you for your help!
User avatar
Tony Li
Posts: 21986
Joined: Thu Jul 18, 2013 1:27 pm

Re: Get Typwriter Updates into Bolt

Post by Tony Li »

Hi,

The typewriter sends a sequencer message "Typed" when it's done. It's commonly used like this:

Code: Select all

AnimatorPlay(Talk);
AnimatorPlay(Idle)@Message(Typed)
The first line tells the speaker's Animator to play the "Talk" state. The second line waits until the typewriter sends the sequencer message "Typed"; then it tells the Animator to play the "Idle" state.

Side note: An improved version of that sequence is:

Code: Select all

AnimatorPlay(Talk);
required AnimatorPlay(Idle)@Message(Typed)
The 'required' keyword guarantees that AnimatorPlay(Idle) plays even if the player skips ahead before the typewriter is finished.


The Dialogue System Extras page has an updated Bolt Support package with a new BoltEvent() sequencer command that you can use to accomplish something similar. (Future readers: If you're using DS 2.2.21 or higher, the sequencer command is already in the regular Bolt Support package.)

The syntax is:

BoltEvent(event, [subject])

The subject is optional. If omitted, it sends the event to the Bolt machine on the speaker. Example sequence:

Code: Select all

BoltEvent(DoneTyping)@Message(Typed)
If your Bolt machine handles a custom event named "DoneTyping", it will get this event when the typewriter is done.
F1foux
Posts: 26
Joined: Mon Jul 19, 2021 1:21 pm

Re: Get Typwriter Updates into Bolt

Post by F1foux »

Great thx Tony.

One more question. Where do I add this command? Can I add it to the typwriter script so it gets automatically sent after every line written, or do I have to add it to every dialogue entry manually?
User avatar
Tony Li
Posts: 21986
Joined: Thu Jul 18, 2013 1:27 pm

Re: Get Typwriter Updates into Bolt

Post by Tony Li »

You can add it to the Dialogue Manager GameObject's Display Settings > Camera & Cutscene Settings > Default Sequence, like this:

Code: Select all

Delay({{end}});
BoltEvent(DoneTyping)@Message(Typed)
Post Reply