# Set Target UnitGroup For Attack Waves

Grammar — Set the target for player player attack waves to unitGroup
FlagsNative | Action

Sets a unit group to be the target of a player’s attack waves.

# Arguments

  • int — Attacker
  • unitgroup — UnitGroup

Returns — void

native void AIAttackWaveSetTargetUnitGroup(
	int player,
	unitgroup ug,
);

Category: AI / AttackWaves / Actions

# Examples

campaigns/liberty.sc2campaignbase.sc2maps/maps/campaign/thanson01.sc2map/MapScript.galaxy:1815


    CampaignInitAI();
    AIAttackWaveSetTargetUnitGroup(gv_p2_ZERG_ORANGE_NW, gv_colonistsOnTheMove);
    AIAttackWaveSetTargetUnitGroup(gv_p3_ZERG_LIGHTBLUE_SE, gv_colonistsOnTheMove);
    AIAttackWaveSetGatherPoint(gv_p2_ZERG_ORANGE_NW, PointFromId(2714));

campaigns/liberty.sc2campaignbase.sc2maps/maps/campaign/thanson01.sc2map/MapScript.galaxy:1816

    CampaignInitAI();
    AIAttackWaveSetTargetUnitGroup(gv_p2_ZERG_ORANGE_NW, gv_colonistsOnTheMove);
    AIAttackWaveSetTargetUnitGroup(gv_p3_ZERG_LIGHTBLUE_SE, gv_colonistsOnTheMove);
    AIAttackWaveSetGatherPoint(gv_p2_ZERG_ORANGE_NW, PointFromId(2714));
    AIAttackWaveSetGatherPoint(gv_p3_ZERG_LIGHTBLUE_SE, PointFromId(2715));

campaigns/liberty.sc2campaignbase.sc2maps/maps/campaign/thorner05s.sc2map/MapScript.galaxy:9665

    AICampaignStart(gv_p09_NEUTRAL_ATTACK);
    Wait(0.2, c_timeGame);
    AIAttackWaveSetTargetUnitGroup(gv_p09_NEUTRAL_ATTACK, gv_hybridUnitGroup);
    AIAttackWaveSetGatherPoint(gv_p09_NEUTRAL_ATTACK, UnitGetPosition(gv_escapeWarbot));
    AIAttackWaveUseUnit(gv_p04_HYBRID, gv_escapeWarbot);

campaigns/liberty.sc2campaignbase.sc2maps/maps/campaign/thorner05s.sc2map/MapScript.galaxy:9707

    }

    AIAttackWaveSetTargetUnitGroup(gv_p04_HYBRID, gv_playerGroupforAI);
    AIAttackWaveSetGatherPoint(gv_p04_HYBRID, UnitGetPosition(gv_hybrid));
    AIAttackWaveUseUnit(gv_p04_HYBRID, gv_hybrid);

campaigns/liberty.sc2campaignbase.sc2maps/maps/challenges/protosspsionics.sc2map/MapScript.galaxy:873


    AICampaignStart(gv_pLAYER_COMPUTER1);
    AIAttackWaveSetTargetUnitGroup(gv_pLAYER_COMPUTER1, gv_playerUnits);
    TriggerEnable(gt_RocksDestroyed, true);
    IntLoopBegin(1, 14);

campaigns/liberty.sc2campaign/base.sc2maps/maps/campaign/thanson01.sc2mapMapScript.galaxy:1815


    CampaignInitAI();
    AIAttackWaveSetTargetUnitGroup(gv_p2_ZERG_ORANGE_NW, gv_colonistsOnTheMove);
    AIAttackWaveSetTargetUnitGroup(gv_p3_ZERG_LIGHTBLUE_SE, gv_colonistsOnTheMove);
    AIAttackWaveSetGatherPoint(gv_p2_ZERG_ORANGE_NW, PointFromId(2714));

campaigns/liberty.sc2campaign/base.sc2maps/maps/campaign/thanson01.sc2mapMapScript.galaxy:1816

    CampaignInitAI();
    AIAttackWaveSetTargetUnitGroup(gv_p2_ZERG_ORANGE_NW, gv_colonistsOnTheMove);
    AIAttackWaveSetTargetUnitGroup(gv_p3_ZERG_LIGHTBLUE_SE, gv_colonistsOnTheMove);
    AIAttackWaveSetGatherPoint(gv_p2_ZERG_ORANGE_NW, PointFromId(2714));
    AIAttackWaveSetGatherPoint(gv_p3_ZERG_LIGHTBLUE_SE, PointFromId(2715));

campaigns/liberty.sc2campaign/base.sc2maps/maps/campaign/thorner05s.sc2mapMapScript.galaxy:9665

    AICampaignStart(gv_p09_NEUTRAL_ATTACK);
    Wait(0.2, c_timeGame);
    AIAttackWaveSetTargetUnitGroup(gv_p09_NEUTRAL_ATTACK, gv_hybridUnitGroup);
    AIAttackWaveSetGatherPoint(gv_p09_NEUTRAL_ATTACK, UnitGetPosition(gv_escapeWarbot));
    AIAttackWaveUseUnit(gv_p04_HYBRID, gv_escapeWarbot);

campaigns/liberty.sc2campaign/base.sc2maps/maps/campaign/thorner05s.sc2mapMapScript.galaxy:9707

    }

    AIAttackWaveSetTargetUnitGroup(gv_p04_HYBRID, gv_playerGroupforAI);
    AIAttackWaveSetGatherPoint(gv_p04_HYBRID, UnitGetPosition(gv_hybrid));
    AIAttackWaveUseUnit(gv_p04_HYBRID, gv_hybrid);

campaigns/liberty.sc2campaign/base.sc2maps/maps/challenges/protosspsionics.sc2mapMapScript.galaxy:873


    AICampaignStart(gv_pLAYER_COMPUTER1);
    AIAttackWaveSetTargetUnitGroup(gv_pLAYER_COMPUTER1, gv_playerUnits);
    TriggerEnable(gt_RocksDestroyed, true);
    IntLoopBegin(1, 14);

campaigns/swarm.sc2campaignbase.sc2maps/maps/campaign/swarm/zexpedition03.sc2map/MapScript.galaxy:580

        AISetUnitScriptControlled(auto8A204714_var, false);
    }
    AIAttackWaveSetTargetUnitGroup(gv_pLAYER_02_ZERG, UnitGroup(null, gv_pLAYER_01_USER, RegionPlayableMap(), UnitFilter(0, 0, (1 << c_targetFilterMissile), (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32))), 0));
    AIAttackWaveSend(gv_pLAYER_02_ZERG, 0, false);
    return true;

campaigns/swarm.sc2campaignbase.sc2maps/maps/campaign/swarm/zexpedition03.sc2map/MapScript.galaxy:3273

    AISetUnitScriptControlled(lv_zealot01, false);
    AIAttackWaveUseUnit(gv_pLAYER_02_ZERG, lv_zealot01);
    AIAttackWaveSetTargetUnitGroup(gv_pLAYER_02_ZERG, UnitGroup(null, gv_pLAYER_01_USER, RegionPlayableMap(), UnitFilter(0, 0, (1 << c_targetFilterMissile), (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32))), 0));
    AIAttackWaveSend(gv_pLAYER_02_ZERG, 0, false);
    return true;

campaigns/swarm.sc2campaignbase.sc2maps/maps/campaign/swarm/zexpedition03.sc2map/MapScript.galaxy:4109

        AIAttackWaveUseUnit(gv_pLAYER_02_ZERG, auto8673C225_var);
    }
    AIAttackWaveSetTargetUnitGroup(gv_pLAYER_02_ZERG, UnitGroup(null, gv_pLAYER_01_USER, RegionPlayableMap(), UnitFilter(0, 0, (1 << c_targetFilterMissile), (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32))), 0));
    AIAttackWaveSend(gv_pLAYER_02_ZERG, 0, false);
    Wait(24.0, c_timeGame);

campaigns/swarm.sc2campaignbase.sc2maps/maps/campaign/swarm/zexpedition03.sc2map/MapScript.galaxy:4124

        AIAttackWaveUseUnit(gv_pLAYER_02_ZERG, autoC398C246_var);
    }
    AIAttackWaveSetTargetUnitGroup(gv_pLAYER_02_ZERG, UnitGroup(null, gv_pLAYER_01_USER, RegionPlayableMap(), UnitFilter(0, 0, (1 << c_targetFilterMissile), (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32))), 0));
    AIAttackWaveSend(gv_pLAYER_02_ZERG, 0, false);
    Wait(16.0, c_timeGame);

campaigns/swarm.sc2campaignbase.sc2maps/maps/campaign/swarm/zexpedition03.sc2map/MapScript.galaxy:4139

        AIAttackWaveUseUnit(gv_pLAYER_02_ZERG, auto1F4283D7_var);
    }
    AIAttackWaveSetTargetUnitGroup(gv_pLAYER_02_ZERG, UnitGroup(null, gv_pLAYER_01_USER, RegionPlayableMap(), UnitFilter(0, 0, (1 << c_targetFilterMissile), (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32))), 0));
    AIAttackWaveSend(gv_pLAYER_02_ZERG, 0, false);
    Wait(16.0, c_timeGame);

campaigns/swarm.sc2campaignbase.sc2maps/maps/campaign/swarm/zexpedition03.sc2map/MapScript.galaxy:4154

        AIAttackWaveUseUnit(gv_pLAYER_02_ZERG, autoEBA732BE_var);
    }
    AIAttackWaveSetTargetUnitGroup(gv_pLAYER_02_ZERG, UnitGroup(null, gv_pLAYER_01_USER, RegionPlayableMap(), UnitFilter(0, 0, (1 << c_targetFilterMissile), (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32))), 0));
    AIAttackWaveSend(gv_pLAYER_02_ZERG, 0, false);
    return true;

campaigns/swarm.sc2campaignbase.sc2maps/maps/campaign/swarm/zexpedition03.sc2map/MapScript.galaxy:6211

        AIAttackWaveUseUnit(gv_pLAYER_02_ZERG, autoB222EDC9_var);
    }
    AIAttackWaveSetTargetUnitGroup(gv_pLAYER_02_ZERG, UnitGroup(null, gv_pLAYER_01_USER, RegionPlayableMap(), UnitFilter(0, 0, (1 << c_targetFilterMissile), (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32))), 0));
    AIAttackWaveSend(gv_pLAYER_02_ZERG, 0, true);
    return true;

campaigns/swarm.sc2campaignbase.sc2maps/maps/campaign/swarm/zexpedition03.sc2map/MapScript.galaxy:6271

        AIAttackWaveUseUnit(gv_pLAYER_02_ZERG, auto56424322_var);
    }
    AIAttackWaveSetTargetUnitGroup(gv_pLAYER_02_ZERG, UnitGroup(null, gv_pLAYER_01_USER, RegionPlayableMap(), UnitFilter(0, 0, (1 << c_targetFilterMissile), (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32))), 0));
    AIAttackWaveSend(gv_pLAYER_02_ZERG, 0, true);
    return true;

campaigns/swarm.sc2campaignbase.sc2maps/maps/campaign/swarm/zexpedition03.sc2map/MapScript.galaxy:6319

        AIAttackWaveUseUnit(gv_pLAYER_02_ZERG, auto84912346_var);
    }
    AIAttackWaveSetTargetUnitGroup(gv_pLAYER_02_ZERG, UnitGroup(null, gv_pLAYER_01_USER, RegionPlayableMap(), UnitFilter(0, 0, (1 << c_targetFilterMissile), (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32))), 0));
    AIAttackWaveSend(gv_pLAYER_02_ZERG, 0, true);
    return true;

campaigns/swarm.sc2campaignbase.sc2maps/maps/campaign/swarm/zexpedition03.sc2map/MapScript.galaxy:6440

        AIAttackWaveUseUnit(gv_pLAYER_02_ZERG, auto6DFDDD01_var);
    }
    AIAttackWaveSetTargetUnitGroup(gv_pLAYER_02_ZERG, UnitGroup(null, gv_pLAYER_01_USER, RegionPlayableMap(), UnitFilter(0, 0, (1 << c_targetFilterMissile), (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32))), 0));
    AIAttackWaveSend(gv_pLAYER_02_ZERG, 0, true);
    return true;

campaigns/swarm.sc2campaignbase.sc2maps/maps/campaign/swarm/zhybrid01.sc2map/MapScript.galaxy:2968

                            libNtve_gf_CreateUnitsWithDefaultFacing(1, "InfestedCivilian", 0, gv_pLAYER_06_INFESTED, libNtve_gf_PointOffsetTowardsPoint(UnitGetPosition(autoE2EEC058_var), 0.5, PointFromId(4)));
                        }
                        AIAttackWaveSetTargetUnitGroup(gv_pLAYER_06_INFESTED, gv_sneakAttackTerranBase);
                        AIAttackWaveAddUnits3(4, 4, 3, "InfestedCivilian");
                        AIAttackWaveSend(gv_pLAYER_06_INFESTED, 0, true);

campaigns/swarm.sc2campaign/base.sc2maps/maps/campaign/swarm/zexpedition03.sc2mapMapScript.galaxy:580

        AISetUnitScriptControlled(auto8A204714_var, false);
    }
    AIAttackWaveSetTargetUnitGroup(gv_pLAYER_02_ZERG, UnitGroup(null, gv_pLAYER_01_USER, RegionPlayableMap(), UnitFilter(0, 0, (1 << c_targetFilterMissile), (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32))), 0));
    AIAttackWaveSend(gv_pLAYER_02_ZERG, 0, false);
    return true;

campaigns/swarm.sc2campaign/base.sc2maps/maps/campaign/swarm/zexpedition03.sc2mapMapScript.galaxy:3273

    AISetUnitScriptControlled(lv_zealot01, false);
    AIAttackWaveUseUnit(gv_pLAYER_02_ZERG, lv_zealot01);
    AIAttackWaveSetTargetUnitGroup(gv_pLAYER_02_ZERG, UnitGroup(null, gv_pLAYER_01_USER, RegionPlayableMap(), UnitFilter(0, 0, (1 << c_targetFilterMissile), (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32))), 0));
    AIAttackWaveSend(gv_pLAYER_02_ZERG, 0, false);
    return true;

campaigns/swarm.sc2campaign/base.sc2maps/maps/campaign/swarm/zexpedition03.sc2mapMapScript.galaxy:4109

        AIAttackWaveUseUnit(gv_pLAYER_02_ZERG, auto8673C225_var);
    }
    AIAttackWaveSetTargetUnitGroup(gv_pLAYER_02_ZERG, UnitGroup(null, gv_pLAYER_01_USER, RegionPlayableMap(), UnitFilter(0, 0, (1 << c_targetFilterMissile), (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32))), 0));
    AIAttackWaveSend(gv_pLAYER_02_ZERG, 0, false);
    Wait(24.0, c_timeGame);

campaigns/swarm.sc2campaign/base.sc2maps/maps/campaign/swarm/zexpedition03.sc2mapMapScript.galaxy:4124

        AIAttackWaveUseUnit(gv_pLAYER_02_ZERG, autoC398C246_var);
    }
    AIAttackWaveSetTargetUnitGroup(gv_pLAYER_02_ZERG, UnitGroup(null, gv_pLAYER_01_USER, RegionPlayableMap(), UnitFilter(0, 0, (1 << c_targetFilterMissile), (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32))), 0));
    AIAttackWaveSend(gv_pLAYER_02_ZERG, 0, false);
    Wait(16.0, c_timeGame);

campaigns/swarm.sc2campaign/base.sc2maps/maps/campaign/swarm/zexpedition03.sc2mapMapScript.galaxy:4139

        AIAttackWaveUseUnit(gv_pLAYER_02_ZERG, auto1F4283D7_var);
    }
    AIAttackWaveSetTargetUnitGroup(gv_pLAYER_02_ZERG, UnitGroup(null, gv_pLAYER_01_USER, RegionPlayableMap(), UnitFilter(0, 0, (1 << c_targetFilterMissile), (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32))), 0));
    AIAttackWaveSend(gv_pLAYER_02_ZERG, 0, false);
    Wait(16.0, c_timeGame);

campaigns/swarm.sc2campaign/base.sc2maps/maps/campaign/swarm/zexpedition03.sc2mapMapScript.galaxy:4154

        AIAttackWaveUseUnit(gv_pLAYER_02_ZERG, autoEBA732BE_var);
    }
    AIAttackWaveSetTargetUnitGroup(gv_pLAYER_02_ZERG, UnitGroup(null, gv_pLAYER_01_USER, RegionPlayableMap(), UnitFilter(0, 0, (1 << c_targetFilterMissile), (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32))), 0));
    AIAttackWaveSend(gv_pLAYER_02_ZERG, 0, false);
    return true;

campaigns/swarm.sc2campaign/base.sc2maps/maps/campaign/swarm/zexpedition03.sc2mapMapScript.galaxy:6211

        AIAttackWaveUseUnit(gv_pLAYER_02_ZERG, autoB222EDC9_var);
    }
    AIAttackWaveSetTargetUnitGroup(gv_pLAYER_02_ZERG, UnitGroup(null, gv_pLAYER_01_USER, RegionPlayableMap(), UnitFilter(0, 0, (1 << c_targetFilterMissile), (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32))), 0));
    AIAttackWaveSend(gv_pLAYER_02_ZERG, 0, true);
    return true;

campaigns/swarm.sc2campaign/base.sc2maps/maps/campaign/swarm/zexpedition03.sc2mapMapScript.galaxy:6271

        AIAttackWaveUseUnit(gv_pLAYER_02_ZERG, auto56424322_var);
    }
    AIAttackWaveSetTargetUnitGroup(gv_pLAYER_02_ZERG, UnitGroup(null, gv_pLAYER_01_USER, RegionPlayableMap(), UnitFilter(0, 0, (1 << c_targetFilterMissile), (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32))), 0));
    AIAttackWaveSend(gv_pLAYER_02_ZERG, 0, true);
    return true;

campaigns/swarm.sc2campaign/base.sc2maps/maps/campaign/swarm/zexpedition03.sc2mapMapScript.galaxy:6319

        AIAttackWaveUseUnit(gv_pLAYER_02_ZERG, auto84912346_var);
    }
    AIAttackWaveSetTargetUnitGroup(gv_pLAYER_02_ZERG, UnitGroup(null, gv_pLAYER_01_USER, RegionPlayableMap(), UnitFilter(0, 0, (1 << c_targetFilterMissile), (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32))), 0));
    AIAttackWaveSend(gv_pLAYER_02_ZERG, 0, true);
    return true;

campaigns/swarm.sc2campaign/base.sc2maps/maps/campaign/swarm/zexpedition03.sc2mapMapScript.galaxy:6440

        AIAttackWaveUseUnit(gv_pLAYER_02_ZERG, auto6DFDDD01_var);
    }
    AIAttackWaveSetTargetUnitGroup(gv_pLAYER_02_ZERG, UnitGroup(null, gv_pLAYER_01_USER, RegionPlayableMap(), UnitFilter(0, 0, (1 << c_targetFilterMissile), (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32))), 0));
    AIAttackWaveSend(gv_pLAYER_02_ZERG, 0, true);
    return true;

campaigns/swarm.sc2campaign/base.sc2maps/maps/campaign/swarm/zhybrid01.sc2mapMapScript.galaxy:2968

                            libNtve_gf_CreateUnitsWithDefaultFacing(1, "InfestedCivilian", 0, gv_pLAYER_06_INFESTED, libNtve_gf_PointOffsetTowardsPoint(UnitGetPosition(autoE2EEC058_var), 0.5, PointFromId(4)));
                        }
                        AIAttackWaveSetTargetUnitGroup(gv_pLAYER_06_INFESTED, gv_sneakAttackTerranBase);
                        AIAttackWaveAddUnits3(4, 4, 3, "InfestedCivilian");
                        AIAttackWaveSend(gv_pLAYER_06_INFESTED, 0, true);