# Number Of Abilities On Unit
Grammar — Number of abilities on unit
Flags —Native
|Function
Returns the number of abilities on a unit.
# Arguments
unit
— Unit
Returns — int
native int UnitAbilityCount(unit inUnit);
# 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
mods/core.sc2mod — base.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.sc2mod — base.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.stormmod — base.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.stormmod — base.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.stormmod — base.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.sc2mod — base.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.sc2mod — base.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)) {