Newby here,
I have a BP that I´m using to learn and test things. Made a for loop and it´s working. Now I want to use the same BP to make a Wile loop (just so I don´t have to create another BP and add it to the scene) . I don´t think I can duplicate the “Event Beginplay” (I tryed allready and it dupplicates with some message and doesn´t work) so how would you do it? What I´m doing is detatch the “Event Beginplay” and attached it to another BP but this is far form ideal imo, I´m sure there is something better.
You can create a Custom Event.
rightclick and type “custom event” and the Context List will guide you to it.
This event can be called withing the same BP or via a reference from another BP Class.
That way, you can create your own while loops by simple call the event, inside the event again. But make sure to add a branch to break it. the difference to a Node While Loop (that runs within 1 Frame) is, that you can add a Delay Node to make the Loop wait for N.xxx Seconds and let other actions happen in between that delay.
PS. : Delays can not be used in Functions, just in a normal BP Graph.
You could essentially use booleans or enums to choose which loops, or branches of code get run.
This can be an input from a custom event and every time you run it, you change the input to select a new “line” of nodes.
From keyboard events, like @ClockworkOcean mentioned, simply change the condition and then run the nodes again.
A straight forward way would be to collapse everything into a function or a macro (if your nodes cannot be collapsed into a function.)
Thanks a lot for the help. I´m a bit confused on how to do it actually. Is there some youtube video that coves this ? Could you make a quick recording to explain how this is done?
@ClockworkOcean Then those red lines as you marked will have to be made manually right? By connecting what I want to run and then disconnecting and connecting something else?
I there a way to have them all connected and just change some number in the sequence node?