• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[JASS] [Ability Button Pos] Can you get a units ability using ability slots, eg (2, 2)? [Solved]

Level 7
Joined
Sep 16, 2016
Messages
185
Using Jass or Wurst, not GUI.

I want to be able to fetch a units Q, W, E, R, T abilities, and they all have the same ability slots across all units
 
Level 7
Joined
Sep 16, 2016
Messages
185
No, but you can make use of the native
JASS:
native BlzGetAbilityByIndex takes unit whichUnit, integer index returns ability
Doesn't work the same way, but for my case I can make a workaround using this

JASS:
    for i = 0 to 6 
        spell = BlzGetUnitAbilityByIndex(u, i)
        if BlzGetAbilityPosX(BlzGetAbilityId(spell)) == 0 and BlzGetAbilityPosY(BlzGetAbilityId(spell)) == 2 and spell != null // Q
            abil_Q[id] = spell
            abilArray[0] = spell
        if BlzGetAbilityPosX(BlzGetAbilityId(spell)) == 1 and BlzGetAbilityPosY(BlzGetAbilityId(spell)) == 2 and spell != null // W
            abil_W[id] = spell
            abilArray[1] = spell
        if BlzGetAbilityPosX(BlzGetAbilityId(spell)) == 2 and BlzGetAbilityPosY(BlzGetAbilityId(spell)) == 2 and spell != null // E
            abil_E[id] = spell
            abilArray[2] = spell
        if BlzGetAbilityPosX(BlzGetAbilityId(spell)) == 3 and BlzGetAbilityPosY(BlzGetAbilityId(spell)) == 2 and spell != null // R
            abil_R[id] = spell
            abilArray[3] = spell
        if BlzGetAbilityPosX(BlzGetAbilityId(spell)) == 3 and BlzGetAbilityPosY(BlzGetAbilityId(spell)) == 1 and spell != null // T
            abil_T[id] = spell
            abilArray[4] = spell
        if BlzGetAbilityPosX(BlzGetAbilityId(spell)) == 2 and BlzGetAbilityPosY(BlzGetAbilityId(spell)) == 1 and spell != null // F
            abil_F[id] = spell
            abilArray[5] = spell
        if BlzGetAbilityPosX(BlzGetAbilityId(spell)) == 1 and BlzGetAbilityPosY(BlzGetAbilityId(spell)) == 1 and spell != null // D
            abil_D[id] = spell
 
Last edited:
Top