• 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.
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!
  • ✅ The POLL for Hive's Texturing Contest #34 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!
  • ✅ The POLL for Hive's Techtree Contest #20 is OPEN! Vote for the TOP 3 FACTIONS! 🔗Click here to cast your vote!

Evasion and Critical with agility

Level 2
Joined
Jul 1, 2020
Messages
8
Hello, i making a RPG map and i want to use agility that influence the chance of the hide passive of Evasion and Critical Strike with a trigger, i been looking but i don't find a clear solution to do this.
 
How about creating an evasion with 99 levels, from 1% evasion to 99% evasion. Give to all heroes.
Then make a trigger with a periodic event to set the level of the Evasion to the % you want based on that hero's agility.
For example, if 2 agility = 1% evasion. You'd set ability level to Hero's agility / 2.
 
You can trigger it all to have flexibility, here are the bare bones of a system (reforged needed for this useful event in GUI):

  • Evasion
    • Events
      • Unit - A unit About to take damage
    • Conditions
      • ((Triggering unit) is A Hero) Equal to True
      • (Damage From Normal Attack) Equal to True
    • Actions
      • Set VariableSet EvadeChances = (Real((Agility of (Triggering unit) (Include bonuses))))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Random real number between 0.00 and 100.00) Less than or equal to EvadeChances
        • Then - Actions
          • -------- Cancel the damage --------
          • Event Response - Set Damage of Unit Damaged Event to 0.00
          • -------- Show a little text like the real evasion --------
          • Floating Text - Create floating text that reads |c00FF0000miss!|r above (Damage source) with Z offset 0.00, using font size 9.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
          • Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
          • Floating Text - Change (Last created floating text): Disable permanence
          • Floating Text - Change the lifespan of (Last created floating text) to 2.00 seconds
          • Floating Text - Change the fading age of (Last created floating text) to 1.00 seconds
        • Else - Actions
  • Crit
    • Events
      • Unit - A unit About to take damage
    • Conditions
      • ((Damage source) is A Hero) Equal to True
      • (Damage From Normal Attack) Equal to True
    • Actions
      • Set VariableSet CritChances = (Real((Agility of (Damage source) (Include bonuses))))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Random real number between 0.00 and 100.00) Less than or equal to CritChances
        • Then - Actions
          • -------- Deal double damage or whatever value you want --------
          • Event Response - Set Damage of Unit Damaged Event to ((Damage taken) x 2.00)
          • -------- Show a little text like the real crit --------
          • Floating Text - Create floating text that reads (|c00FF0000 + ((String((Integer((Damage taken))))) + !|r)) above (Damage source) with Z offset 0.00, using font size 9.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
          • Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
          • Floating Text - Change (Last created floating text): Disable permanence
          • Floating Text - Change the lifespan of (Last created floating text) to 2.00 seconds
          • Floating Text - Change the fading age of (Last created floating text) to 1.00 seconds
        • Else - Actions
You can add conditions and probably array based on how many heroes can benefit from those, and do something about the text so that it doesn't overlap, but that's basically it
 

Attachments

Sorry for replying so late, I haven't had time to review it.

From what I understand and what I've been testing, evasion and critical increases 1% for each point of agility, wouldn't that mean that having 100 agility would always cause critical hits and attacks would always miss?
 
OK thanks for the help.
I was able to find a way to balance it so that it works the way I want on my map.
I appreciated :thumbs_up:

Is there a way to limit the amount of evasion/critical hit that can increase? Like limiting evasion to more than 60%, for example? Eventually, agility will increase so much that evasion will increase too much, and I don't want the condition for increasing evasion to be so high that it becomes useless or never works.
 
Last edited by a moderator:
OK thanks for the help.
I was able to find a way to balance it so that it works the way I want on my map.
I appreciated :thumbs_up:

Is there a way to limit the amount of evasion/critical hit that can increase? Like limiting evasion to more than 60%, for example? Eventually, agility will increase so much that evasion will increase too much, and I don't want the condition for increasing evasion to be so high that it becomes useless or never works.
You can make an if / then / else like:

If hero agility greater than X
Then set evasion rate to X%
Else set evasion rate to Agility x X%

Or you can find a math formula to make the evasion / critical % not linear. Like 1 agility = 1%, 3 agility = 2%, 6 agility = 3%... But you need to be good at math to do it and I'm not hehe.
 
Hey, I was thinking about the math on this...
Here's a formula based on the Armor damage reduction formula for WC3.

((Agility*0,01)/(1+Agility*0,01))*100

This gives back
1 = 0.99% 5 = 4,7%
10 = 9% 15 = 13%
20 = 16% 30 = 23%
50 = 33% 100 = 50%
200 = 66% 300 = 75%
1000 = 90% 3000 = 96%

You'll get a graph like this:
View attachment 542511

You can change the value of 0,01 to other numbers to change how fast or how slow the progression goes (bigger numbers will progress faster and smaller numbers will progress slower).
The armor formula uses 0.06 for example giving about 5% variation for every point initially, but this formula will never go above 100%.
 
You can just use "Math - Min" function which returns whichever value is lower out of the two arguments. As one parameter provide your calculated chance, as other provide your cap/max value. Works for both reals and integers.
For example:
  • Set VariableSet crit_chance = "some calculation that can possibly get number over 60.00"
  • Set VariableSet crit_chance = (Min(crit_chance, 60.00)) //this caps the chance at 60.00 max
 
Back
Top