Wait until true node for Blueprint?

Hi, is there a node that basically checks a bool input and then waits until that bool is true before continuing to execute?

For example, if I execute an action, such as a leap, I would like to end the leap state the moment the character hits the ground again. There’s no way to predict how long that will take, so I can’t use a delay for it. Currently I have a gate hooked up to an event tick to check for this, but that seems inefficient. I am searching for a way to basically pause further execution of the event until that bool parameter (grounded) is true, then proceed and finish executing.

Is there a way to do this? Thank you!

I guess you could use a branch node? (same as if-statements)

I currently have a branch connected to the event tick so it checks all the time. I guess I’d just like to clean up my event tick so as not to have too much stuff being processed every frame.

Try using the while loop. You can use collision to set a bool saying whether you are on the ground or not.

Typically what you do is work off collision detection events. So if you have a physics collider on the character, sphere/box/capsule - and you get a hit detected, you can check what kind of thing hit the character to know, did I hit the ground.

Additionally - you can do things like in Tick, once per frame send out a short trace/raycast in the direction the player is falling to see if you hit ground. If you do, then you can feed that information into the animation to know if you should be begin playing the ‘prepare to land’ animation.

EDIT:
There’s no ‘wait until true node’ - generally you solve this by having a state enum or boolean that you switch on in tick, one of the states could be ‘falling’. Alternatively, you do something and stop. Then you wait for further input (collision event) and then invoke your own custom event after doing some logic to determine if you need to finish some earlier work you began.

That’s pretty much how the Delay node works internally when compiled, it really is just stopping at the delay node, and sending an event to to our timer callback system. Once the time has been reached it calls an event. That event just so happens to be a function that was generated wrapping all the logic that comes after the Delay node.

Cheers,
Nick

Depending on what you want to do but shouldn’t be “Event on landed” be what you’re looking for? :slight_smile:

Yes, this was the perfect node for the situation, thank you!

Hi Nick, thanks for the thorough and enriching reply!

I’ll have to check that out! In this case I was able to use an EventOnLanded node as suggested by user Erasio, but I’ll definitely keep the while loop in mind!

you can create a macro for certain events.

2 Likes

Thanx Bro