View Single Post
  #9  
Old 04-25-2012, 06:06 AM
FG28_Kodiak FG28_Kodiak is offline
Approved Member
 
Join Date: Dec 2009
Location: Swabia->Bavaria->Germany
Posts: 884
Default

yes its possible.


Code:
    public int GetSumAllPlanes()
    {
        int planeCount = 0;
        List<AiAirGroup> allAirgroups = new List<AiAirGroup>();

        if (GamePlay.gpAirGroups(1) != null)
            allAirgroups.AddRange(GamePlay.gpAirGroups(1));

        if (GamePlay.gpAirGroups(2) != null)
            allAirgroups.AddRange(GamePlay.gpAirGroups(2));


        allAirgroups.ForEach(item =>
            {
                foreach (AiAircraft ac in item.GetItems())
                {
                    planeCount++;
                }
            });

        return planeCount;
    }
before loading a new mission you can check for example
Code:
if(GetSumAllPlanes() < maxPlanes)
You can also use AiAirgroup 's NOfAirc but it seems buggy in the current Clod Version, it sometimes not show the correct Numbers of Airplanes in a group. So it's better to add the Aircrafts like above.

Last edited by FG28_Kodiak; 04-25-2012 at 06:11 AM.
Reply With Quote