• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical 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