Can someone please explain why this setup is not working? I expected to have printed 6 hellos in 1.2 seconds
I can rout it in different ways and make it work but as I look this should work too
Can someone please explain why this setup is not working? I expected to have printed 6 hellos in 1.2 seconds
My guess is that the For Loop node doesn’t wait for the Loop Body to finish executing before the next loop. I think you should use timers instead of the For Loop and Delay node (such as the Set Timer by Event node)
If you absolutely need to have a delay in a loop you can do it with a macro library function.
Macro needs to be of type Actor to get the delay node.
I did this but it have no break, the post above you is giving me good idea I will do the same, but thanks for joining
Thats very nice!!! I will create it thank you
Loads of Catches & Gotchas that only experience can resolve.
To explain the for loop issue a bit better, if you open up the for loop code, it actually consists of a sequence (this is shown in the modified for loop with delay). I’m not sure when it happened (maybe 4.6-ish) I think Unreal removed the ability to have delays in sequences… this is because the next pin automatically fires when a delay is hit - so it just passes through the delay OR gives erroneous behaviour. Similarly you can’t use delays in functions either. It would be just nicer if Unreal actually gave a proper warning (like most beginners, I’ve wasted hours trying to resolve timings only to find that delays aren’t working properly).
If you look inside the Do N node, it also relies on a sequence - does this really work? Unfortunately in my case, I needed to have a nested for loop (with multiple delays in the body) so the Do N node doesn’t work for me in either case.
Are there any links to info on creating this for loop with delay? I haven’t attempted to create any macros in blueprints so I am not exactly sure how to set up the inputs correctly. I am currently attempting to remove board game pieces (from a stack of pieces) with a for loop (runs once for each attack damage done) from my game board… Inside of said for loop I attempted to use a timeline to smoothly move the pieces to there designated discard area but before the first piece even moves my for loop runs through all of it’s iterations. I’m sorry if this seems simple but I am but a humble game designer that is learning blueprints so that I might bring my board game creation to the world.
Edit: Also, I am unsure as to where and/or when I make the macro of the type actor…
Blueprints → Blueprint Macro Library
Parent Class == ACTOR
Input/Output pins
First input “name” is an underscore _ . Type is Execution pin
Cleaned up version. Easier to see/read the flow.
Macros are automatically added to the Executable actions context menu.
Resulting node
Thank you I will Try this tomorrow and see if it works with my current coding situation…
Edit: Your help worked like a charm! In theory this same process should be plausible for creating a for each loop with delay right? That would be very helpful in a few coding situations that I have forced myself into…