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

Blocking ranged damage by %

Status
Not open for further replies.
Level 12
Joined
Mar 23, 2008
Messages
942
I did a spell based in defend that makes my unit slower (both MS and AS) and enable him to only take 20% of ranged attacks, but I found that defend only works with piercing attacks. I need to work with all kinds of ranged attacks (at least, unit ranged attacks).

I also found that hardened skin don't accept % values :(
Any ideas?
 
Level 11
Joined
May 31, 2008
Messages
698
  • Untitled Trigger 003
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • ((Attacking unit) is A ranged attacker) Equal to True
    • 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 25 <--- 25% chance to use
        • Then - Actions
          • Set Health = (Life of (Triggering unit))
          • Wait until (Health Greater than (Life of (Triggering unit))), checking every 0.10 seconds
          • Unit - Set life of (Triggering unit) to ((Life of (Triggering unit)) + ((Health - (Life of (Triggering unit))) x 0.80 <-- Reduces atk by 80%))
        • Else - Actions
This should work. I tested it, there were some bugs but only when there were multiple units attacking. This shouldnt be a problem especially if there is only one unit on the map that has this ability, but if there are multiple just use variables. Also note that the attacked units hp does go down, but then back up quickly, so it actually gains back the hp, prolly a .1 second delay for it to regain the hp
 
Level 12
Joined
Mar 23, 2008
Messages
942
  • Untitled Trigger 003
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • ((Attacking unit) is A ranged attacker) Equal to True
    • 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 25 <--- 25% chance to use
        • Then - Actions
          • Set Health = (Life of (Triggering unit))
          • Wait until (Health Greater than (Life of (Triggering unit))), checking every 0.10 seconds
          • Unit - Set life of (Triggering unit) to ((Life of (Triggering unit)) + ((Health - (Life of (Triggering unit))) x 0.80 <-- Reduces atk by 80%))
        • Else - Actions
This should work. I tested it, there were some bugs but only when there were multiple units attacking. This shouldnt be a problem especially if there is only one unit on the map that has this ability, but if there are multiple just use variables. Also note that the attacked units hp does go down, but then back up quickly, so it actually gains back the hp, prolly a .1 second delay for it to regain the hp

Uhm, Sry but I don't think that will work for me...
I'm using a plain damage reduction til find a way to block % damage...
 
Level 11
Joined
May 31, 2008
Messages
698
Maybe im not understanding you or your not understanding me. Do you want a chance to block ALL damage? Or just something that always takes away a % of damage like it would take 80 damage instead of 100 if it blocked 20%
 
Level 12
Joined
Mar 23, 2008
Messages
942
Maybe im not understanding you or your not understanding me. Do you want a chance to block ALL damage? Or just something that always takes away a % of damage like it would take 80 damage instead of 100 if it blocked 20%

I'm using hardened skin with only ranged blocking.

So, I want a spell that all ranged attacks done to my hero are reduced by: 20/35/50/65/80 %
If someone hits you for 100 damage, you will only take 20 with 80% reduction.

But your trigger is not perfect, and will probably lead to lots of errors in my map, like a unit get attacked by a ranged attack and get hit by a nuke spell and the nuke is annulled...
Also wait checking for conditions leaks and is not accuracy.
 
Level 8
Joined
Nov 9, 2008
Messages
502
I'm using hardened skin with only ranged blocking.

So, I want a spell that all ranged attacks done to my hero are reduced by: 20/35/50/65/80 %
If someone hits you for 100 damage, you will only take 20 with 80% reduction.

But your trigger is not perfect, and will probably lead to lots of errors in my map, like a unit get attacked by a ranged attack and get hit by a nuke spell and the nuke is annulled...
Also wait checking for conditions leaks and is not accuracy.

It really leaks? I use these often, is it that bad?
 
Level 12
Joined
Mar 16, 2006
Messages
992
I would just swap the icons and descriptions. Make piercing, ranged; and make ranged, piercing.

In fact, I'm going to do that now seeing how I plan on using Defend in the future too.
 
Level 11
Joined
May 31, 2008
Messages
698
well it worked when i used it and this trigger does block percentage of damage
If someone hits you for 100 damage, you will only take 20 with 80% reduction.
Thats what it would do. But if it leaks and you think it would mess up your map then i guess you shouldnt use it. And i guess ur right about the nuke thing
 
Status
Not open for further replies.
Top