+1
Answered

How to Make Delay / Wait between 2 flow's state ?

agan 2 years ago updated by Lazlo Bonin (Lead Developer) 2 years ago 14

Hi,

I'm new to BOLT.  I want to make delay about 3-7 seconds between 2 flow' state.
I've create below diagram, but failed. it seems my GameObject directly move without delay...


any idea ?

Bolt Version:
Unity Version:
Platform(s):
Scripting Backend:
.NET Version (API Compatibility Level):
GOOD, I'M SATISFIED
Satisfaction mark by agan 2 years ago
+1

on Time elapsed isn't automatic restart it only happens once at the start of the flow graph, or start of a state or transition. To do a true delay repeating, you have a few options. The quickest is a single state machine, with a self transition. The trigger event being the on timer elapse. What's happening is you run whatever code (your translate) in on start state. Every x amount of seconds it'll trigger to go back and do that state from start. Also a delay node is in its way next update, if that helps with anything.


Sorry, I read wrong. You don't want it to repeat? So The on timer elapse is all you need, get rid of start What you have would fire it instantly, and then also 7 seconds.

*Ignore my previous reply in regards to this. Yours is fine minus start.

Hi,

Yes, i'm get rid of Start & How to use it with "on Timer Elapsed"...

I'm looking way to make simple Delay...

in PlayMaker, i just make like this :



How to do like this in BOLT ?

Thanks...


+1

In like a week or so a Delay unit will be available for in flow graph flow execution native to bolt by the developer. You can also just create a state machine like above, and put a fake state with nothing in it, trigger to your translate with the on timer elapse. To the next state translate. Those are the two options for now based on what you are saying. I have a delay I made, I'll upload it in a few. But it's not going to be as nice as the native bolt solution coming. But it works just fine like you want. Give me like 30 minutes and there will be a new post in the macro section on this forum.

+1

Hi,

Many Thanks, I'll try your solution.... :)

Hi,

i just try but the delay does not work. I found error "Variable Not Found: WhileYieldLoopIdCount" :



Are below design/config right :

\

I also import all .assets file, are this Macros need to locate on specific folder ?


One More, Why i cannot Do "right-click" Mouse to create new state on Graph Screen ?

Many Thanks in advance...


I didn't add a check if the value WhileYieldLoopIdCount exists already, just add the variable as an int to Scene Variables. I will be uploading a fix to all 3 units in a bit.

Macros do not need to be located anywhere specific. You can right click, goto Macros in the fuzzy finder and add these that way. Or drag in from a folder. Is this what you mean?

Sorry about the mistake. I know you've been needing this. Everything is in place. Go ahead and redownload, every unit works perfect now. No need to add a variable yourself.

Amazing, it works now!!!

😀

Many Thanks.... and waiting for native versions...

Excellent I'm glad. I'm making improvements, so it won't be worthless either. I'll be aiming at more extendable delay executions. I'll most likely use the native ones inside at that point. Like for instance, a character drinks a health potion. It generates over time. But the character gets hit. You could pause the current regen, lose health, and continue where you left off regaining the rest. No need for workarounds. Works with Wait too. Almost finished. Will be up in the next 24 hours.

The green units are events.  Events work independently of one another  Your first example has two events, START and ON TIMER ELAPSED, which means you will translate twice, immediately on start, then again in 3 seconds.


The simple way to do what you showed in the play maker pic is to remove the start event (pretend I didn't mistype the number 😂)



If you wanted to use a full state machine instead of a flow graph, you would do something like:


owh, i'll try... thanks for sharing...