Download

Delay in while loops (Macro)

Since you can’t add a delay to a while loop I made a new Macro with a delay in it, but since you can’t use the regular delay I used “Task Wait Delay”.
Can you even use “Task Wait Delay” the way I’m trying to use it? And to where do I need to connect the “Task Owner” node?

Screenshot_1.png

You really want it your way :smiley:
Drag out Task Owner and press AI, it looks like “Task Wait Delay” is used for AI´s but you could try adding your Actor / Controller to “Get AIController” to see what happens (if anything at all).
But a “While Loop” is really the same as a Branch with one way out and one in, it works exactly the same it just has different nodes.

While loops are meant to execute completely in one frame. They are not meant to be delayed whatsoever. The while loop would try to execute infinitely if you give it a condition that never changes…

I am not sure what you are trying to do, but I don’t think a while loop is what you are looking for.

Rather than a while loop, it would probably be better if you manually looped your logic and set your condition to branch out of the loop when the condition is met. So go from your delay or the end of your logic chain and plug it into the branch at the start of the loop.

One work around would be to place whatever it was that you wanted to do in the loop body inside a function. You then hook it up to event tick with boolean gates for number of times you want to fire the thing, what conditions need to be met to fire it, and a delay attached to the end of it.

So would I use a multigate or what is a Boolean gate?