The problem is very simple: I got a ForLoop that has the first int set to 1 and the second to 10. Now, I got it hooked up to 2 AIMoveTos, and for some reason it always finishes even when the exec of the first AIMoveTo is set to OnMoveFinished. Just wtf
Am I misunderstanding ForLoops, or something? Please help me, I am desperate at this point.
A picture is worth a thousand words. Please show what you got.
Debug it, use print node to see all index values from loop.
Good idea, will try and thanks!
yes, it just completes right away not noticing that the second move to location hasn’t finished.
The ForLoop allways has to finish every iteration in one Frame, it does not split it´s iterations across multiple Frames. The MoveTo Node however is just starting the AI task that then is executed until the AI reached the goal which usually takes multiple seconds and hundreds of frames. What you are dooing here is starting the MoveToTask 10 times right after each other in the same frame and then the loop finishes. Since this all happens in one frame, the loop completion triggers first and the OnFinish Event of the MoveToTask only triggers whenever the task is completed, which occurs multiple seconds later. Note that the OnMovementFinish Exec Pin is likely an Event that is called once the Goal has been reached and is not part of the Exec Line that you connected to the forLoop.
On a different note: Why are you calling the MoveToTask 10 times in one frame? It only needs to be called once.
Oh right. Then I misunderstood the ForLoop node. Thanks for pointing it out! Will try a different method then.
I solved it by adding a DoN to the custom event and calling it when the AIMoveTo2 is finished. Also added a way to check for the Antihero in the map.
I’ve found not being able to rely on for loop iterations to complete successively to be a major headache. I have so many places in my code where I manually add to an iterator and use a branch to determine if the loop should exit.
I wish we had a “blocking for loop” that would ensure the previous iteration completed before continuing. Or, I suppose, I could just figure out writing c++ for ue4 but I’ve been procrastinating.