# Number Of Abilities On Unit

Grammar — Number of abilities on unit
FlagsNative | Function

Returns the number of abilities on a unit.

# Arguments

  • unit — Unit

Returns — int

native int UnitAbilityCount(unit inUnit);

Category: Ability / Basic

# Examples

mods/core.sc2modbase.sc2data/TriggerLibs/NativeLib.galaxy:163

    auto5A8FAC35_unit = lp_unit;
    auto5A8FAC35_i = 1;
    for ( ; auto5A8FAC35_i <= UnitAbilityCount(auto5A8FAC35_unit) ; auto5A8FAC35_i += 1 ) {
        lv_abil = UnitAbilityGet(auto5A8FAC35_unit, auto5A8FAC35_i);
        if ((AbilityClass(lv_abil) == lp_abilityClass)) {

mods/core.sc2modbase.sc2data/TriggerLibs/NativeLib.galaxy:237

    auto981DBC05_unit = lp_unit;
    auto981DBC05_i = 1;
    for ( ; auto981DBC05_i <= UnitAbilityCount(auto981DBC05_unit) ; auto981DBC05_i += 1 ) {
        lv_itAbil = UnitAbilityGet(auto981DBC05_unit, auto981DBC05_i);
        if ((libNtve_gf_AbilityMatchesFilters(lv_itAbil, lv_player, lp_abilityClass, lp_alias) == true)) {

mods/heroesdata.stormmodbase.stormdata/TriggerLibs/GameLib.galaxy:8104

            }
        }
        auto342EB673_ae = UnitAbilityCount(lv_itUnit);
        lv_itAbility = 1;
        for ( ; ( (auto342EB673_ai >= 0 && lv_itAbility <= auto342EB673_ae) || (auto342EB673_ai < 0 && lv_itAbility >= auto342EB673_ae) ) ; lv_itAbility += auto342EB673_ai ) {

mods/heroesdata.stormmodbase.stormdata/TriggerLibs/GameLib.galaxy:8124

        if ((libMapM_gv_vehicle[lv_vehicleIndex].lv_unit_Vehicle != null) && (libMapM_gv_vehicle[lv_vehicleIndex].lv_player_PlayerControllingVehicle == lp_player)) {
            lv_vehicleUnit = libMapM_gv_vehicle[lv_vehicleIndex].lv_unit_Vehicle;
            autoBC2476EA_ae = UnitAbilityCount(lv_vehicleUnit);
            lv_itAbility = 1;
            for ( ; ( (autoBC2476EA_ai >= 0 && lv_itAbility <= autoBC2476EA_ae) || (autoBC2476EA_ai < 0 && lv_itAbility >= autoBC2476EA_ae) ) ; lv_itAbility += autoBC2476EA_ai ) {

mods/heroesdata.stormmodbase.stormdata/TriggerLibs/SupportLib.galaxy:1645

    // Implementation
    lv_ownerofUnit = UnitGetOwner(lp_unit);
    auto8A789BA6_ae = UnitAbilityCount(lp_unit);
    lv_itAbility = 1;
    for ( ; ( (auto8A789BA6_ai >= 0 && lv_itAbility <= auto8A789BA6_ae) || (auto8A789BA6_ai < 0 && lv_itAbility >= auto8A789BA6_ae) ) ; lv_itAbility += auto8A789BA6_ai ) {

mods/starcoop/starcoop.sc2modbase.sc2data/LibCOMU.galaxy:13304

            if (lv_indexStructure == null) { break; }
            UnitIssueOrder(lv_indexStructure, OrderTargetingPoint(AbilityCommand("Rally", 0), UnitGetPosition(lv_indexStructure)), c_orderQueueReplace);
            autoD8196C4C_ae = UnitAbilityCount(lv_indexStructure);
            lv_abilityIndex = 1;
            for ( ; ( (autoD8196C4C_ai >= 0 && lv_abilityIndex <= autoD8196C4C_ae) || (autoD8196C4C_ai < 0 && lv_abilityIndex >= autoD8196C4C_ae) ) ; lv_abilityIndex += autoD8196C4C_ai ) {

mods/warcoop/warclassicsystem.sc2modbase.sc2data/TriggerLibs/WarClassicTactical.galaxy:633

    autoEE073BD6_unit = lp_aIUnit;
    autoEE073BD6_i = 1;
    for ( ; autoEE073BD6_i <= UnitAbilityCount(autoEE073BD6_unit) ; autoEE073BD6_i += 1 ) {
        lv_itAbilLink = UnitAbilityGet(autoEE073BD6_unit, autoEE073BD6_i);
        if ((AbilityClass(lv_itAbilLink) == c_classIdCAbilInventory)) {