[quote:1xzwe4yr]Yes - nested loops can be very CPU intensive. If you have 600 Ships and 600 Turrets and you do:
+ For Each Ship
+ For Each Turret
You are requiring that the actions are run 600 x 600 times, which is 360,000 times (over a third of a million). Repeat this a few times and you're asking the CPU to run millions of iterations!
Only do loops like that if it is absolutely
necessary. What are you doing that requires that code? Often, there are much more efficient solutions.[/quote:1xzwe4yr]
Yeah this is the problem...
I disabled the group that had this code in and it run like a dream now. But i'm not sure how to do it without "For Each".
Basically, Each ship has multiple turrets that are meant to "stick" to its action points. They also have multiple thrusters that stick to the action points. How can i make all the ships have the correct turret and thrusters stuck to their ship?
So bascially, theres a buch of ship objects, a bunch of turret objects, and a bunch of thruster particle objects. Currently i'm saying for each turret, for each ship, if the UIDofparent value of turret is = to Ships.UID, then set X,Y accordingly.
Please tell me there is a better way