Order of Events after or during a loop

I’m trying to set up a scene with very specific order of events. I’m getting what looks like the events acting out of order where there is a loop involved which makes me think I am misunderstanding something.

Say I have two events A and B. If A is a for each instance loop with three objects and B is an event on the same level placed underneath I would expect the events to go in the order

A1, A2, A3, B

But I seem to be getting

A1, B, A2, B, A3, B

For more context, the loop in question is nested and uses the pathfinding function to look for a path between pairs of points. I might have 3 start points and 2 end points

For Each Start
For Each End
Move a test object from Start to End and test if a path has been found

TBH, I’ve found the pathfinding to be a bit funky as it ignores obstacles created immediately before the pathfinding is called. It requires a small wait for the pathfinding to recognise the new obstacles.

If you had a single loop either a repeat or for each instance it would process all of the events and subevents as placed and repeat them either the count times or object times.

For each a
… Collision a with player
… Variable =8

Collision A1 with player
Variable

Collision A2 with player
Variable

If you nest 2 for each object or repeats it would do them in sequence.

Say you had a and b objects

For each a
… For each b
… … Collision between a and b
… … Collision a with z

It would pick 1 object from each for each instance.

A1 to B1
A1 to z

A1 to B2
A1 to z

A1 to B3
A1 to z

A2 to B1
A2 to z

A2 to B2
A2 to z

A2 to B3
A2 to z

And so on

All of the events and subevents of a for each would be triggered until an new event that is lower in hierarchy. Meaning more to the left, indentation wise.

1 Like