• 🏆 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!

[Trigger] Detecting if unit has ability/buffs

Status
Not open for further replies.
Level 12
Joined
Jul 11, 2007
Messages
642
Is there a condition that checks if a unit has an ability?
The only solution to this I see is to do this:
  • If - Conditions
    • ((Triggering unit) has buff P ) Equal to True
But I want something like this:
  • If - Conditions
    • ((Triggering unit) has ability P ) Equal to True
Though, I don't think that that is an option. So I made all the abilities I wanted auras, made them only target self, and made it try to detect it the first way. But the problem is that the aura's don't give the units the buffs, so the triggers are useless. Any body know the problem or an alternative solution?
 
Level 4
Joined
Nov 24, 2007
Messages
55
In JASS you can simply do GetUnitAbilityLevel( unit theUnit, integer abilCode )

if that returns a number greater than 0, then the unit has the ability (or buff actually. The GUI actually converts the "Has Buff" to GetUnitAbilityLevel, just using the buff code as the abilCode (I guess when a unit has a buff, they are treated as having that "ability". I don't know).

Hope that helps.
 
Level 23
Joined
Nov 29, 2006
Messages
2,482
There is one you could do...
(I may not post it with right gui-look)

You can find it under the integer condition section
  • If - Conditions
    • (Level of "Your Ability" for "unit" is greater than 0)
If the unit would not have the ability, it will always result to zero, thus a similarity to "false"
 
Status
Not open for further replies.
Top