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

Negative Damage = Heal?

Status
Not open for further replies.
Level 20
Joined
Jul 14, 2011
Messages
3,213
Hi!

I was messing with 'Unit - Cause damage' and noticed that Negative damage is not equal to heal. Even the 'Healing' (Negative damage) amount is displayed over the unit (floating text), but the hp goes down anyway (the unit deals 1-1 wc3 nontrigger damage). If I give damage reduction over 1 (which would mean over 100%) doesn't heal either.

If it doesn't work like that, what's the next best option? 'Set unit life + Unit life + Damage' ?

This is my current damage setting:

  • Damage Itself
    • Events
      • Game - GDD_Event becomes Equal to 0.00
    • Conditions
    • Actions
      • -------- DamagedUnit and DamageSource Id's --------
      • Custom script: set udg_I_DS = GetUnitTypeId(udg_GDD_DamageSource)
      • Custom script: set udg_I_DU = GetUnitTypeId(udg_GDD_DamagedUnit)
      • -------- Damage Types (Odd) and Resistances (Even) --------
      • Set PD = ((Load 1 of I_DS from DamageHash) x (1.00 - (Load 2 of I_DU from DamageHash)))
      • Set FD = ((Load 3 of I_DS from DamageHash) x (1.00 - (Load 4 of I_DU from DamageHash)))
      • Set WiD = ((Load 5 of I_DS from DamageHash) x (1.00 - (Load 6 of I_DU from DamageHash)))
      • Set ED = ((Load 7 of I_DS from DamageHash) x (1.00 - (Load 8 of I_DU from DamageHash)))
      • Set WaD = ((Load 9 of I_DS from DamageHash) x (1.00 - (Load 10 of I_DU from DamageHash)))
      • Set PuD = (Load 11 of I_DS from DamageHash)
      • -------- Total Damage --------
      • Custom script: set udg_Dmg = udg_PD + udg_FD + udg_WiD + udg_ED + udg_WaD + udg_PuD
      • -------- Display Red Damage --------
      • Custom script: if (GetUnitState( udg_GDD_DamagedUnit, UNIT_STATE_LIFE) - udg_Dmg ) < GetUnitState( udg_GDD_DamagedUnit, UNIT_STATE_LIFE) then
      • Floating Text - Create floating text that reads (String((Integer(Dmg)))) above GDD_DamagedUnit with Z offset 0.00, using font size 8.00, color (100.00%, 0.00%, 0.00%), and 0.00% transparency
      • Floating Text - Change (Last created floating text): Disable permanence
      • Floating Text - Change the lifespan of (Last created floating text) to 2.00 seconds
      • Floating Text - Change the fading age of (Last created floating text) to 1.00 seconds
      • Floating Text - Set the velocity of (Last created floating text) to 75.00 towards 90.00 degrees
      • -------- Display Green Heal --------
      • Custom script: elseif (GetUnitState( udg_GDD_DamagedUnit, UNIT_STATE_LIFE) - udg_Dmg ) > GetUnitState( udg_GDD_DamagedUnit, UNIT_STATE_LIFE) then
      • Unit - Set life of GDD_DamagedUnit to ((Life of GDD_DamagedUnit) - Dmg)
      • Floating Text - Create floating text that reads (String((Integer((Abs(Dmg)))))) above GDD_DamagedUnit with Z offset 0.00, using font size 8.00, color (0.00%, 100.00%, 0.00%), and 0.00% transparency
      • Floating Text - Change (Last created floating text): Disable permanence
      • Floating Text - Change the lifespan of (Last created floating text) to 2.00 seconds
      • Floating Text - Change the fading age of (Last created floating text) to 1.00 seconds
      • Floating Text - Set the velocity of (Last created floating text) to 75.00 towards 90.00 degrees
      • Custom script: endif
      • -------- Deal Damage if it's > 0 --------
      • Trigger - Turn off (This trigger)
      • Custom script: if udg_Dmg > 0 then
      • Custom script: call UnitDamageTarget(udg_GDD_DamageSource, udg_GDD_DamagedUnit, udg_Dmg, true, false, ATTACK_TYPE_HERO, DAMAGE_TYPE_NORMAL, null)
      • Custom script: endif
      • Trigger - Turn on (This trigger)
EDIT: Improved the trigger following Ultimatony and Maker suggestions.
 
Last edited:
Level 8
Joined
Dec 9, 2009
Messages
397
Problem is your adding a negative, which is subtracting. so, add this:

if
damage < 0
Set Damage = Damage - (Damage * 2 )


That should convert it.

Or use
if damage < 0
set unit hp = current hp - damage
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
Good News!
attachment.php


Life nevers goes to max, but max-1. I can live with that. Thanks to both of you! Also improved the script a bit (Updated the Trigger in the first post), by dealing "udg_Damage" instead of each one of the damages independently.

Right now Damage is 100, and Resistance is 150%. (just for testing)
 

Attachments

  • Damage.jpg
    Damage.jpg
    41.4 KB · Views: 735
Level 8
Joined
Dec 9, 2009
Messages
397
Are you causing all of your damage with triggers?
You could set armor to reduce all damage from normal type to 0
and just have your triggered damage be chaos damage.
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
Yes, I'm triggering all my damage, and no, my units deal 1-1 damage. I don't worry anyway. I haven't set the constant damage/armor values to 0.

Good baassee, I'l try it like that. Seems faster/lighter, since it retrieves less data.

Thanks for answers/Suggestions.
 
Status
Not open for further replies.
Top