# Get Max Desired Harvest Peon Count
Grammar — Get the maximum number of peons we want to have harvesting in town town for player player
Flags —Native
|Function
Returns the maximum number of peons the AI wants to have harvesting in a town for a player.
# Arguments
int
— Playerint
— Town
Returns — int
native int AIGetMaxPeonCount(int player, int town);
# Related
Category: AI Advanced / Towns / Functions
- Get Town State —
int
— AIGetTownState - Get Town Location —
point
— AIGetTownLocation - Get Closest Town —
int
— AIGetClosestTown - Get Next Unused Town Slot —
int
— AIGetNextUnusedTownSlot - Get Building Count In Town —
int
— AIGetBuildingCountInTown - Is Town Harvesting —
bool
— AIIsTownHarvestRunning - Get Current Harvest Peon Count —
int
— AIGetCurPeonCount - Get Min Desired Harvest Peon Count —
int
— AIGetMinPeonCount - Get Max Desired Harvest Peon Count —
int
— AIGetMaxPeonCount - Get Mineral Amount Left —
int
— AIGetMineralAmountLeft - Get Gas Amount Left —
int
— AIGetGasAmountLeft - Get Num Mineral Spots —
int
— AIGetMineralNumSpots - Get Num RawGas Spots —
int
— AIGetRawGasNumSpots - Get Offense Gather Location —
point
— AIGetGatherLocation - Get Defense Gather Location —
point
— AIGetGatherDefLocation - Expand —
int
— AIExpand - Get Town Threats —
unitgroup
— AIGetTownThreats
# Examples
mods/core.sc2mod — base.sc2data/TriggerLibs/MeleeAI.galaxy:79
DebugVarInt2(
"peons cur", AIGetCurPeonCount(player, c_townMax),
"max", AIGetMaxPeonCount(player, c_townMax)
);
DebugVarBool("e_flagsScouting", AIGetFlag(player, e_flagsScouting));
mods/core.sc2mod — base.sc2data/TriggerLibs/MeleeLowAI.galaxy:380
void AILDStockWorkers (int player, int count, string worker) {
int econMin = AIGetMinPeonCount(player, c_townMax);
int econMax = AIGetMaxPeonCount(player, c_townMax);
if (econMin > count) {
mods/starcoop/starcoop.sc2mod — base.sc2data/TriggerLibs/MeleeAI.galaxy:79
DebugVarInt2(
"peons cur", AIGetCurPeonCount(player, c_townMax),
"max", AIGetMaxPeonCount(player, c_townMax)
);
DebugVarBool("e_flagsScouting", AIGetFlag(player, e_flagsScouting));