# Tactical AI Filter Life
Grammar — Tactical AI Filter - remove units from filter that have less than min or more than max life
Flags —Native
|Action
Sets the specified AI Filter to only include units whose life is within the specified range. Use this and the other “Tactical AI Filter” actions to set up an AI Filter, which can then be used in a “Tactical AI Filter - Run” function to filter a unit group.
# Arguments
aifilter
— Filterfixed
— Minfixed
— Max
Returns — void
native void AISetFilterLife(
aifilter filter,
fixed min,
fixed max,
);
# Related
Category: AI Advanced / Filters / Actions
- Tactical AI Filter Alliance —
void
— AISetFilterAlliance - Tactical AI Filter Markers —
void
— AISetFilterMarker - Tactical AI Filter Remove Self —
void
— AISetFilterSelf - Tactical AI Filter Range —
void
— AISetFilterRange - Tactical AI Filter In Combat —
void
— AISetFilterInCombat - Tactical AI Filter Melee —
void
— AISetFilterMelee - Tactical AI Filter Life —
void
— AISetFilterLife - Tactical AI Filter Life Lost —
void
— AISetFilterLifeLost - Tactical AI Filter Life Sort Reference —
void
— AISetFilterLifeSortReference - Tactical AI Filter Life Modifier —
void
— AISetFilterLifeMod - Tactical AI Filter Life Per Marker —
void
— AISetFilterLifePerMarker - Tactical AI Filter Movement Plane —
void
— AISetFilterPlane - Tactical AI Filter Unit Filter —
void
— AISetFilterBits - Tactical AI Filter Shields —
void
— AISetFilterShields - Tactical AI Filter Energy —
void
— AISetFilterEnergy
# Examples
campaigns/liberty.sc2campaign — base.sc2data/TriggerLibs/Tactical/TactCampAI.galaxy:612
filter = AIFilter(player);
AISetFilterBits(filter, UnitFilterStr(AIAbilityStr(player, c_AB_GravitonPrison, c_fieldFilters)));
AISetFilterLife(filter, c_noMin, c_noMax);
// Check for air allies.
campaigns/liberty.sc2campaign — base.sc2data/TriggerLibs/Tactical/TactCampAI.galaxy:668
if (AICampSkirDiffTest(player, c_campExpert, c_skirVeryHard)) {
damage = AIEffectFixed(player, c_EF_PlasmaBlastDamage, c_fieldAmount);
AISetFilterLife(filter, damage*c_minDamageFraction, c_noMax);
AISetFilterLifeSortReference(filter, damage, damage*c_distanceFromDamage);
campaigns/swarm.sc2campaign — base.sc2data/TriggerLibs/Tactical/TactCampAI.galaxy:612
filter = AIFilter(player);
AISetFilterBits(filter, UnitFilterStr(AIAbilityStr(player, c_AB_GravitonPrison, c_fieldFilters)));
AISetFilterLife(filter, c_noMin, c_noMax);
// Check for air allies.
campaigns/swarm.sc2campaign — base.sc2data/TriggerLibs/Tactical/TactCampAI.galaxy:668
if (AICampSkirDiffTest(player, c_campExpert, c_skirVeryHard)) {
damage = AIEffectFixed(player, c_EF_PlasmaBlastDamage, c_fieldAmount);
AISetFilterLife(filter, damage*c_minDamageFraction, c_noMax);
AISetFilterLifeSortReference(filter, damage, damage*c_distanceFromDamage);
mods/core.sc2mod — base.sc2data/TriggerLibs/Tactical/TactProtAI.galaxy:1566
AISetFilterMarker(filter, c_noMarkersMin, c_noMarkersMax, mark);
AISetFilterBits(filter, UnitFilterStr(AIAbilityStr(player, c_AB_Disintegration, c_fieldTargetFiltersAB)));
AISetFilterLife(filter, c_aiDisintegrationMinDamage, c_noMax);
AISetFilterLifeSortReference(filter, c_aiDisintegrationDamage, c_aiDisintegrationDamage*c_distanceFromDamage);
mods/core.sc2mod — base.sc2data/TriggerLibs/Tactical/TactTerrAI.galaxy:52
AISetFilterRange(filter, aiUnit, AIAbilityFixed(player, c_AB_250mmStrikeCannons, c_fieldRange0));
AISetFilterMarker(filter, c_noMarkersMin, c_noMarkersMax, mark);
AISetFilterLife(filter, c_minCannonDamage, c_noMax);
AISetFilterLifeSortReference(filter, damage, damage*c_distanceFromDamage);
// Filter out units that can't attack allies since this ability is a disable.
mods/core.sc2mod — base.sc2data/TriggerLibs/Tactical/TactTerrAI.galaxy:1235
AISetFilterAlliance(filter, c_playerGroupEnemy);
damage = AIEffectFixed(player, c_EF_SeekerDamage, c_fieldAmount);
AISetFilterLife(filter, damage*c_minDamageFraction, c_noMax);
AISetFilterMarker(filter, c_noMarkersMin, c_noMarkersMax, mark);
AISetFilterLifeSortReference(filter, damage, damage*c_distanceFromDamage);
mods/core.sc2mod — base.sc2data/TriggerLibs/Tactical/TactTerrAI.galaxy:1650
}
else {
AISetFilterLife(filter, c_minLockOnDamage, c_noMax);
}
AISetFilterLifeSortReference(filter, c_minLockOnDamage, c_minLockOnDamage*c_distanceFromDamage);
mods/core.sc2mod — base.sc2data/TriggerLibs/Tactical/TactZergAI.galaxy:492
AISetFilterBits(filter, UnitFilterStr(AIAbilityStr(player, c_AB_NeuralParasite, c_fieldTargetFiltersAB)));
AISetFilterRange(filter, aiUnit, AIAbilityFixed(player, c_AB_NeuralParasite, c_fieldRange0) + 1);
AISetFilterLife(filter, c_neuralParasiteMinVitality, c_noMax);
AISetFilterMarker(filter, c_noMarkersMin, c_noMarkersMax, mark);
AISetFilterCanAttackEnemy(filter, enemyGroundCount, enemyAirCount);
mods/core.sc2mod — base.sc2data/TriggerLibs/Tactical/TactZergAI.galaxy:598
AISetFilterBits(filter, UnitFilterStr(AIWeaponStr(player, c_WE_InfestedTerran, c_fieldTargetFilters)));
AISetFilterRange(filter, aiUnit, AIAbilityFixed(player, c_AB_InfestedTerrans, c_fieldRange0) + 1);
AISetFilterLife(filter, c_noMin, c_noMax);
targetGroup = AIGetFilterGroup(filter, scanGroup);
mods/core.sc2mod — base.sc2data/TriggerLibs/Tactical/TactZergAI.galaxy:1036
filter = AIFilter(player);
AISetFilterAlliance(filter, c_playerGroupEnemy);
AISetFilterLife(filter, minVitality, c_noMax);
AISetFilterBehaviorCount(filter, c_noBehaviorMin, c_noBehaviorMax, c_BF_Corruption);
AISetFilterMarker(filter, c_noMarkersMin, c_noMarkersMax, mark);
mods/starcoop/starcoop.sc2mod — base.sc2data/LibCOMU.galaxy:2133
lv_abilityDamage = StringToFixed(CatalogFieldValueGet(c_gameCatalogEffect, "MutatorAmonNovaWeaponImprovedCanisterRifleSnipe", "Amount", c_playerAny));
lv_autoAttackDamage = CatalogFieldValueGetAsInt(c_gameCatalogEffect, "MutatorAmonNovaWeaponImprovedCanisterRifleCloaked", "Amount", lp_owner);
AISetFilterLife(lv_targetFilter2, lv_autoAttackDamage, 524287.0);
AISetFilterAlliance(lv_targetFilter2, c_playerGroupEnemy);
AISetFilterBits(lv_targetFilter2, UnitFilter((1 << c_targetFilterVisible), 0, (1 << c_targetFilterStructure) | (1 << c_targetFilterMissile) | (1 << c_targetFilterBuried), (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32)) | (1 << (c_targetFilterHallucination - 32)) | (1 << (c_targetFilterInvulnerable - 32))));
mods/starcoop/starcoop.sc2mod — base.sc2data/LibCOMU.galaxy:2426
lv_abilityRange = CatalogFieldValueGetAsInt(c_gameCatalogAbil, "MutatorAmonKerriganPrimalSlash", "Range[" + IntToString(0) + "]", lp_owner);
lv_abilityDamage = CatalogFieldValueGetAsInt(c_gameCatalogEffect, "MutatorAmonKerriganPrimalSlash", "Amount", lp_owner);
AISetFilterLife(lv_primalSlashTargetFilter, lv_abilityDamage, 524287.0);
AISetFilterPlane(lv_primalSlashTargetFilter, c_planeGround);
AISetFilterRange(lv_primalSlashTargetFilter, lp_aIUnit, lv_abilityRadius);
mods/starcoop/starcoop.sc2mod — base.sc2data/TriggerLibs/Tactical/TactCampAI.galaxy:1109
damage = AIEffectFixed(player, c_EF_PlasmaBlastDamage, c_fieldAmount);
AISetFilterLife(filter, damage*c_minDamageFraction, c_noMax);
AISetFilterLifeSortReference(filter, damage, damage*c_distanceFromDamage);
mods/starcoop/starcoop.sc2mod — base.sc2data/TriggerLibs/Tactical/TactCampAI.galaxy:1392
if (diff > c_campNormal) {
damage = 75; //the ability doesn't actually do damage, but should target higher life structures anyways
AISetFilterLife(filter, damage*c_minDamageFraction, c_noMax);
AISetFilterLifeSortReference(filter, damage, damage*c_distanceFromDamage);
mods/starcoop/starcoop.sc2mod — base.sc2data/TriggerLibs/Tactical/TactProtAI.galaxy:1560
AISetFilterMarker(filter, c_noMarkersMin, c_noMarkersMax, mark);
AISetFilterBits(filter, UnitFilterStr(AIAbilityStr(player, c_AB_Disintegration, c_fieldTargetFiltersAB)));
AISetFilterLife(filter, c_aiDisintegrationMinDamage, c_noMax);
AISetFilterLifeSortReference(filter, c_aiDisintegrationDamage, c_aiDisintegrationDamage*c_distanceFromDamage);
mods/starcoop/starcoop.sc2mod — base.sc2data/TriggerLibs/Tactical/TactTerrAI.galaxy:57
AISetFilterRange(filter, aiUnit, AIAbilityFixed(player, c_AB_250mmStrikeCannons, c_fieldRange0));
AISetFilterMarker(filter, c_noMarkersMin, c_noMarkersMax, mark);
AISetFilterLife(filter, c_minCannonDamage, c_noMax);
AISetFilterLifeSortReference(filter, damage, damage*c_distanceFromDamage);
// Filter out units that can't attack allies since this ability is a disable.
mods/starcoop/starcoop.sc2mod — base.sc2data/TriggerLibs/Tactical/TactTerrAI.galaxy:1207
AISetFilterAlliance(filter, c_playerGroupEnemy);
damage = AIEffectFixed(player, c_EF_SeekerDamage, c_fieldAmount);
AISetFilterLife(filter, damage*c_minDamageFraction, c_noMax);
AISetFilterMarker(filter, c_noMarkersMin, c_noMarkersMax, mark);
AISetFilterLifeSortReference(filter, damage, damage*c_distanceFromDamage);
mods/starcoop/starcoop.sc2mod — base.sc2data/TriggerLibs/Tactical/TactTerrAI.galaxy:1597
}
else {
AISetFilterLife(filter, c_minLockOnDamage, c_noMax);
}
AISetFilterLifeSortReference(filter, c_minLockOnDamage, c_minLockOnDamage*c_distanceFromDamage);
mods/starcoop/starcoop.sc2mod — base.sc2data/TriggerLibs/Tactical/TactZergAI.galaxy:424
AISetFilterSelf(filter, aiUnit);
AISetFilterAlliance(filter, c_playerGroupAlly);
AISetFilterLife(filter, c_aiConsumptionTargetMinLife, c_noMax);
AISetFilterLifeSortReference(filter, c_aiConsumptionTargetMinLife, c_aiConsumptionTargetMinLife*c_distanceFromDamage);
mods/starcoop/starcoop.sc2mod — base.sc2data/TriggerLibs/Tactical/TactZergAI.galaxy:703
AISetFilterBits(filter, UnitFilterStr(AIAbilityStr(player, c_AB_NeuralParasite, c_fieldTargetFiltersAB)));
AISetFilterRange(filter, aiUnit, AIAbilityFixed(player, c_AB_NeuralParasite, c_fieldRange0) + 1);
AISetFilterLife(filter, c_neuralParasiteMinVitality, c_noMax);
AISetFilterMarker(filter, c_noMarkersMin, c_noMarkersMax, mark);
AISetFilterCanAttackEnemy(filter, enemyGroundCount, enemyAirCount);
mods/starcoop/starcoop.sc2mod — base.sc2data/TriggerLibs/Tactical/TactZergAI.galaxy:809
AISetFilterBits(filter, UnitFilterStr(AIWeaponStr(player, c_WE_InfestedTerran, c_fieldTargetFilters)));
AISetFilterRange(filter, aiUnit, AIAbilityFixed(player, c_AB_InfestedTerrans, c_fieldRange0) + 1);
AISetFilterLife(filter, c_noMin, c_noMax);
targetGroup = AIGetFilterGroup(filter, scanGroup);
mods/starcoop/starcoop.sc2mod — base.sc2data/TriggerLibs/Tactical/TactZergAI.galaxy:1245
filter = AIFilter(player);
AISetFilterAlliance(filter, c_playerGroupEnemy);
AISetFilterLife(filter, minVitality, c_noMax);
AISetFilterBehaviorCount(filter, c_noBehaviorMin, c_noBehaviorMax, c_BF_Corruption);
AISetFilterMarker(filter, c_noMarkersMin, c_noMarkersMax, mark);
mods/warcoop/warclassicsystem.sc2mod — base.sc2data/TriggerLibs/Tactical/TacticalAIWar3.galaxy:157
AISetFilterBits(filter, uf);
AISetFilterRange(filter, aiUnit, range+3);
AISetFilterLife(filter, 0, maxlife);
AISetFilterLifeMod(filter, c_unitAttributeHeroic,damage*C_spellScaleHeroic-damage);
//AISetFilterLifePerMarker(filter, damage, mark);
mods/warcoop/warclassicsystem.sc2mod — base.sc2data/TriggerLibs/Tactical/TacticalAIWar3.galaxy:441
if(chaos){
AISetFilterRange(filter, aiUnit, range);
AISetFilterLife(filter, c_noMin, c_noMax);
AISetFilterLifeMod(filter, c_unitAttributeHeroic,-100);
}else{
mods/warcoop/warclassicsystem.sc2mod — base.sc2data/TriggerLibs/WarClassicTactical.galaxy:558
lv_rangeUnitFilter = AIFilter(lp_owner);
AISetFilterAlliance(lv_rangeUnitFilter, c_playerGroupAlly);
AISetFilterLife(lv_rangeUnitFilter, libGAwT_gv_c_noMin, 100.0);
lv_unitsInRangeFriend = AIGetFilterGroup(lv_rangeUnitFilter, lv_unitsInRange);
lv_orderFinal = AIUnitGroupGetValidOrder(lv_unitsInRangeFriend, lv_order, lp_aIUnit, true);
mods/warcoop/warclassicsystem.sc2mod — base.sc2data/TriggerLibs/WarClassicTactical.galaxy:597
}
AISetFilterLife(lv_rangeUnitFilter, (lv_damage-50), lv_damage);
lv_unitsInRangeEnemy = AIGetFilterGroup(lv_rangeUnitFilter, lv_unitsInRange);
lv_orderFinal = AIUnitGroupGetValidOrder(lv_unitsInRangeEnemy, lv_order, lp_aIUnit, true);