• 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.

Dealed/Taken damage calculating

Status
Not open for further replies.
Level 3
Joined
Sep 20, 2010
Messages
29
Hey guys! I need a skill that will reflect half of damage with n% chance.
I have only one idea - to add damage taken value to attacked unit's hp and subtract damage dealed/2 value from attacking unit's hp. The question is simple - how to calculate dealed and taken damage values? Tried to use default Damage Taken func, but it doesn't want to work (because of my nooby skill, of course)
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
You implement this system in your map.
Then, when damage is detected, check if a random integer between 1 and 100 is less than or equal to n (this will give an n% chance).
If so, deal 0.5 * DamageEventAmount damage.

  • Reflect Damage
    • Events
      • Game - DamageEvent becomes Equal to 1.00
    • Conditions
    • 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 50
        • Then - Actions
          • Set DamageEventOverride = True
          • Unit - Cause DamageEventTarget to damage DamageEventSource, dealing (0.50 x DamageEventAmount) damage of attack type Spells and damage type Normal
          • Set DamageEventOverride = False
        • Else - Actions
This does not make a difference between spells/physical attacks.
It's still a great system though :D.
 
If you just want physical (auto attack) damage to be reflected, you can also use the defend ability, but I recommend using a damage detection system.

There's been a recent discovery that's much better for detecting physical attacks - jass versions are already available for both DamageEvent and StructuredDD libraries. Surely a GUI one will be available soon.
 
Status
Not open for further replies.
Top