API:GetAbilityRequirements
From RoR Wiki
UI Lua API · Ability functions
Version: WAR 1.4.8
Returns the requirement texts of an ability, as shown in its tooltip.
requirements = GetAbilityRequirements(abilityId)
Arguments
- abilityId
number– Id of the ability. It is converted to a 16-bit integer.
Returns
- requirements
table– Array of 5wstringvalues, indexed 1 to 5.
Details
- Each entry is a text from the
abilityresultsstring table. Unused requirement slots, and all slots of an unknown ability, areL"". - If there is no player object, or the Lua state is not available, the function returns nothing.
- The stock tooltip loops from 1 to
GameData.ABILITY_REQUIREMENT_COUNT.
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 reqs = GetAbilityRequirements( abilityData.id )
for reqsIndex = 1, GameData.ABILITY_REQUIREMENT_COUNT
do
local reqsLabel = windowName.."Requirements"..reqsIndex
if ((reqs[reqsIndex] ~= nil) and (DoesWindowExist (reqsLabel)))
then
LabelSetText (reqsLabel, reqs[reqsIndex])
else
LabelSetText (reqsLabel, L"")
end
end
