# Unit Ability
Grammar — unit ability index
Flags —Native
|Function
Returns the ability in the specified unit’s ability array at the specified index.
# Arguments
unit
— Unitint
— Index
Returns — string
<gamelink::Abil>
native string UnitAbilityGet(unit inUnit, int inIndex);
# 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:164
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)) {
lv_classIndex += 1;
mods/core.sc2mod — base.sc2data/TriggerLibs/NativeLib.galaxy:238
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)) {
return lv_itAbil;
mods/heroesdata.stormmod — base.stormdata/TriggerLibs/GameLib.galaxy:8107
lv_itAbility = 1;
for ( ; ( (auto342EB673_ai >= 0 && lv_itAbility <= auto342EB673_ae) || (auto342EB673_ai < 0 && lv_itAbility >= auto342EB673_ae) ) ; lv_itAbility += auto342EB673_ai ) {
lv_abilLink = UnitAbilityGet(lv_itUnit, lv_itAbility);
if ((libGame_gf_HeroAbilityCooldownCanBeReset(lv_heroIndex, lv_abilLink) == true)) {
lv_cooldownLink = CatalogFieldValueGet(c_gameCatalogAbil, lv_abilLink, "Cost[" + IntToString(0) + "].Cooldown.Link", UnitGetOwner(lv_itUnit));
mods/heroesdata.stormmod — base.stormdata/TriggerLibs/GameLib.galaxy:8127
lv_itAbility = 1;
for ( ; ( (autoBC2476EA_ai >= 0 && lv_itAbility <= autoBC2476EA_ae) || (autoBC2476EA_ai < 0 && lv_itAbility >= autoBC2476EA_ae) ) ; lv_itAbility += autoBC2476EA_ai ) {
lv_abilLink = UnitAbilityGet(lv_vehicleUnit, lv_itAbility);
lv_cooldownLink = CatalogFieldValueGet(c_gameCatalogAbil, lv_abilLink, "Cost[" + IntToString(0) + "].Cooldown.Link", lp_player);
libNtve_gf_UnitRemoveCooldown(lv_vehicleUnit, lv_cooldownLink);
mods/heroesdata.stormmod — base.stormdata/TriggerLibs/SupportLib.galaxy:1648
lv_itAbility = 1;
for ( ; ( (auto8A789BA6_ai >= 0 && lv_itAbility <= auto8A789BA6_ae) || (auto8A789BA6_ai < 0 && lv_itAbility >= auto8A789BA6_ae) ) ; lv_itAbility += auto8A789BA6_ai ) {
lv_abilLink = UnitAbilityGet(lp_unit, lv_itAbility);
if ((lv_abilLink != "") && (lv_abilLink != null) && ((AbilityClass(lv_abilLink) == c_classIdCAbilAugment) || (AbilityClass(lv_abilLink) == c_classIdCAbilBehavior) || (AbilityClass(lv_abilLink) == c_classIdCAbilEffectInstant) || (AbilityClass(lv_abilLink) == c_classIdCAbilEffectTarget) || (AbilityClass(lv_abilLink) == c_classIdCAbilMorph))) {
lv_cooldownLink = CatalogFieldValueGet(c_gameCatalogAbil, lv_abilLink, "Cost[" + IntToString(0) + "].Cooldown.Link", lv_ownerofUnit);
mods/starcoop/starcoop.sc2mod — base.sc2data/LibCOMU.galaxy:13307
lv_abilityIndex = 1;
for ( ; ( (autoD8196C4C_ai >= 0 && lv_abilityIndex <= autoD8196C4C_ae) || (autoD8196C4C_ai < 0 && lv_abilityIndex >= autoD8196C4C_ae) ) ; lv_abilityIndex += autoD8196C4C_ai ) {
lv_structureAbility = UnitAbilityGet(lv_indexStructure, lv_abilityIndex);
if ((UnitAbilityCheck(lv_indexStructure, lv_structureAbility, true) == false)) {
continue;
mods/warcoop/warclassicsystem.sc2mod — base.sc2data/TriggerLibs/WarClassicTactical.galaxy:634
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)) {
lv_inventoryLink = lv_itAbilLink;