# Unit Has Ability
Grammar — u has abil
Flags —Native
|Function
Returns true if a unit has a specified ability.
# Arguments
unit
— Unitstring
<gamelink::Abil> — Ability
Returns — bool
native bool UnitAbilityExists(unit inUnit, string inAbil);
# Related
Category: Ability / Basic
- Remove Ability —
void
— UnitAbilityRemove - Add Ability —
void
— UnitAbilityAdd - Unit Uses Ability —
void
— TriggerAddEventUnitAbility - Unit Changes Ability Auto Cast State —
void
— TriggerAddEventUnitAbilityAutoCastChange - Triggering Ability —
abilcmd
— EventUnitAbility - Triggering Ability Stage —
int
<preset::AbilityStage> — EventUnitAbilityStage - Triggering Ability Target Point —
point
— EventUnitTargetPoint - Triggering Ability Target Unit —
unit
— EventUnitTargetUnit - Triggering Ability Other Unit —
unit
— EventUnitAbilityOtherUnit - Ability From Item or Trigger —
abilcmd
— libNtve_gf_EventItemAbilityOrUnitAbility - Unit Is Created —
void
— TriggerAddEventUnitCreated - Created Unit —
unit
— EventUnitCreatedUnit - Behavior That Created Unit —
string
<gamelink::Behavior> — EventUnitCreatedBehavior - Ability That Created Unit —
string
<gamelink::Abil> — EventUnitCreatedAbil - Show/Hide Ability For Unit —
void
— UnitAbilityShow - Ability Enabled For Unit —
bool
— UnitAbilityCheck - Number Of Abilities On Unit —
int
— UnitAbilityCount - Unit Ability —
string
<gamelink::Abil> — UnitAbilityGet - Unit Ability By Class —
string
<gamelink::Abil> — libNtve_gf_UnitAbilityGetByType - Unit Ability Command State —
bool
— UnitCheckAbilCmdState - Unit Ability Order State (Flags) —
int
— UnitAbilOrderStateFlags - Unit Has Ability —
bool
— UnitAbilityExists - Enable/Disable Ability For Unit —
void
— UnitAbilityEnable - Add Level To Unit Ability —
void
— UnitAbilityChangeLevel - Replace Unit Ability —
void
— UnitAbilityChangeLink - Set Ability Default Submenu —
void
— UnitAbilityChangeCardId - Current Level For Unit Ability —
int
— UnitAbilityGetLevel - Maximum Level For Unit Ability —
int
— UnitAbilityMaxLevel - Ability Matches Filters —
bool
— libNtve_gf_AbilityMatchesFilters - Unit Ability By Filters —
string
<gamelink::Abil> — libNtve_gf_UnitAbilityByFilters - Unit Ability Default Submenu —
string
— UnitAbilityGetCardId
# Examples
campaigns/swarmstory.sc2campaign — base.sc2data/TriggerLibs/SwarmCampaignLib.galaxy:4662
// Automatic Variable Declarations
// Implementation
if ((UnitAbilityExists(lp_hero, AbilityCommandGetAbility(lp_abilityCommand)) == true)) {
UnitAbilityReset(lp_hero, lp_abilityCommand, c_spendLocationAll);
}
mods/core.sc2mod — base.sc2data/TriggerLibs/Tactical/TactProtAI.galaxy:1293
// Only use Revelation if Envision does not exist (IE this is Void)
if (UnitAbilityExists(aiUnit, c_AB_CoreEnvision)) {
return null;
}
mods/core.sc2mod — base.sc2data/TriggerLibs/Tactical/TactProtAI.galaxy:1552
// Check UnitAbilityExists to prevent warnings in swarm
if (!UnitAbilityExists(aiUnit, c_AB_Disintegration)) {
return null;
}
mods/core.sc2mod — base.sc2data/TriggerLibs/Tactical/TactProtAI.galaxy:1600
// Check UnitAbilityExists to prevent warnings in liberty/swarm
if (!UnitAbilityExists(aiUnit, c_AB_ReleaseInterceptors)) {
return null;
}
mods/core.sc2mod — base.sc2data/TriggerLibs/Tactical/TactProtAI.galaxy:1642
// Check UnitAbilityExists to prevent warnings in liberty/swarm
if (!UnitAbilityExists(aiUnit, c_AB_ImmortalBarrier)) {
return null;
}
mods/core.sc2mod — base.sc2data/TriggerLibs/Tactical/TactProtAI.galaxy:1685
// Check UnitAbilityExists to prevent warnings in liberty
if (!UnitAbilityExists(aiUnit, c_AB_VoidRayDamage)) {
return null;
}
mods/core.sc2mod — base.sc2data/TriggerLibs/Tactical/TactTerrAI.galaxy:202
// Check UnitAbilityExists to prevent warnings in void
if (!UnitAbilityExists(aiUnit, c_AB_Snipe)) {
return null;
}
mods/core.sc2mod — base.sc2data/TriggerLibs/Tactical/TactTerrAI.galaxy:257
// Check UnitAbilityExists to prevent warnings in liberty/swarm
if (!UnitAbilityExists(aiUnit, c_AB_SteadyTargeting)) {
return null;
}
mods/core.sc2mod — base.sc2data/TriggerLibs/Tactical/TactTerrAI.galaxy:364
// Check UnitAbilityExists to prevent warnings in liberty/swarm
if (!UnitAbilityExists(aiUnit, c_AB_KD8Charge)) {
return null;
}
mods/core.sc2mod — base.sc2data/TriggerLibs/Tactical/TactTerrAI.galaxy:485
// Check UnitAbilityExists to prevent warnings in liberty/swarm
if (!UnitAbilityExists(aiUnit, c_AB_TacticalJump)) {
return null;
}
mods/core.sc2mod — base.sc2data/TriggerLibs/Tactical/TactZergAI.galaxy:299
// Check UnitAbilityExists to prevent warnings in liberty/swarm
if (!UnitAbilityExists(aiUnit, c_AB_ParasiticBomb)) {
return null;
}
mods/core.sc2mod — base.sc2data/TriggerLibs/Tactical/TactZergAI.galaxy:383
// Check UnitAbilityExists to prevent warnings in liberty
if (!UnitAbilityExists(aiUnit, c_AB_UltraliskBurrowCharge)) {
return null;
}
mods/core.sc2mod — base.sc2data/TriggerLibs/Tactical/TactZergAI.galaxy:752
// Check UnitAbilityExists to prevent warnings in liberty
if (!UnitAbilityExists(aiUnit, c_AB_VolatileBurstBuilding)) {
return null;
}
mods/core.sc2mod — base.sc2data/TriggerLibs/Tactical/TactZergAI.galaxy:1056
// Check UnitAbilityExists to prevent warnings in liberty
if (!UnitAbilityExists(aiUnit, c_AB_LeechResources)) {
return null;
}
mods/core.sc2mod — base.sc2data/TriggerLibs/Tactical/TactZergAI.galaxy:1084
// Check UnitAbilityExists to prevent warnings in liberty/swarm
if (!UnitAbilityExists(aiUnit, c_AB_CausticSpray)) {
return null;
}
mods/heroesdata.stormmod — base.stormdata/TriggerLibs/AILib.galaxy:716
lv_newOrderTarget = UnitGroupClosestToPoint(libAIAI_gv_defenderAI[lp_defenderAIIndex].lv_validTargets, UnitGetPosition(lv_creepUnit));
if ((lv_newOrderTarget == null)) {
if ((UnitAbilityExists(lv_creepUnit, "StormVehicleAttack") == true)) {
UnitIssueOrder(lv_creepUnit, OrderTargetingPoint(libAIAI_gv_aIAttackAbilBoss, libAIAI_gv_defenderAI[lp_defenderAIIndex].lv_leashPositions[lp_creep]), c_orderQueueReplace);
}
mods/heroesdata.stormmod — base.stormdata/TriggerLibs/AILib.galaxy:726
else {
if (((lv_newOrderTarget != lv_currentOrderTarget) || ((OrderGetAbilityCommand(lv_currentOrder) != libAIAI_gv_aIAttackAbil) && (OrderGetAbilityCommand(lv_currentOrder) != libAIAI_gv_aIAttackAllyAbil) && (OrderGetAbilityCommand(lv_currentOrder) != libAIAI_gv_aIAttackAbilBoss) && (OrderGetAbilityCommand(lv_currentOrder) != libAIAI_gv_aIAttackAbilMerc)))) {
if ((UnitAbilityExists(lv_creepUnit, "StormVehicleAttack") == true)) {
UnitIssueOrder(lv_creepUnit, OrderTargetingUnit(libAIAI_gv_aIAttackAbilBoss, lv_newOrderTarget), c_orderQueueReplace);
}
mods/heroesdata.stormmod — base.stormdata/TriggerLibs/GameLib.galaxy:14429
lv_tauntBehavior = EventUnitBehavior();
lv_casterUnit = UnitBehaviorEffectUnit(lv_tauntedUnit, lv_tauntBehavior, c_effectUnitCaster, 0);
lv_tauntedUnitHasBasicAttackAbility = UnitAbilityExists(lv_tauntedUnit, "attack");
// Conditions
mods/starcoop/starcoop.sc2mod — base.sc2data/LibCOMI.galaxy:13854
}
if ((UnitAbilityExists(lv_unit, "BroodLordHangar") == true)) {
libCOMI_gf_SetUnitBuffMultiplier(lv_unit, (1.0 / UnitWeaponSpeedMultiplier(lv_unit, 1)), "TriggerQueueableRate", 1.01, libCOMI_ge_UnitBuffMultiplierMethod_Exponential);
}
mods/starcoop/starcoop.sc2mod — base.sc2data/TriggerLibs/Tactical/TactProtAI.galaxy:1631
// Check UnitAbilityExists to prevent warnings in liberty/swarm
if (!UnitAbilityExists(aiUnit, c_AB_ImmortalBarrier)) {
return null;
}
mods/starcoop/starcoop.sc2mod — base.sc2data/TriggerLibs/Tactical/TactProtAI.galaxy:1674
// Check UnitAbilityExists to prevent warnings in liberty/swarm
if (!UnitAbilityExists(aiUnit, c_AB_VoidRayDamage)) {
return null;
}
mods/starcoop/starcoop.sc2mod — base.sc2data/TriggerLibs/Tactical/TactTerrAI.galaxy:204
// Check UnitAbilityExists to prevent warnings in void
if (!UnitAbilityExists(aiUnit, c_AB_Snipe)) {
return null;
}
mods/starcoop/starcoop.sc2mod — base.sc2data/TriggerLibs/Tactical/TactTerrAI.galaxy:249
// Check UnitAbilityExists to prevent warnings in liberty/swarm
if (!UnitAbilityExists(aiUnit, c_AB_SteadyTargeting)) {
return null;
}
mods/starcoop/starcoop.sc2mod — base.sc2data/TriggerLibs/Tactical/TactTerrAI.galaxy:346
// Check UnitAbilityExists to prevent warnings in liberty/swarm
if (!UnitAbilityExists(aiUnit, c_AB_KD8Charge)) {
return null;
}
mods/starcoop/starcoop.sc2mod — base.sc2data/TriggerLibs/Tactical/TactTerrAI.galaxy:465
// Check UnitAbilityExists to prevent warnings in liberty/swarm
if (!UnitAbilityExists(aiUnit, c_AB_TacticalJump)) {
return null;
}
mods/starcoop/starcoop.sc2mod — base.sc2data/TriggerLibs/Tactical/TactZergAI.galaxy:594
// Check UnitAbilityExists to prevent warnings in liberty
if (!UnitAbilityExists(aiUnit, c_AB_UltraliskBurrowCharge)) {
return null;
}
mods/starcoop/starcoop.sc2mod — base.sc2data/TriggerLibs/Tactical/TactZergAI.galaxy:1265
// Check UnitAbilityExists to prevent warnings in liberty
if (!UnitAbilityExists(aiUnit, c_AB_LeechResources)) {
return null;
}
mods/starcoop/starcoop.sc2mod — base.sc2data/TriggerLibs/Tactical/TactZergAI.galaxy:1293
// Check UnitAbilityExists to prevent warnings in liberty/swarm
if (!UnitAbilityExists(aiUnit, c_AB_CausticSpray)) {
return null;
}
mods/voidprologue.sc2mod — base.sc2data/LibA3DDD02B.galaxy:3527
// Automatic Variable Declarations
// Implementation
if ((UnitAbilityExists(lp_hero, AbilityCommandGetAbility(lp_abilityCommand)) == true)) {
UnitAbilityReset(lp_hero, lp_abilityCommand, c_spendLocationAll);
}
mods/warcoop/warcoopdata.sc2mod — base.sc2data/TriggerLibs/WarCoopData.galaxy:1958
// Automatic Variable Declarations
// Implementation
if ((UnitAbilityExists(lp_sourceWayGate, libWCdr_gv_waygateAbility) == true)) {
UnitGroupAdd(libWCdr_gv_wayGatesUnitGroup, lp_sourceWayGate);
if ((UnitHasBehavior2(lp_sourceWayGate, libWCdr_gv_waygateBehaviorDestination) == false)) {