PDA

View Full Version : CountAiGroundActor ??? I want to count how many Static objects


hc_wolf
08-05-2012, 11:55 AM
HI, I want to see how many Static objects I have in my mission at any one time.

Is there a way to see this?

I wrote this below but does not show me the number when I call it in Menu. Any ideas?



GamePlay.gpLogServer(new Player[] { player }, "Ground Unit Count: RAF {0} LWA {1} ", new object[] { CountAiGroundActor(1), CountAiGroundActor(2) });


/*------------AI Ground Units Select------------*/
public int CountAiGroundActor(int Army)
{
int NumberOfStaticObjects = 0;

if (GamePlay.gpGroundGroups(Army) != null) return 0;
foreach (AiGroundGroup gg in GamePlay.gpGroundGroups(Army))
{
NumberOfStaticObjects += 1;
}
return NumberOfStaticObjects;
}

FG28_Kodiak
08-05-2012, 06:17 PM
To get the number of all Statics you can use:

public int CountStatic()
{
return GamePlay.gpGroundStationarys().Length;
}