# Limit Bully Wave Gather To Nearest Town

Grammar — Sets limits when gathering bullies & other units for attack waves to only use ones at the nearest town for player player to be enable|Enabled\Disabled.
FlagsNative | Action

When enabled for a player, this makes it so that bullies for that player can only be used in attack waves that are gathering near the town those bullies are closest to.

# Arguments

Returns — void

native void AINearestTownLimitWaveGather(
	int player,
	bool enable,
);

Category: AI / Bullies / Actions

# Examples

campaigns/liberty.sc2campaignbase.sc2maps/maps/campaign/thorner04.sc2map/MapScript.galaxy:4084

    libNtve_gf_DeclareNextTown(gv_p02_DOMINION_INFANTRY, UnitGetPosition(UnitFromId(570)));
    AINearestTownBullyRebuild(gv_p02_DOMINION_INFANTRY, true);
    AINearestTownLimitWaveGather(gv_p02_DOMINION_INFANTRY, true);
    TriggerExecute(gt_P03AttackWavesSiege, true, false);
    TriggerExecute(gt_P04AttackWavesAir, true, false);

campaigns/liberty.sc2campaignbase.sc2maps/maps/campaign/ttychus04.sc2map/MapScript.galaxy:1658

    libNtve_gf_DeclareNextTown(gv_pLAYER02_PROTOSS, PointFromId(354));
    AINearestTownBullyRebuild(gv_pLAYER02_PROTOSS, true);
    AINearestTownLimitWaveGather(gv_pLAYER02_PROTOSS, true);
    AIToggleBulliesInRegion(gv_pLAYER03_PROTOSS, RegionFromId(2), true);
    TriggerExecute(gt_ProtossP03AttackWaves, true, false);

campaigns/liberty.sc2campaign/base.sc2maps/maps/campaign/thorner04.sc2mapMapScript.galaxy:4084

    libNtve_gf_DeclareNextTown(gv_p02_DOMINION_INFANTRY, UnitGetPosition(UnitFromId(570)));
    AINearestTownBullyRebuild(gv_p02_DOMINION_INFANTRY, true);
    AINearestTownLimitWaveGather(gv_p02_DOMINION_INFANTRY, true);
    TriggerExecute(gt_P03AttackWavesSiege, true, false);
    TriggerExecute(gt_P04AttackWavesAir, true, false);

campaigns/liberty.sc2campaign/base.sc2maps/maps/campaign/ttychus04.sc2mapMapScript.galaxy:1658

    libNtve_gf_DeclareNextTown(gv_pLAYER02_PROTOSS, PointFromId(354));
    AINearestTownBullyRebuild(gv_pLAYER02_PROTOSS, true);
    AINearestTownLimitWaveGather(gv_pLAYER02_PROTOSS, true);
    AIToggleBulliesInRegion(gv_pLAYER03_PROTOSS, RegionFromId(2), true);
    TriggerExecute(gt_ProtossP03AttackWaves, true, false);

campaigns/swarm.sc2campaignbase.sc2maps/maps/campaign/swarm/zlab03.sc2map/MapScript.galaxy:6725

    cai_startall();
    cai_runall();
    AINearestTownLimitWaveGather(gv_pLAYER_03_DOMINION_MAIN, true);
    AINearestTownLimitWaveGather(gv_pLAYER_04_DOMINION_RIGHT, true);
    AINearestTownLimitWaveGather(gv_pLAYER_07_DOMINION_LEFT, true);

campaigns/swarm.sc2campaignbase.sc2maps/maps/campaign/swarm/zlab03.sc2map/MapScript.galaxy:6726

    cai_runall();
    AINearestTownLimitWaveGather(gv_pLAYER_03_DOMINION_MAIN, true);
    AINearestTownLimitWaveGather(gv_pLAYER_04_DOMINION_RIGHT, true);
    AINearestTownLimitWaveGather(gv_pLAYER_07_DOMINION_LEFT, true);
    if ((libHots_gf_DifficultyValueInt2(0, 0, 1) == 1)) {

campaigns/swarm.sc2campaignbase.sc2maps/maps/campaign/swarm/zlab03.sc2map/MapScript.galaxy:6727

    AINearestTownLimitWaveGather(gv_pLAYER_03_DOMINION_MAIN, true);
    AINearestTownLimitWaveGather(gv_pLAYER_04_DOMINION_RIGHT, true);
    AINearestTownLimitWaveGather(gv_pLAYER_07_DOMINION_LEFT, true);
    if ((libHots_gf_DifficultyValueInt2(0, 0, 1) == 1)) {
        TriggerExecute(gt_AIUpgradesHard, true, false);

campaigns/swarm.sc2campaign/base.sc2maps/maps/campaign/swarm/zlab03.sc2mapMapScript.galaxy:6725

    cai_startall();
    cai_runall();
    AINearestTownLimitWaveGather(gv_pLAYER_03_DOMINION_MAIN, true);
    AINearestTownLimitWaveGather(gv_pLAYER_04_DOMINION_RIGHT, true);
    AINearestTownLimitWaveGather(gv_pLAYER_07_DOMINION_LEFT, true);

campaigns/swarm.sc2campaign/base.sc2maps/maps/campaign/swarm/zlab03.sc2mapMapScript.galaxy:6726

    cai_runall();
    AINearestTownLimitWaveGather(gv_pLAYER_03_DOMINION_MAIN, true);
    AINearestTownLimitWaveGather(gv_pLAYER_04_DOMINION_RIGHT, true);
    AINearestTownLimitWaveGather(gv_pLAYER_07_DOMINION_LEFT, true);
    if ((libHots_gf_DifficultyValueInt2(0, 0, 1) == 1)) {

campaigns/swarm.sc2campaign/base.sc2maps/maps/campaign/swarm/zlab03.sc2mapMapScript.galaxy:6727

    AINearestTownLimitWaveGather(gv_pLAYER_03_DOMINION_MAIN, true);
    AINearestTownLimitWaveGather(gv_pLAYER_04_DOMINION_RIGHT, true);
    AINearestTownLimitWaveGather(gv_pLAYER_07_DOMINION_LEFT, true);
    if ((libHots_gf_DifficultyValueInt2(0, 0, 1) == 1)) {
        TriggerExecute(gt_AIUpgradesHard, true, false);

campaigns/void.sc2campaignbase.sc2maps/maps/campaign/void/ppurifier01.sc2map/MapScript.galaxy:3976

    cai_runall();
    libNtve_gf_DeclareNextTown(gv_pLAYER_02_TALDARIM, PointFromId(34));
    AINearestTownLimitWaveGather(gv_pLAYER_02_TALDARIM, true);
    libVCMI_gf_EnableVoidCampaignAIBehaviorForAllPlayers();
    if ((libLotv_gf_DifficultyValueInt2(1, 1, 0, 0) == 1)) {

campaigns/void.sc2campaignbase.sc2maps/maps/campaign/void/sc2epilogue01.sc2map/MapScript.galaxy:4539

    AINearestTownBullyRebuild(gv_pLAYER_07_VOIDFORCES, true);
    AINearestTownBullyRebuild(gv_pLAYER_08_RAYNOREXPANSIONS, true);
    AINearestTownLimitWaveGather(gv_pLAYER_08_RAYNOREXPANSIONS, true);
    AINearestTownBullyRebuild(gv_pLAYER_09_KERRIGANEXPANSIONS, true);
    AINearestTownLimitWaveGather(gv_pLAYER_09_KERRIGANEXPANSIONS, true);

campaigns/void.sc2campaignbase.sc2maps/maps/campaign/void/sc2epilogue01.sc2map/MapScript.galaxy:4541

    AINearestTownLimitWaveGather(gv_pLAYER_08_RAYNOREXPANSIONS, true);
    AINearestTownBullyRebuild(gv_pLAYER_09_KERRIGANEXPANSIONS, true);
    AINearestTownLimitWaveGather(gv_pLAYER_09_KERRIGANEXPANSIONS, true);
    autoA50712A6_g = UnitGroup("VoidRift", gv_pLAYER_05_VOIDFORCES, RegionEntireMap(), UnitFilter(0, 0, (1 << c_targetFilterMissile), (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32))), 0);
    autoA50712A6_u = UnitGroupCount(autoA50712A6_g, c_unitCountAll);

campaigns/void.sc2campaign/base.sc2maps/maps/campaign/void/ppurifier01.sc2mapMapScript.galaxy:3976

    cai_runall();
    libNtve_gf_DeclareNextTown(gv_pLAYER_02_TALDARIM, PointFromId(34));
    AINearestTownLimitWaveGather(gv_pLAYER_02_TALDARIM, true);
    libVCMI_gf_EnableVoidCampaignAIBehaviorForAllPlayers();
    if ((libLotv_gf_DifficultyValueInt2(1, 1, 0, 0) == 1)) {

campaigns/void.sc2campaign/base.sc2maps/maps/campaign/void/sc2epilogue01.sc2mapMapScript.galaxy:4539

    AINearestTownBullyRebuild(gv_pLAYER_07_VOIDFORCES, true);
    AINearestTownBullyRebuild(gv_pLAYER_08_RAYNOREXPANSIONS, true);
    AINearestTownLimitWaveGather(gv_pLAYER_08_RAYNOREXPANSIONS, true);
    AINearestTownBullyRebuild(gv_pLAYER_09_KERRIGANEXPANSIONS, true);
    AINearestTownLimitWaveGather(gv_pLAYER_09_KERRIGANEXPANSIONS, true);

campaigns/void.sc2campaign/base.sc2maps/maps/campaign/void/sc2epilogue01.sc2mapMapScript.galaxy:4541

    AINearestTownLimitWaveGather(gv_pLAYER_08_RAYNOREXPANSIONS, true);
    AINearestTownBullyRebuild(gv_pLAYER_09_KERRIGANEXPANSIONS, true);
    AINearestTownLimitWaveGather(gv_pLAYER_09_KERRIGANEXPANSIONS, true);
    autoA50712A6_g = UnitGroup("VoidRift", gv_pLAYER_05_VOIDFORCES, RegionEntireMap(), UnitFilter(0, 0, (1 << c_targetFilterMissile), (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32))), 0);
    autoA50712A6_u = UnitGroupCount(autoA50712A6_g, c_unitCountAll);