Thread Tools Display Modes
07/01/24, 03:56 PM   #1
LadyTiny
Join Date: Jul 2024
Posts: 2
GetAbilityCost returns nil for power type

I've tried using GetAbilityCost, GetAbilityCostOverTime, and GetSlotAbilityCost. All three of them return the the first argument, for example 3500 for cost, but the second argument is always nil.

local cost, mechanic = GetAbilityCost(abilityId)

Mechanic is always nil. Is there any other way to find out whether an ability is a magicka or stamina or health costing ability?
  Reply With Quote
07/01/24, 04:16 PM   #2
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 5,092
GetAbilityCost does not return 2 values! It only returns 1 -> the costs (number).
It got 4 parameters where the 2nd is the mechanicFlag you need to pass in to the function.

GetAbilityBaseCostInfo coud be the one you are searching for, as it will return as 2nd return value the CombatMechanicFlags


Code:
--- @param abilityId integer
--- @param overrideRank integer|nil
--- @param casterUnitTag string
--- @return integer|nil baseCost, CombatMechanicFlags|nil mechanicFlags, boolean|nil isCostChargedPerTick
function GetAbilityBaseCostInfo(abilityId, overrideRank, casterUnitTag) end

--- @param abilityId integer
--- @param mechanicFlag CombatMechanicFlags
--- @param overrideRank integer|nil
--- @param casterUnitTag string
--- @return integer cost
function GetAbilityCost(abilityId, mechanicFlag, overrideRank, casterUnitTag) end

Those api funtions, their parameters and return values, and the enums like CombatMechanicFlags can be found in the API funtions list:
https://wiki.esoui.com/APIVersion


h5. CombatMechanicFlags
* COMBAT_MECHANIC_FLAGS_DAEDRIC
* COMBAT_MECHANIC_FLAGS_HEALTH
* COMBAT_MECHANIC_FLAGS_MAGICKA
* COMBAT_MECHANIC_FLAGS_MOUNT_STAMINA
* COMBAT_MECHANIC_FLAGS_STAMINA
* COMBAT_MECHANIC_FLAGS_ULTIMATE
* COMBAT_MECHANIC_FLAGS_WEREWOLF

Edit:
Moved to proper forums

Last edited by Baertram : 07/01/24 at 04:18 PM.
  Reply With Quote
07/01/24, 04:20 PM   #3
LadyTiny
Join Date: Jul 2024
Posts: 2
You're totally right, that worked, and thank you for your help you're amazing <3
  Reply With Quote

ESOUI » Developer Discussions » General Authoring Discussion » GetAbilityCost returns nil for power type


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off