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.