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

Reducing Damage Taken

Status
Not open for further replies.
Level 31
Joined
Jun 27, 2008
Messages
2,557
Hello.

How to reduce damage taken by unit by exactly 40 percent? For example when certain item have been consumed.

I tried playing with damage detection system, I detect the amount taken, then immediately set life of unit to life of unit + damage taken x 0.4, yet for some reason this did not work at all, it still took full damage. I also tried spell book with Defend spell, giving it to unit, ordering to activate Defend and then disabling spellbook for player, it won't work either.

Help would be appreciated. Thanks.
 
Last edited:
Level 31
Joined
Jun 27, 2008
Messages
2,557
But why it would not work then? Perhaps I did something wrong. There is a trigger that detect damage, another for variables and so the third one to apply floating text. Immedaitely after floating text I set unit's life to unit's life + damage taken x 0.4, but it take same amount of damage ignoring this action, no idea why.
 
Level 21
Joined
Mar 27, 2012
Messages
3,232
But why it would not work then? Perhaps I did something wrong. There is a trigger that detect damage, another for variables and so the third one to apply floating text. Immedaitely after floating text I set unit's life to unit's life + damage taken x 0.4, but it take same amount of damage ignoring this action, no idea why.

Damage event happens before damage is done.

Regardless, I use Cokemonkey's DDS. With that I simply have one variable for most things. The variable is initially set to damage amount. If I change it, then the amount of effective damage changes accordingly. It's incredibly useful.
 
Level 19
Joined
Aug 8, 2007
Messages
2,765
I see. Alright, I'll try experimenting with other damage detection systems, thanks.

From your first post, it seems like your setting unit life on damage hit.

Most DDSes come with a "modify damage" option. In Nestharus's DDS, its a variable modifiedDamage. To reduce damage dealt by 40% just do

modifiedDamage = modifiedDamage * 0.6 [40% of 1]

bribe's GUI can be done similarly

Variable - Set DamageModifiedAmount to (DamageModifiedAmount * 0.6).

Your unit life settings are being skipped because the DDS inflates the unit's hp to full while the user DDS functions are being run so that it can re-deal the user-specified damage.
 
Level 30
Joined
Nov 29, 2012
Messages
6,637
I would really suggest DDS bro. Thats the most easiest way, DDS. You just have to read maybe some tips and instructions before DL-int to be in safe side or ask the creator. A best example of course would be Nes' DDS (pardon me if this is already said or linked above me, no need to comment though just pardon, thanks!).

DDS can detect damage and through it you can have many advantages and its just up to you what to do after damage is detected.
 
From your first post, it seems like your setting unit life on damage hit.

Most DDSes come with a "modify damage" option. In Nestharus's DDS, its a variable modifiedDamage. To reduce damage dealt by 40% just do

modifiedDamage = modifiedDamage * 0.6 [40% of 1]

bribe's GUI can be done similarly

Variable - Set DamageModifiedAmount to (DamageModifiedAmount * 0.6).

Your unit life settings are being skipped because the DDS inflates the unit's hp to full while the user DDS functions are being run so that it can re-deal the user-specified damage.

Do you mean

set damage = damage*.6 ?

edit
I believe OP is a GUI person
 
Status
Not open for further replies.
Top