Required+Delayed sequencer command is fired immediately on conversation end

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
Fenda
Posts: 6
Joined: Thu Jul 04, 2019 3:45 am

Required+Delayed sequencer command is fired immediately on conversation end

Post by Fenda »

I have a conversation set up that and its last node has a Sequence defined as follows:
required MyCustomCommand(foo, bar)@4;

If the player clicks the Continue button on the last node then the command is fired immediately. Is it possible to respect that 4 second delay?
User avatar
Tony Li
Posts: 22108
Joined: Thu Jul 18, 2013 1:27 pm

Re: Required+Delayed sequencer command is fired immediately on conversation end

Post by Tony Li »

Hi,

That's what "required" does. It ensures that a command runs immediately even if the player skips ahead before its scheduled time.

If you want to wait for a full 4 seconds no matter what, you can write a custom sequencer command that schedules the action to happen after 4 seconds. Then the syntax might look something like this:

MyCustomCommand(foo, bar, 4)

Note that the command script itself will be killed as soon as the player clicks continue. So you'll need to offload the work to a script that will stick around

Code: Select all

public SequencerCommandMyCustomCommand : SequencerCommand
{
    void Start()
    {
        MyTaskScheduler.Schedule(GetParameter(0), GetParameter(1), GetParameterAsFloat(2));
    }
}
where MyTaskScheduler.Schedule looks something like:

Code: Select all

public static void MyTaskScheduler(string foo, string bar, float timeToRun) {...}
Fenda
Posts: 6
Joined: Thu Jul 04, 2019 3:45 am

Re: Required+Delayed sequencer command is fired immediately on conversation end

Post by Fenda »

Gotcha! That makes sense. I've actually ended up going the route of calling a Timeline from a sequence command instead and adding a Bark track to that. I'm passing in both nowait and nostop and that seems to do the trick. :D
Post Reply