Known issues with looping through objects?
I've done some searching and haven't found anything helpful, unfortunately.
I'm trying to loop through objects to assign each one a value, but the loop only executes once. It works perfectly that one time, assigning the value to one object, but the rest get nothing.
On loop "loop"
MoveIndex of (object) = LoopIndex("loop")
(stuff is supposed to happen, only happens once)
It doesn't matter how many of the objects there actually are, only one is ever looped through.
Re: Known issues with looping through objects?
Make sure you have a Spread Value Action somewhere. And it mustn't be in the same event as you start the loop.
Re: Known issues with looping through objects?
Yeah, I have that in an "Always" group at the top of the code, forgot to mention that, sorry.
Re: Known issues with looping through objects?
I think it's probably fastest to upload an example of this behaviour to the file archive - is it small enough to do that?
Otherwise, inspired guess - are you using the Object's "Compare to an alterable value" condition? The "Compare two general values" variant won't select an instance of that object.
Re: Known issues with looping through objects?
try using this instead:
*Always:
=[Active Object]: Set Flag 0 Off
=[Active Object]: Set Flag 1 Off
*Always:
=Start Loop [Loop Name] for (Number of [Active Object]) loops
*On Loop: [Loop Name]
+[Active Object]'s Flag 0 is Off?
+Pick a [Active Object] at random
=[Active Object]: Set Flag 0 On
=[Active Object]y: Set Flag 1 On
*On Loop: [Loop Name]
+[Active Object] Flag 1 is On
(conditions go here)
(events go here)
*On Loop: [Loop Name]
=[Active Object]: Set Flag 1 Off
Re: Known issues with looping through objects?
I just realized while I was posting to the file archive; the objects themselves are the source of data which is being written to an AGB object, but it's the looping behavior that's an issue here. I hope this doesn't muddy the waters any.
File Archive post
Here's the post in the file archive with sample uploaded.
Edit: Pixelthief, thanks, I'll have to give that a try too.