Node1 Sequence before Node2 Condition

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
SergioJ
Posts: 2
Joined: Mon May 09, 2022 6:33 am

Node1 Sequence before Node2 Condition

Post by SergioJ »

Hi there!

Okay, let me explain you my problem (I couldn't find and answer in the forum):
CapturaPixel1.PNG
CapturaPixel1.PNG (23.46 KiB) Viewed 485 times
In the node Launch I want to call a function which will return a result (Success or Failure) in a variable number of seconds (Which I cannot know beforehand). In the connecting nodes I have a LuaRegistered Function which checks the variable in which I store the result of my function from before.

My problem is that I don't know how to make the connecting nodes to wait for the Launch function to finish. I've been trying several things but I cant find the proper way to do it.

If I, for example, use a script with a coroutine inside, the moment I reach any "yield return something" the conditions get called.
I've tried to use a Custom sequence too but the conditions get called even before reaching the Awake Functionof the Custom Sequence.

I'm sure I'm missing something, but I cannot find what it is.

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

Re: Node1 Sequence before Node2 Condition

Post by Tony Li »

Hi,

Add a blank node between Launch and Success/Failure. Set its Sequence to Continue(). This is the explanation, with a screenshot of an example:

Conversations Evaluate Conditions One Extra Level Ahead
SergioJ
Posts: 2
Joined: Mon May 09, 2022 6:33 am

Re: Node1 Sequence before Node2 Condition

Post by SergioJ »

Tony Li wrote: Mon May 09, 2022 8:10 am Hi,

Add a blank node between Launch and Success/Failure. Set its Sequence to Continue(). This is the explanation, with a screenshot of an example:

Conversations Evaluate Conditions One Extra Level Ahead
THANK YOU SO MUCH, I imagined that I was going to do something like this but it is reassuring to see it in the documentation :D
User avatar
Tony Li
Posts: 21977
Joined: Thu Jul 18, 2013 1:27 pm

Re: Node1 Sequence before Node2 Condition

Post by Tony Li »

Glad to help!

One thing I forgot to mention: Since your function may take a variable amount of time, set Launch's Sequence to something like:

Code: Select all

WaitForMessage(FinishedFunction)
This will make the Launch node wait for your code to send a sequencer message "FinishedFunction". At the end of your function, use this line of C# code:

Code: Select all

PixelCrushers.DialogueSystem.Sequencer.Message("FinishedFunction");
Post Reply