Page 1 of 1

Using continue key in timeline?

Posted: Fri Mar 03, 2023 4:33 am
by jjpixelc
Hi

I generally use continue key (in my case spacebar) in my game. I find it works great to let the player decide the flow of the conversations this way.
But I was wondering whether I could use this method in timelines too, so that players progressed through a timeline cutscene by tapping space to go to the next dialogue entry?

I'm thinking some code that paused the timeline/game on every continue node, then jumping to the next continue node when space (or a button or whatever) is pressed before starting the timeline again from there. And there would have to be the option of not jumping sometimes, when you want some other actions in the timeline to take place.

Is this feasable? I could probably write it myself, but I was thinking you could maybe set me on the right road so I don't waste too much time looking at dead ends.

Re: Using continue key in timeline?

Posted: Fri Mar 03, 2023 8:00 am
by Tony Li
Hi,,

Yes, you can do that. Assuming your timeline is named "yourTimeline", set the conversation's Default Sequence to something like:

Code: Select all

Timeline(speed, yourTimeline, 0);
required Timeline(speed, yourTimeline, 1)@Message(Continued)
The first command pauses the timeline by setting its speed to zero.

The second command waits until it receives the message "Continued" -- which, technically, nothing in the Dialogue System ever sends. It's just an arbitrary string I chose. However, when the player continues by pressing the continue button, the "required" keyword guarantees that the command runs, which resumes the timeline by setting its speed to one.

You could add other commands in there, such as this to hide the continue button until the typewriter has finished:

Code: Select all

Timeline(speed, yourTimeline, 0);
SetContinueMode(false);
SetContinueMode(true)@Message(Typed);
required Timeline(speed, yourTimeline, 1)@Message(Continued)
(The "Typed" message is actually sent by something in the Dialogue System -- the typewriter effect.)

And/or clear the text after a delay based on the text length:

Code: Select all

Timeline(speed, yourTimeline, 0);
ClearSubtitleText(all)@{{end}};
required Timeline(speed, yourTimeline, 1)@Message(Continued)

Re: Using continue key in timeline?

Posted: Mon Mar 06, 2023 5:22 am
by jjpixelc
Thanks!
I got a nice functionality working by starting from your suggestions here.
Very satisfied customer as always! :-)

Re: Using continue key in timeline?

Posted: Mon Mar 06, 2023 8:17 am
by Tony Li
Glad to help!