# Get Town Location
Grammar — Get the location of town town for player player
Flags —Native|Function
Returns the location of a town for a player.
# Arguments
- int— Player
- int— Town
Returns — point
native point AIGetTownLocation(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/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);
    }
mods/warcoop/warmeleeai.sc2mod — base.sc2data/TriggerLibs/Common_ai.galaxy:67
    for(;town<c;town+=1){
        if(AIGetTownState(player,town)){
            loc=AIGetTownLocation(player,town);
            mines=UnitGroupSearch("ngol", player, loc, 20.0,UnitFilter(0, 0, (1 << c_targetFilterPlayer) | (1 << c_targetFilterAlly) | (1 << c_targetFilterEnemy),0),0);
            ui=1;
mods/warcoop/warmeleeai.sc2mod — base.sc2data/TriggerLibs/Common_ai.galaxy:87
    for(;town<c;town+=1){
        if(AIGetTownState(player,town)){
            loc=AIGetTownLocation(player,town);
            mines=UnitGroupSearch("ngol", player, loc, 20.0,UnitFilter(0, 0, (1 << c_targetFilterPlayer) | (1 << c_targetFilterAlly) | (1 << c_targetFilterEnemy),0),0);
            ui=1;
mods/warcoop/warmeleeai.sc2mod — base.sc2data/TriggerLibs/Common_ai.galaxy:104
bool TownHasMine (int player,integer townid) {
    int town=townid;
    point loc=AIGetTownLocation(player,town);
    unitgroup mines=UnitGroupSearch("ngol", player, loc, 20.0,UnitFilter(0, 0, (1 << c_targetFilterPlayer) | (1 << c_targetFilterAlly) | (1 << c_targetFilterEnemy),0),0);
    if(AIGetTownState(player,townid)<1){return false;}
mods/warcoop/warmeleeai.sc2mod — base.sc2data/TriggerLibs/MeleeWaveAI.galaxy:81
    unitgroup allCreeps=UnitGroup(null, GAw3_AICreepPlayer, RegionEntireMap(), GAw3_AICreepfilter , 0);
    unitgroup camp;
    point p=AIGetTownLocation(player,AIGetMainTown(player));
    unit creep;
	unit creepTarget;
mods/warcoop/warmeleeai.sc2mod — base.sc2data/TriggerLibs/Orc/Orc.galaxy:82
void GetZeppelin(int player){
    AIUpdateMainTown(player);
	UnitCreate(1, "nzep", 0, player, AIGetTownLocation(player, AIGetMainTown(player)), 270.0);
    //libNtve_gf_CreateUnitsAtPoint2(1, "nzep", 0, player, AIGetTownLocation(player, AIGetMainTown(player)));
    AISetUnitScriptControlled(UnitLastCreated(), false);