# Unit Has Ability

Grammaru has abil
FlagsNative | Function

Returns true if a unit has a specified ability.

# Arguments

  • unit — Unit
  • string<gamelink::Abil> — Ability

Returns — bool

native bool UnitAbilityExists(unit inUnit, string inAbil);

Category: Ability / Basic

# Examples

campaigns/swarmstory.sc2campaignbase.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.sc2modbase.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.sc2modbase.sc2data/TriggerLibs/Tactical/TactProtAI.galaxy:1552

        
    // Check UnitAbilityExists to prevent warnings in swarm
    if (!UnitAbilityExists(aiUnit, c_AB_Disintegration)) {
        return null;
    }

mods/core.sc2modbase.sc2data/TriggerLibs/Tactical/TactProtAI.galaxy:1600

      
    // Check UnitAbilityExists to prevent warnings in liberty/swarm
    if (!UnitAbilityExists(aiUnit, c_AB_ReleaseInterceptors)) {
        return null;
    }

mods/core.sc2modbase.sc2data/TriggerLibs/Tactical/TactProtAI.galaxy:1642

    
    // Check UnitAbilityExists to prevent warnings in liberty/swarm
    if (!UnitAbilityExists(aiUnit, c_AB_ImmortalBarrier)) {
        return null;
    }

mods/core.sc2modbase.sc2data/TriggerLibs/Tactical/TactProtAI.galaxy:1685

    
    // Check UnitAbilityExists to prevent warnings in liberty
    if (!UnitAbilityExists(aiUnit, c_AB_VoidRayDamage)) {
        return null;
    }

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

    
    // Check UnitAbilityExists to prevent warnings in void
    if (!UnitAbilityExists(aiUnit, c_AB_Snipe)) {
        return null;
    }

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

    
    // Check UnitAbilityExists to prevent warnings in liberty/swarm
    if (!UnitAbilityExists(aiUnit, c_AB_SteadyTargeting)) {
        return null;
    }

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

    
    // Check UnitAbilityExists to prevent warnings in liberty/swarm
    if (!UnitAbilityExists(aiUnit, c_AB_KD8Charge)) {
        return null;
    }

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

    
    // Check UnitAbilityExists to prevent warnings in liberty/swarm
    if (!UnitAbilityExists(aiUnit, c_AB_TacticalJump)) {
        return null;
    }

mods/core.sc2modbase.sc2data/TriggerLibs/Tactical/TactZergAI.galaxy:299

    
    // Check UnitAbilityExists to prevent warnings in liberty/swarm
    if (!UnitAbilityExists(aiUnit, c_AB_ParasiticBomb)) {
        return null;
    }

mods/core.sc2modbase.sc2data/TriggerLibs/Tactical/TactZergAI.galaxy:383


    // Check UnitAbilityExists to prevent warnings in liberty
    if (!UnitAbilityExists(aiUnit, c_AB_UltraliskBurrowCharge)) {
        return null;
    }

mods/core.sc2modbase.sc2data/TriggerLibs/Tactical/TactZergAI.galaxy:752

    
    // Check UnitAbilityExists to prevent warnings in liberty
    if (!UnitAbilityExists(aiUnit, c_AB_VolatileBurstBuilding)) {
        return null;
    }

mods/core.sc2modbase.sc2data/TriggerLibs/Tactical/TactZergAI.galaxy:1056

    
    // Check UnitAbilityExists to prevent warnings in liberty
    if (!UnitAbilityExists(aiUnit, c_AB_LeechResources)) {
        return null;
    }

mods/core.sc2modbase.sc2data/TriggerLibs/Tactical/TactZergAI.galaxy:1084

    
    // Check UnitAbilityExists to prevent warnings in liberty/swarm
    if (!UnitAbilityExists(aiUnit, c_AB_CausticSpray)) {
        return null;
    }

mods/heroesdata.stormmodbase.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.stormmodbase.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.stormmodbase.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.sc2modbase.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.sc2modbase.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.sc2modbase.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.sc2modbase.sc2data/TriggerLibs/Tactical/TactTerrAI.galaxy:204

    
    // Check UnitAbilityExists to prevent warnings in void
    if (!UnitAbilityExists(aiUnit, c_AB_Snipe)) {
        return null;
    }

mods/starcoop/starcoop.sc2modbase.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.sc2modbase.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.sc2modbase.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.sc2modbase.sc2data/TriggerLibs/Tactical/TactZergAI.galaxy:594


    // Check UnitAbilityExists to prevent warnings in liberty
    if (!UnitAbilityExists(aiUnit, c_AB_UltraliskBurrowCharge)) {
        return null;
    }

mods/starcoop/starcoop.sc2modbase.sc2data/TriggerLibs/Tactical/TactZergAI.galaxy:1265

    
    // Check UnitAbilityExists to prevent warnings in liberty
    if (!UnitAbilityExists(aiUnit, c_AB_LeechResources)) {
        return null;
    }

mods/starcoop/starcoop.sc2modbase.sc2data/TriggerLibs/Tactical/TactZergAI.galaxy:1293

    
    // Check UnitAbilityExists to prevent warnings in liberty/swarm
    if (!UnitAbilityExists(aiUnit, c_AB_CausticSpray)) {
        return null;
    }

mods/voidprologue.sc2modbase.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.sc2modbase.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)) {