• 🏆 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 Critical Strike

Status
Not open for further replies.
Level 2
Joined
Jun 9, 2018
Messages
10
Can somebody please help me. I want to create an ability wherein the unit has an evasion passive skill and whenever the unit evades an attack, the unit's next attack will deal double damage.
Thank you in advance. :cute:
 
Level 39
Joined
Feb 27, 2007
Messages
4,994
There is, as far as I know, no way to detect evasion in wc3 short of triggering the evade yourself by using a damage detection system. There WILL be native "a unit evades an attack" events once the 1.30 patch drops, but as of right now I believe they are currently not functional even on the PTR. Your solution with a DDS installed would look something like:
  • Events
    • Map Initialization
  • Conditions
  • Actions
    • Player Group - Pick every player in (All Players) and do (Actions)
      • Loop - Actions
        • Player - Disable CRIT_SPELLBOOK for (picked player)
  • -------- --------
  • -------- --------
  • Events
    • -------- whatever event runs your dds --------
  • Conditions
    • -------- any conditions the DDS needs to run --------
  • Actions
    • -------- EVADING_UNIT is probably just Triggering Unit here, but in case there's another way to get it from your DDS I wrote it as a variable --------
    • -------- SOURCE_OF_ATTACK and DAMAGED_UNIT might be different depending on which DDS you use --------
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Level of CRIT_SPELLBOOK for SOURCE_OF_ATTACK) greater than 0
      • Then - Actions
        • Unit - Remove CRIT_SPELLBOOK from EVADING_UNIT //I don't think this will cancel the crit because it already 'happened' to fire this trigger
      • Else - Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Level of EVADE_SKILL for DAMAGED_UNIT) greater than 0
        • (Random integer from 1 to 100) less than or equal to 25 //the unit has a 25% chance to evade
      • Then - Actions
        • -------- do your dds stuff to prevent the damage (they usually have heal functions to avoid units dying when they should live to reduced damage) --------
        • -------- display any "evaded!" floating text you may want here --------
        • Unit - Add CRIT_SPELLBOOK to EVADING_UNIT
      • Else - Actions
What is CRIT_SPELLBOOK? It's an ability based on Spellbook (item ability 'Aspb') that holds the crit strike passive. You make a 100% chance crit strike, and then add that passive ability to the new spellbook you just created. Remove all other spells from the new spellbook (in the Object Editor of course), set its min and max # of spells to 1, and make it a unit ability. When the first trigger I posted runs it will disable the spellbook so it doesn't show up on the UI/command card. however the passive INSIDE it is still there and still works just fine, so you will actually crit every attack even though you can't see any icon for the skill. After 1 attack we remove the crit ability.
 
Level 18
Joined
Nov 21, 2012
Messages
835
/I don't think this will cancel the crit because it already 'happened' to fire this trigger
I had similar idea to add/remove abilities in my project, but removing it on event "unit takes damage" will not work.
I used "pulverize" but critical strike should work the same way. Damage is not applied, moreover unit is buggged: it will permanently use "attack slam" animation. I solved it be removing ability after 0.01sec timer. The diffrence was also that I used x,y 0/-11 to hide ability on UI instead of using spell book.
 
Level 2
Joined
Jun 9, 2018
Messages
10
I made it using lfh's dds! :grin:
Anyways thank you for help guys +rep :thumbs_up:

  • DDS On
    • Events
      • Game - PDD_damageEventTrigger becomes Equal to 1.00
    • Conditions
    • Actions
      • -------- XXXXXXXXXXXXXXXXXXXX Evasion On XXXXXXXXXXXXXXXXXXXX --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • PDD_target Equal to Unit_Archer[0]
          • (Level of Evasion Real for Unit_Archer[0]) Less than 1
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Random integer number between 1 and 100) Less than or equal to (Integer(((Current movement speed of Unit_Archer[0]) x 0.05)))
            • Then - Actions
              • Unit - Add Evasion Real to Unit_Archer[0]
              • Unit - Add Evasion Critical to Unit_Archer[0]
              • Wait 0.70 seconds
              • Unit - Remove Evasion Real from Unit_Archer[0]
            • Else - Actions
        • Else - Actions
      • -------- XXXXXXXXXXXXXXXXXXXX Evasion Function XXXXXXXXXXXXXXXXXXXX --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • PDD_source Equal to Unit_Archer[0]
          • (Level of Evasion Critical for Unit_Archer[0]) Greater than or equal to 1
        • Then - Actions
          • Wait 0.50 seconds
          • Unit - Remove Evasion Critical from Unit_Archer[0]
        • Else - Actions
 
Level 39
Joined
Feb 27, 2007
Messages
4,994
Just so you know those waits are not precise and if the unit has an attack speed greater than roughly (since Wait 0.50 does not always wait exactly 0.50 seconds) 1/0.70 = 1.43 it will break the trigger by attacking again before the crit and evasion abilities are removed. Also the unit will evade ALL incoming attacks until the wait finishes, potentially allowing it to dodge more than one attack. Technicalities, but worth considering if you care or notice it behaving weirdly.
 
Status
Not open for further replies.
Top