Home › Lua API › UnitAbility

Available out of the box. Usable from Lua in the unmodified game.

UnitAbility

7 methods. Symbol/current columns are function addresses (RVA) of the native wrapper.

Signatures are recovered from the game code. ⚠ = partly understood (arguments may be missing or approximate). ? after a name = optional argument. Types: integer/number are Lua numbers, enum-typed arguments show the C++ type in brackets. Two signatures mean the method is registered separately for the UI and the gameplay state and each wrapper was decoded on its own. "same code as" in the Symbol column means the compiler merged identical functions: those methods share one wrapper and cannot be told apart by address.

Method Signature Where Reference Symbol Current
AddAbilityCount UnitAbility:AddAbilityCount(eAbility: number/string[UnitAbilityTypes]) (or nothing)
args: eAbility — Index of a row of the UnitAbilities table (the value of GameInfo.UnitAbilities[...].Index).
gameplay — 0x6ff230 0x6ff980
CanHaveAbility UnitAbility:CanHaveAbility(eAbility: number/string[UnitAbilityTypes]) → boolean (or nothing)
args: eAbility — Index of a row of the UnitAbilities table (the value of GameInfo.UnitAbilities[...].Index).
gameplay — 0x6ff290 0x6ff9e0
ChangeAbilityCount ★ UnitAbility:ChangeAbilityCount(eAbility: number/string[UnitAbilityTypes], iDelta?: number) → boolean
args: eAbility — Index of a row of the UnitAbilities table (the value of GameInfo.UnitAbilities[...].Index).; iDelta — A number.
gameplay — 0x6ff320 0x6ffa70
GetAbilities UI state: UnitAbility:GetAbilities() → number[]
gameplay state: UnitAbility:GetAbilities() → table{Ability: number, Count: number}[]
ui-cache, gameplay — 0x6bd940 0x6bdec0
GetAbilityCount UnitAbility:GetAbilityCount(eAbility: number/string[UnitAbilityTypes]) → number
args: eAbility — Index of a row of the UnitAbilities table (the value of GameInfo.UnitAbilities[...].Index).
returns: A count or amount (the scripts name the result count / num / amount). (inferred)
gameplay — 0x6ff5c0 0x6ffd10
HasAbility UnitAbility:HasAbility(eAbility: number/string[UnitAbilityTypes]) → boolean
args: eAbility — Index of a row of the UnitAbilities table (the value of GameInfo.UnitAbilities[...].Index).
gameplay — 0x6ff670 0x6ffdc0
RemoveAbilityCount UnitAbility:RemoveAbilityCount(eAbility: number/string[UnitAbilityTypes]) (or nothing)
args: eAbility — Index of a row of the UnitAbilities table (the value of GameInfo.UnitAbilities[...].Index).
gameplay — 0x6ff720 0x6ffe70

Notes (★)

ChangeAbilityCount

Adds or removes a unit ability at run time by a signed count; returns whether the change was applied.

See also: UnitAbility.GetAbilityCount, UnitAbility.HasAbility, UnitAbility.AddAbilityCount, UnitAbility.RemoveAbilityCount