# Expand
Grammar — Instruct the AI for player player to expand starting the search at point point and building building at the new expansion
Flags —Native
|Function
Instructs the AI for a player to expand starting the search at the specified point, and builds the specified building at the new expansion. Returns the town index for the new town.
# Arguments
int
— Playerpoint
— Pointstring
<gamelink::Unit> — Building
Returns — int
native int AIExpand(
int player,
point searchStart,
string firstBuilding,
);
# 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/MeleeHighAI.galaxy:345
// we should try to expand
AIExpand(player, AIGetTownLocation(player, c_townMain), c_ZB_Hatchery);
}
mods/core.sc2mod — base.sc2data/TriggerLibs/MeleeHighAI.galaxy:382
// we should try to expand
AIExpand(player, AIGetTownLocation(player, c_townMain), c_PB_Nexus);
}
mods/core.sc2mod — base.sc2data/TriggerLibs/MeleeHighAI.galaxy:419
// we should try to expand
AIExpand(player, AIGetTownLocation(player, c_townMain), c_TB_CommandCenter);
}
mods/core.sc2mod — base.sc2data/TriggerLibs/MeleeLowAI.galaxy:451
// we should try to expand
AIExpand(player, AIGetTownLocation(player, c_townMain), c_TB_CommandCenter);
}
mods/core.sc2mod — base.sc2data/TriggerLibs/MeleeLowAI.galaxy:593
// we should try to expand
AIExpand(player, AIGetTownLocation(player, c_townMain), c_ZB_Hatchery);
}
mods/core.sc2mod — base.sc2data/TriggerLibs/MeleeLowAI.galaxy:735
// we should try to expand
AIExpand(player, AIGetTownLocation(player, c_townMain), c_PB_Nexus);
}
mods/void.sc2mod — base.sc2data/TriggerLibs/MeleeHighAI.galaxy:345
// we should try to expand
AIExpand(player, AIGetTownLocation(player, c_townMain), c_ZB_Hatchery);
}
mods/void.sc2mod — base.sc2data/TriggerLibs/MeleeHighAI.galaxy:382
// we should try to expand
AIExpand(player, AIGetTownLocation(player, c_townMain), c_PB_Nexus);
}
mods/void.sc2mod — base.sc2data/TriggerLibs/MeleeHighAI.galaxy:419
// we should try to expand
AIExpand(player, AIGetTownLocation(player, c_townMain), c_TB_CommandCenter);
}