# Get Town Location

Grammar — Get the location of town town for player player
FlagsNative | Function

Returns the location of a town for a player.

# Arguments

  • int — Player
  • int — Town

Returns — point

native point AIGetTownLocation(int player, int town);

Category: AI Advanced / Towns / Functions

# Examples

mods/core.sc2modbase.sc2data/TriggerLibs/MeleeHighAI.galaxy:345


        // we should try to expand
        AIExpand(player, AIGetTownLocation(player, c_townMain), c_ZB_Hatchery);
    }

mods/core.sc2modbase.sc2data/TriggerLibs/MeleeHighAI.galaxy:382


        // we should try to expand
        AIExpand(player, AIGetTownLocation(player, c_townMain), c_PB_Nexus);
    }

mods/core.sc2modbase.sc2data/TriggerLibs/MeleeHighAI.galaxy:419


        // we should try to expand
        AIExpand(player, AIGetTownLocation(player, c_townMain), c_TB_CommandCenter);
    }

mods/core.sc2modbase.sc2data/TriggerLibs/MeleeLowAI.galaxy:451


        // we should try to expand
        AIExpand(player, AIGetTownLocation(player, c_townMain), c_TB_CommandCenter);
    }

mods/core.sc2modbase.sc2data/TriggerLibs/MeleeLowAI.galaxy:593


        // we should try to expand
        AIExpand(player, AIGetTownLocation(player, c_townMain), c_ZB_Hatchery);
    }

mods/core.sc2modbase.sc2data/TriggerLibs/MeleeLowAI.galaxy:735


        // we should try to expand
        AIExpand(player, AIGetTownLocation(player, c_townMain), c_PB_Nexus);
    }

mods/void.sc2modbase.sc2data/TriggerLibs/MeleeHighAI.galaxy:345


        // we should try to expand
        AIExpand(player, AIGetTownLocation(player, c_townMain), c_ZB_Hatchery);
    }

mods/void.sc2modbase.sc2data/TriggerLibs/MeleeHighAI.galaxy:382


        // we should try to expand
        AIExpand(player, AIGetTownLocation(player, c_townMain), c_PB_Nexus);
    }

mods/void.sc2modbase.sc2data/TriggerLibs/MeleeHighAI.galaxy:419


        // we should try to expand
        AIExpand(player, AIGetTownLocation(player, c_townMain), c_TB_CommandCenter);
    }

mods/warcoop/warmeleeai.sc2modbase.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.sc2modbase.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.sc2modbase.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.sc2modbase.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.sc2modbase.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);