View Single Post
  #7  
Old 12-18-2011, 08:29 AM
41Sqn_Banks 41Sqn_Banks is offline
Approved Member
 
Join Date: Oct 2007
Posts: 644
Default

Quote:
Originally Posted by 41Sqn_Banks View Post
Oh wait I had an idea:

If I destroyed the Aircraft this should change the content of the getItems() array. This will confuse the foreach loop and it will skip some aircraft.
Obviously the aircrafts are destroyed with a small delay, that's why it is working for some aircraft and some not.

Solution: Store the aircraft to destroy in a seperate list first. Then loop over this list and destroy the aircrafts in it. This way even if the content of getItems() is changed, the content of the list stays the same

I'll check this and report back.
This was the solution. I updated the code in the first post. I think this topic is something for Ataros scripting collection
Reply With Quote