# 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
- [F] —
int
— Get Town State — ( AIGetTownState ) - [F] —
point
— Get Town Location — ( AIGetTownLocation ) - [F] —
int
— Get Closest Town — ( AIGetClosestTown ) - [F] —
int
— Get Next Unused Town Slot — ( AIGetNextUnusedTownSlot ) - [F] —
int
— Get Building Count In Town — ( AIGetBuildingCountInTown ) - [F] —
bool
— Is Town Harvesting — ( AIIsTownHarvestRunning ) - [F] —
int
— Get Current Harvest Peon Count — ( AIGetCurPeonCount ) - [F] —
int
— Get Min Desired Harvest Peon Count — ( AIGetMinPeonCount ) - [F] —
int
— Get Max Desired Harvest Peon Count — ( AIGetMaxPeonCount ) - [F] —
int
— Get Mineral Amount Left — ( AIGetMineralAmountLeft ) - [F] —
int
— Get Gas Amount Left — ( AIGetGasAmountLeft ) - [F] —
int
— Get Num Mineral Spots — ( AIGetMineralNumSpots ) - [F] —
int
— Get Num RawGas Spots — ( AIGetRawGasNumSpots ) - [F] —
point
— Get Offense Gather Location — ( AIGetGatherLocation ) - [F] —
point
— Get Defense Gather Location — ( AIGetGatherDefLocation ) - [F] —
int
— Expand — ( AIExpand ) - [F] —
unitgroup
— Get Town Threats — ( AIGetTownThreats )
# Examples
# mods/core.sc2mod
// L345
AIExpand(player, AIGetTownLocation(player, c_townMain), c_ZB_Hatchery)
// L382
AIExpand(player, AIGetTownLocation(player, c_townMain), c_PB_Nexus)
// L419
AIExpand(player, AIGetTownLocation(player, c_townMain), c_TB_CommandCenter)
# mods/core.sc2mod
// L451
AIExpand(player, AIGetTownLocation(player, c_townMain), c_TB_CommandCenter)
// L593
AIExpand(player, AIGetTownLocation(player, c_townMain), c_ZB_Hatchery)
// L735
AIExpand(player, AIGetTownLocation(player, c_townMain), c_PB_Nexus)
# mods/void.sc2mod
// L345
AIExpand(player, AIGetTownLocation(player, c_townMain), c_ZB_Hatchery)
// L382
AIExpand(player, AIGetTownLocation(player, c_townMain), c_PB_Nexus)
// L419
AIExpand(player, AIGetTownLocation(player, c_townMain), c_TB_CommandCenter)