# Set Defense Radii

FlagsNative | Action

Sets the basic defense call for help radii. The threat must attack a building or come within MaxThreateningRange to trigger a defense call for help. Defenders that are within BuildingCallForHelpRange of the building or ThreatCallForHelpRange of the threat will respond. (ie the defender must be near the building or near the threat). By default Melee is (p#, 15.0, 10.0, 12.0) and Campaign is (p#, 6.0, 7.0, 9.0)

# Arguments

  • int — Player
  • fixed — Max Threating Range
  • fixed — Building Call For Help Range
  • fixed — Threat Call For Help Range

Returns — void

native void AISetDefenseRadii(
	int player,
	fixed maxThreatRange,
	fixed buildingCallRange,
	fixed threatCallRange,
);

Category: AI Advanced / Utility / Actions

# Examples

campaigns/swarm.sc2campaignbase.sc2maps/maps/campaign/swarm/zkorhal03.sc2map/MapScript.galaxy:4556

    AISetDifficulty(gv_PLAYER_07_DOMINION_GREEN22, c_diffAutoLoadBunkers, true);
    AISetDifficulty(gv_PLAYER_07_DOMINION_GREEN22, c_diffRepairDamage, true);
    AISetDefenseRadii(gv_PLAYER_07_DOMINION_GREEN22, 10.0, 50.0, 50.0);
    if ((libHots_gf_DifficultyValueInt2(1, 1, 0) == 1)) {
        TriggerExecute(gt_StartUpgradesNormal, true, false);

campaigns/swarm.sc2campaign/base.sc2maps/maps/campaign/swarm/zkorhal03.sc2mapMapScript.galaxy:4556

    AISetDifficulty(gv_PLAYER_07_DOMINION_GREEN22, c_diffAutoLoadBunkers, true);
    AISetDifficulty(gv_PLAYER_07_DOMINION_GREEN22, c_diffRepairDamage, true);
    AISetDefenseRadii(gv_PLAYER_07_DOMINION_GREEN22, 10.0, 50.0, 50.0);
    if ((libHots_gf_DifficultyValueInt2(1, 1, 0) == 1)) {
        TriggerExecute(gt_StartUpgradesNormal, true, false);

campaigns/void.sc2campaignbase.sc2maps/maps/campaign/void/paiur06.sc2map/MapScript.galaxy:2724

    libVCMI_gf_EnableVoidCampaignAIBehaviorForAllPlayers();
    cai_runall();
    AISetDefenseRadii(1, 15.0, 10.0, 12.0);
    if ((libLotv_gf_DifficultyValueInt2(1, 1, 0, 0) == 1)) {
        TriggerExecute(gt_AIUpgradesCasualNormal, true, false);

campaigns/void.sc2campaignbase.sc2maps/maps/campaign/void/paiur06.sc2map/MapScript.galaxy:2739

    libNtve_gf_SetTacticalAIThink(gv_pLAYER_08_NERAZIM, "VorazunChampion", "AIVorazun", false);
    libNtve_gf_SetTacticalAIThink(gv_pLAYER_09_PURIFIER, "KaraxChampion", "AIKarax", false);
    AISetDefenseRadii(gv_pLAYER_07_TALDARIM, 6.0, 10.0, 12.0);
    AISetDefenseRadii(gv_pLAYER_08_NERAZIM, 6.0, 10.0, 12.0);
    AISetDefenseRadii(gv_pLAYER_09_PURIFIER, 6.0, 10.0, 12.0);

campaigns/void.sc2campaignbase.sc2maps/maps/campaign/void/paiur06.sc2map/MapScript.galaxy:2740

    libNtve_gf_SetTacticalAIThink(gv_pLAYER_09_PURIFIER, "KaraxChampion", "AIKarax", false);
    AISetDefenseRadii(gv_pLAYER_07_TALDARIM, 6.0, 10.0, 12.0);
    AISetDefenseRadii(gv_pLAYER_08_NERAZIM, 6.0, 10.0, 12.0);
    AISetDefenseRadii(gv_pLAYER_09_PURIFIER, 6.0, 10.0, 12.0);
    TriggerExecute(gt_TurnOnBulliesOverTime, true, false);

campaigns/void.sc2campaignbase.sc2maps/maps/campaign/void/paiur06.sc2map/MapScript.galaxy:2741

    AISetDefenseRadii(gv_pLAYER_07_TALDARIM, 6.0, 10.0, 12.0);
    AISetDefenseRadii(gv_pLAYER_08_NERAZIM, 6.0, 10.0, 12.0);
    AISetDefenseRadii(gv_pLAYER_09_PURIFIER, 6.0, 10.0, 12.0);
    TriggerExecute(gt_TurnOnBulliesOverTime, true, false);
    return true;

campaigns/void.sc2campaignbase.sc2maps/maps/campaign/void/ptaldarim01.sc2map/MapScript.galaxy:3634

    libVCMI_gf_EnableVoidCampaignAIBehaviorForAllPlayers();
    cai_runall();
    AISetDefenseRadii(gv_pLAYER_02_TAL_NORTH, 6.0, 6.0, 6.0);
    autoDADEFEC8_g = gv_ascendantGroup;
    autoDADEFEC8_u = UnitGroupCount(autoDADEFEC8_g, c_unitCountAll);

campaigns/void.sc2campaign/base.sc2maps/maps/campaign/void/paiur06.sc2mapMapScript.galaxy:2724

    libVCMI_gf_EnableVoidCampaignAIBehaviorForAllPlayers();
    cai_runall();
    AISetDefenseRadii(1, 15.0, 10.0, 12.0);
    if ((libLotv_gf_DifficultyValueInt2(1, 1, 0, 0) == 1)) {
        TriggerExecute(gt_AIUpgradesCasualNormal, true, false);

campaigns/void.sc2campaign/base.sc2maps/maps/campaign/void/paiur06.sc2mapMapScript.galaxy:2739

    libNtve_gf_SetTacticalAIThink(gv_pLAYER_08_NERAZIM, "VorazunChampion", "AIVorazun", false);
    libNtve_gf_SetTacticalAIThink(gv_pLAYER_09_PURIFIER, "KaraxChampion", "AIKarax", false);
    AISetDefenseRadii(gv_pLAYER_07_TALDARIM, 6.0, 10.0, 12.0);
    AISetDefenseRadii(gv_pLAYER_08_NERAZIM, 6.0, 10.0, 12.0);
    AISetDefenseRadii(gv_pLAYER_09_PURIFIER, 6.0, 10.0, 12.0);

campaigns/void.sc2campaign/base.sc2maps/maps/campaign/void/paiur06.sc2mapMapScript.galaxy:2740

    libNtve_gf_SetTacticalAIThink(gv_pLAYER_09_PURIFIER, "KaraxChampion", "AIKarax", false);
    AISetDefenseRadii(gv_pLAYER_07_TALDARIM, 6.0, 10.0, 12.0);
    AISetDefenseRadii(gv_pLAYER_08_NERAZIM, 6.0, 10.0, 12.0);
    AISetDefenseRadii(gv_pLAYER_09_PURIFIER, 6.0, 10.0, 12.0);
    TriggerExecute(gt_TurnOnBulliesOverTime, true, false);

campaigns/void.sc2campaign/base.sc2maps/maps/campaign/void/paiur06.sc2mapMapScript.galaxy:2741

    AISetDefenseRadii(gv_pLAYER_07_TALDARIM, 6.0, 10.0, 12.0);
    AISetDefenseRadii(gv_pLAYER_08_NERAZIM, 6.0, 10.0, 12.0);
    AISetDefenseRadii(gv_pLAYER_09_PURIFIER, 6.0, 10.0, 12.0);
    TriggerExecute(gt_TurnOnBulliesOverTime, true, false);
    return true;

campaigns/void.sc2campaign/base.sc2maps/maps/campaign/void/ptaldarim01.sc2mapMapScript.galaxy:3634

    libVCMI_gf_EnableVoidCampaignAIBehaviorForAllPlayers();
    cai_runall();
    AISetDefenseRadii(gv_pLAYER_02_TAL_NORTH, 6.0, 6.0, 6.0);
    autoDADEFEC8_g = gv_ascendantGroup;
    autoDADEFEC8_u = UnitGroupCount(autoDADEFEC8_g, c_unitCountAll);

mods/core.sc2modbase.sc2data/TriggerLibs/BaseAI.galaxy:194

    AITransportSetReturn(player, targDPoint);

    AISetDefenseRadii(player, 15.0, 10.0, 12.0);

    AISetNumScouts(player, 1);

mods/core.sc2modbase.sc2data/TriggerLibs/BaseAI.galaxy:304

    AITransportSetReturn(player, PlayerStartLocation(player));

    AISetDefenseRadii(player, 6.0, 7.0, 9.0);

    AIReqCountAsBuiltObject(player, "Larva");

mods/starcoop/starcoop.sc2modbase.sc2data/TriggerLibs/BaseAI.galaxy:229

    AITransportSetReturn(player, targDPoint);

    AISetDefenseRadii(player, 15.0, 10.0, 12.0);

    AISetNumScouts(player, 0);

mods/starcoop/starcoop.sc2modbase.sc2data/TriggerLibs/BaseAI.galaxy:350

    AITransportSetReturn(player, PlayerStartLocation(player));

    AISetDefenseRadii(player, 6.0, 7.0, 9.0);

    AIReqCountAsBuiltObject(player, "Larva");