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

Evasion with Cooldown

Status
Not open for further replies.
Level 1
Joined
Feb 12, 2020
Messages
1
I'm trying to create a guaranteed Evasion passive that has a cooldown - for example, a unit is guaranteed to evade an attack, but can only do so once every 5 seconds. I thought that I could do so by adding a value to the "Stats - Cooldown" field for an Evasion ability, but apparently not! Does anyone know how to achieve such a thing?

Thank you!
 
Level 1
Joined
Feb 3, 2020
Messages
7
I don't think Evasion is natively coded for that. You might have to create a triggered passive ability, and just capture when a unit is attacked, nullify the damage, and then set a timer to be allowed again.
 
Level 24
Joined
Feb 9, 2009
Messages
1,787
A damage detection system would make this easy, I'd recommend Bribe's
  1. Detect hit on units with the evasion ability but no "cooldown" debuff
  2. cast a debuff "cooldown" like cripple with no stat and duration for 5 seconds
  3. set the damage to zero.
  4. repeat
 
Level 39
Joined
Feb 27, 2007
Messages
5,023
You can either evaluate it in JASS and set a boolean variable equal to it that you then compare to true, or (in this case) just assign a real variable to the output of that function and compare it as normal:
  • Custom script: set udg_BoolVar = BlzGetUnitAbilityCooldownRemaining(...) <= 0.00
  • If (All conditions are true) then do (Then actions) else do (Else actions)
    • If - Conditions
      • BoolVar equal to True
    • Then - Actions
      • -------- ... --------
    • Else - Actions
  • Custom script: set udg_RealVar = BlzGetUnitAbilityCooldownRemaining(...)
  • If (All conditions are true) then do (Then actions) else do (Else actions)
    • If - Conditions
      • RealVar less than or equal to 0.00
    • Then - Actions
      • -------- ... --------
    • Else - Actions
 
Status
Not open for further replies.
Top