Skip to content

Return of Reckoning

Wiki

RoR Wiki

API:GetAbilityActionPointCost

From RoR Wiki
Revision as of 19:42, 16 October 2026 by Maintenance script (talk | contribs) (UI Lua API import (WAR 1.4.8))
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

UI Lua API · Ability functions
Version: WAR 1.4.8

Returns the action point cost of an ability for the player.

apCost = GetAbilityActionPointCost(abilityId)

Arguments

abilityId
number – Id of the ability. It is converted to a 16-bit integer.

Returns

apCost
number – Action point cost. 0 for an unknown ability.

Details

  • The cost is worked out by the client for the player and the current target in the slot the ability uses, so it can differ from the base cost.
  • For abilities whose hasAPCostPerSecond field is true (see GetAbilityData), the stock tooltip shows the value as a cost per second.
  • 0 is returned when there is no player object.

Errors

None besides the generic Invalid Parameters message when the argument is missing or not a number.

Example

From easystem_tooltips/source/abilitytooltips.lua:

local apCost = GetAbilityActionPointCost (abilityData.id)

if (apCost > 0)
then
    local params = { apCost }

    if (abilityData.hasAPCostPerSecond)
    then
        return (GetStringFormat (StringTables.Default.LABEL_ABILITY_TOOLTIP_AP_COST_PER_SECOND, params))
    else
        return (GetStringFormat (StringTables.Default.LABEL_ABILITY_TOOLTIP_ACTION_POINT_COST, params))
    end
end

See also