# UnitGroupFilterThreat

FlagsNative

# Arguments

  • unitgroup — g
  • unit — u
  • string — alternateType
  • int — maxCount

Returns — unitgroup

native unitgroup UnitGroupFilterThreat(
	unitgroup g,
	unit u,
	string alternateType,
	int maxCount,
);

Category: Unclassified

# Examples

campaigns/liberty.sc2campaignbase.sc2data/TriggerLibs/Tactical/TactCampAI.galaxy:57


    // Is there a threat in the area
    threatGroup = UnitGroupFilterThreat(scanGroup, aiUnit, null, 0);
    numPossibleThreats = UnitGroupCount(threatGroup, c_unitCountAll);
    while (numPossibleThreats > 0) {

campaigns/liberty.sc2campaignbase.sc2data/TriggerLibs/Tactical/TactCampAI.galaxy:84


    barrageGroup = UnitGroup(null, c_playerAny, RegionCircle(loc, barrageRadius), null, 0);
    barrageThreatGroup = UnitGroupFilterThreat(barrageGroup, aiUnit, null, 0);
    numPossibleThreatsInBarrage = UnitGroupCount(barrageThreatGroup, c_unitCountAll);
    while (numPossibleThreatsInBarrage > 0) {

campaigns/liberty.sc2campaignbase.sc2data/TriggerLibs/Tactical/TactCampAI.galaxy:167

    }
    
    enemyGroup = UnitGroupFilterThreat(scanGroup, aiUnit, null, 0);
    enemyGroup = UnitGroupFilterPlane(scanGroup, c_planeGround, 0);
    if (UnitGroupCount(enemyGroup, c_unitCountAlive) <= 0) {

campaigns/swarm.sc2campaignbase.sc2data/TriggerLibs/Tactical/TactCampAI.galaxy:57


    // Is there a threat in the area
    threatGroup = UnitGroupFilterThreat(scanGroup, aiUnit, null, 0);
    numPossibleThreats = UnitGroupCount(threatGroup, c_unitCountAll);
    while (numPossibleThreats > 0) {

campaigns/swarm.sc2campaignbase.sc2data/TriggerLibs/Tactical/TactCampAI.galaxy:84


    barrageGroup = UnitGroup(null, c_playerAny, RegionCircle(loc, barrageRadius), null, 0);
    barrageThreatGroup = UnitGroupFilterThreat(barrageGroup, aiUnit, null, 0);
    numPossibleThreatsInBarrage = UnitGroupCount(barrageThreatGroup, c_unitCountAll);
    while (numPossibleThreatsInBarrage > 0) {

campaigns/swarm.sc2campaignbase.sc2data/TriggerLibs/Tactical/TactCampAI.galaxy:167

    }
    
    enemyGroup = UnitGroupFilterThreat(scanGroup, aiUnit, null, 0);
    enemyGroup = UnitGroupFilterPlane(scanGroup, c_planeGround, 0);
    if (UnitGroupCount(enemyGroup, c_unitCountAlive) <= 0) {

campaigns/void.sc2campaignbase.sc2data/TriggerLibs/Tactical/TactCampAI.galaxy:167

    }
    
    enemyGroup = UnitGroupFilterThreat(scanGroup, aiUnit, null, 0);
    enemyGroup = UnitGroupFilterPlane(scanGroup, c_planeGround, 0);
    if (UnitGroupCount(enemyGroup, c_unitCountAlive) <= 0) {

mods/core.sc2modbase.sc2data/TriggerLibs/Tactical/TactTerrAI.galaxy:662

        //  Also, go to air mode when a pack of new air units shows up and we have killed most of the
        //  ground units.
        targetGroupAirThreatToGround = UnitGroupFilterThreat(targetGroupAir, aiUnit, null, 0);
        inAirThreatToGroundCount = UnitGroupCount(targetGroupAirThreatToGround, c_unitCountAlive);

mods/starcoop/starcoop.sc2modbase.sc2data/TriggerLibs/Tactical/TactCampAI.galaxy:407


    // Is there a threat in the area
    threatGroup = UnitGroupFilterThreat(scanGroup, aiUnit, null, 0);
    numPossibleThreats = UnitGroupCount(threatGroup, c_unitCountAll);
    while (numPossibleThreats > 0) {

mods/starcoop/starcoop.sc2modbase.sc2data/TriggerLibs/Tactical/TactCampAI.galaxy:434


    barrageGroup = UnitGroup(null, c_playerAny, RegionCircle(loc, barrageRadius), null, 0);
    barrageThreatGroup = UnitGroupFilterThreat(barrageGroup, aiUnit, null, 0);
    numPossibleThreatsInBarrage = UnitGroupCount(barrageThreatGroup, c_unitCountAll);
    while (numPossibleThreatsInBarrage > 0) {

mods/starcoop/starcoop.sc2modbase.sc2data/TriggerLibs/Tactical/TactCampAI.galaxy:517

    }
    
    enemyGroup = UnitGroupFilterThreat(scanGroup, aiUnit, null, 0);
    enemyGroup = UnitGroupFilterPlane(scanGroup, c_planeGround, 0);
    if (UnitGroupCount(enemyGroup, c_unitCountAlive) <= 0) {

mods/starcoop/starcoop.sc2modbase.sc2data/TriggerLibs/Tactical/TactCampAI.galaxy:1193


    // Is there a threat in the area
    threatGroup = UnitGroupFilterThreat(scanGroup, aiUnit, null, 0);
    numPossibleThreats = UnitGroupCount(threatGroup, c_unitCountAll);
    while (numPossibleThreats > 0) {

mods/starcoop/starcoop.sc2modbase.sc2data/TriggerLibs/Tactical/TactCampAI.galaxy:1220


    barrageGroup = UnitGroup(null, c_playerAny, RegionCircle(loc, barrageRadius), null, 0);
    barrageThreatGroup = UnitGroupFilterThreat(barrageGroup, aiUnit, null, 0);
    numPossibleThreatsInBarrage = UnitGroupCount(barrageThreatGroup, c_unitCountAll);
    while (numPossibleThreatsInBarrage > 0) {

mods/starcoop/starcoop.sc2modbase.sc2data/TriggerLibs/Tactical/TactCampAI.galaxy:1475


    // Is there a threat in the area
    threatGroup = UnitGroupFilterThreat(scanGroup, aiUnit, null, 0);
    numPossibleThreats = UnitGroupCount(threatGroup, c_unitCountAll);
    while (numPossibleThreats > 0) {

mods/starcoop/starcoop.sc2modbase.sc2data/TriggerLibs/Tactical/TactCampAI.galaxy:1502


    barrageGroup = UnitGroup(null, c_playerAny, RegionCircle(loc, barrageRadius), null, 0);
    barrageThreatGroup = UnitGroupFilterThreat(barrageGroup, aiUnit, null, 0);
    numPossibleThreatsInBarrage = UnitGroupCount(barrageThreatGroup, c_unitCountAll);
    while (numPossibleThreatsInBarrage > 0) {

mods/starcoop/starcoop.sc2modbase.sc2data/TriggerLibs/Tactical/TactTerrAI.galaxy:638

        //  Also, go to air mode when a pack of new air units shows up and we have killed most of the
        //  ground units.
        targetGroupAirThreatToGround = UnitGroupFilterThreat(targetGroupAir, aiUnit, null, 0);
        inAirThreatToGroundCount = UnitGroupCount(targetGroupAirThreatToGround, c_unitCountAlive);