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

Me VS Math again. Percentage base damage.

Status
Not open for further replies.
Level 17
Joined
Jun 2, 2009
Messages
1,137
Hello everyone. This spell takes directly 10% of the health of target. But i want to deal 10% of their "current" health as a damage.


Basically i want to reduce current health of the enemy by 10%

If the enemy unit has 2000 health i want to deal 200 damage
When it's health drops to 1800, i want to deal 180 damage etc etc goes on like this.

  • Unit - Cause (Casting unit) to damage (Target unit of ability being cast), dealing ((Life of (Target unit of ability being cast)) x (10.00 / 100.00)) damage of attack type Chaos and damage type Unknown
 

Wrda

Spell Reviewer
Level 26
Joined
Nov 18, 2012
Messages
1,887
This spell takes directly 10% of the health of target. But i want to deal 10% of their "current" health as a damage.
"Taking directly 10% of the health of the target" already implies it's the current health.
Basically i want to reduce current health of the enemy by 10%

If the enemy unit has 2000 health i want to deal 200 damage
When it's health drops to 1800, i want to deal 180 damage etc etc goes on like this.

  • Unit - Cause (Casting unit) to damage (Target unit of ability being cast), dealing ((Life of (Target unit of ability being cast)) x (10.00 / 100.00)) damage of attack type Chaos and damage type Unknown
"life of (whatever unit)" is the current health, so I don't know what you're talking about when you say this doesn't work. How much damage difference does it take before and after the applied one?
Are you sure you're not accounting for the armor type? Attack type Chaos considers amount of armor.
 
Last edited:
Level 17
Joined
Jun 2, 2009
Messages
1,137
"Taking directly 10% of the health of the target" already implies it's the current health.

"life of (whatever unit)" is the current health, so I don't know what you're talking about when you say this doesn't work. How much damage difference does it take before and after the applied one?
Are you sure you're not accounting for the armor type? Attack type Chaos considers amount of armor.
No it was not about the armor and attack type but it seems Lordul Dracula solved my issue.

  • Unit - Cause (Casting unit) to damage (Target unit of ability being cast), dealing ((Life of (Target unit of ability being cast)) x (10.00 / 100.00)) damage of attack type Chaos and damage type Unknown
I was thinking it is gonna work like this but he did it like this

  • Unit - Cause (Casting unit) to damage (Target unit of ability being cast), dealing ((Life of (Target unit of ability being cast)) / 10.00) damage of attack type Chaos and damage type Unknown
Yes it works but here is another question.
I have tried to make it 50% instead of 10% but why it deals 20 damage to unit with 1000 HP
1000 to 980 when i change / 10.00 with 50.00? How this is works?

Edit: Ok just figured it out. I have to divide it 4 for the make it %25. Thank you so much everyone.
 
Last edited:

Wrda

Spell Reviewer
Level 26
Joined
Nov 18, 2012
Messages
1,887
  • Unit - Cause (Casting unit) to damage (Target unit of ability being cast), dealing ((Life of (Target unit of ability being cast)) x (10.00 / 100.00)) damage of attack type Chaos and damage type Unknown
I was thinking it is gonna work like this but he did it like this

  • Unit - Cause (Casting unit) to damage (Target unit of ability being cast), dealing ((Life of (Target unit of ability being cast)) / 10.00) damage of attack type Chaos and damage type Unknown
They're equivalent and have the same result. Y * (10 / 100) = Y * 1 / 10 = Y / 10
Yes it works but here is another question.
I have tried to make it 50% instead of 10% but why it deals 20 damage to unit with 1000 HP
1000 to 980 when i change / 10.00 with 50.00? How this is works?
Because dividing by 50 is 2%, not 50%. This has everything to do with proportions. How do we know? 1/100 is 1%, 2/100 is 2%. Now simply the latter: 2/100 -> 1/50. Anyway, this isn't a very intuitive way to work with, so either stick with the 1-100 range or 0.01-1 range.
 
Status
Not open for further replies.
Top