• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.
  • 💡 We're thrilled to announce that our upcoming texturing contest is in the works, and we're eager to hear your suggestions! Please take this opportunity to share your ideas in this theme discussion thread for the Texturing Contest #34!
  • 🏆 Hive's 7th HD Modeling Contest: Icecrown Creature is now open! The frozen wastes of Icecrown are home to some of Azeroth’s most terrifying and resilient creatures. For this contest, your challenge is to design and model a HD 3D monster that embodies the cold, undead, and sinister essence of Icecrown! 📅 Submissions close on April 13, 2025. Don't miss this opportunity to let your creativity shine! Enter now and show us your frozen masterpiece! 🔗 Click here to enter!

New Help Getting an Ability's AbilID

Status
Not open for further replies.
I need a function that will convert an Ability to an AbilID

Currently trying to create a function that will return all the remaining cooldowns of a unit's abilities whenever that unit starts the effect of a spell. So far I am able to get the names of all the abilities, but need to convert them to AbilId's to get their remaining cooldown amounts. Any help?

JASS:
function AllRemainingCooldowns takes nothing returns nothing

   local integer i = 0
    loop
        exitwhen i > 11
   
        call DisplayTextToForce( GetPlayersAll(), "t " + BlzGetAbilityStringLevelField( BlzGetUnitAbilityByIndex( GetTriggerUnit(), i), ABILITY_SLF_TOOLTIP_NORMAL, 0) )
        call DisplayTextToForce( GetPlayersAll(), "c " + BlzGetUnitAbilityCooldownRemaining( GetTriggerUnit(), BlzGetUnitAbilityByIndex( GetTriggerUnit(), i) ) )

        set i = i+1
    endloop

endfunction


Ideally I need to be able to do something like
JASS:
 BlzGetUnitAbilityByIndex( GetTriggerUnit(), i).AbilityId
//OR call something like this
 call GetAbilityId( ability )

But sadly have not found anything in the common.j or blizzard.j like these :(
 
Last edited:
Re: These threads may have answered my issue. No solution :cry:

 
Could you use the method I suggested in that first thread? Put the rawcode of the ability in one of it's unused text fields and get it from there. Obviously this may be a pain if you already have 100's of abilities.
This is basically the only way. There is no automated method to get the ID. Blizzard forgot to implement the native (NetEase has this native...).
 
Could you use the method I suggested in that first thread? Put the rawcode of the ability in one of it's unused text fields and get it from there. Obviously this may be a pain if you already have 100's of abilities.
Yep! Have 100's of abilities, but not a bad idea.

My next best thought is to create a hash for each unit, that saves the abilID of each ability they have whenever they cast a spell. Then when it's needed to check if any of these abilities are on CD, just retrieve all of their abilID's and see what their remaining CD's are.

The reason I don't want to simply use a timer is there are several abilities in this map that reduce or reset a unit's CD, which would mean I would have to also add functions to reduce or reset the timer, and I figured just checking if any of the unit's abilities are on cooldown should be easier (theoretically).
 
Last edited:
Status
Not open for further replies.
Top