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

[Trigger] Increase heal effectiveness

Status
Not open for further replies.
  • Heal By Missing Health
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Heal
    • Actions
      • Set TempUnit = (Target unit of ability being cast)
      • Set Real1 = ((Max life of TempUnit) x 0.10) <-- this finds out what 10% of the unit's max health is
      • Set Real2 = (((Max life of TempUnit) - (Life of TempUnit)) / Real1) <-- this finds out how many times 10% of the max health is missing.
      • Set HealStrength = 25 <--This is whatever the base healing is.
      • Unit - Set life of TempUnit to ((Life of TempUnit) + (HealStrength x Real2)) <-- multiply healing power by how many times 10% is missing.
Ok, this shoooooould work, but I can't really test that right now, so hopefully my math is right.
 
Level 21
Joined
Nov 4, 2013
Messages
2,017
  • Heal By Missing Health
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Heal
    • Actions
      • Set TempUnit = (Target unit of ability being cast)
      • Set Real1 = ((Max life of TempUnit) x 0.10) <-- this finds out what 10% of the unit's max health is
      • Set Real2 = (((Max life of TempUnit) - (Life of TempUnit)) / Real1) <-- this finds out how many times 10% of the max health is missing.
      • Set HealStrength = 25 <--This is whatever the base healing is.
      • Unit - Set life of TempUnit to ((Life of TempUnit) + (HealStrength x Real2)) <-- multiply healing power by how many times 10% is missing.
Ok, this shoooooould work, but I can't really test that right now, so hopefully my math is right.

This will not work perfectly. It will activate even when, for example, 25% HP is missing. Let's say a unit has 200 HP and lost 25%. Now it's 150. Based on your calculation (200- 150) / 20 = 2.5
It means that the healing will be multiplied by 2.5 but that's not what the user asks for. It should be 2 because the 10% was lost twice only. Also, the user still didn't clarify how he would like the heal to be incremented. Why multiplying by HealStrength? Maybe he wants to 5 extra HP healed for every 10% HP missing.
ninehell, you need to give me more info before I can concoct a trigger about this.
 
Level 6
Joined
Jan 2, 2015
Messages
171
This will not work perfectly. It will activate even when, for example, 25% HP is missing. Let's say a unit has 200 HP and lost 25%. Now it's 150. Based on your calculation (200- 150) / 20 = 2.5
It means that the healing will be multiplied by 2.5 but that's not what the user asks for. It should be 2 because the 10% was lost twice only. Also, the user still didn't clarify how he would like the heal to be incremented. Why multiplying by HealStrength? Maybe he wants to 5 extra HP healed for every 10% HP missing.
ninehell, you need to give me more info before I can concoct a trigger about this.

healing multiplied by 2.5 would be OP. i want the heal effectiveness increase by 11% on every 10% hp loss
 
Level 24
Joined
Aug 1, 2013
Messages
4,657
Dat calculation wont work indeed.
First of all I would consider making it increase by 1.1% for each 1% of missing health instead of 11% per 10%.

The calculation would be: BaseHealValue * (1.1 * ((CurrentLife / MaxLife) *100))

The calculation for per 10% would be that ((CurrentLife / MaxLife) *100) would be reduced by the Modulo of that value and 10 (Modulo(TempReal, 10)).
 

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,188
The calculation would be: BaseHealValue * (1.1 * ((CurrentLife / MaxLife) *100))
Might want to brush up on your mathematics...

Code:
FinalHealValue = BaseHealValue * (1 + 1.1 * (1 - CurrentLife / MaxLife))
// CurrentLife / MaxLife -> current life fraction
// (1 - CurrentLife / MaxLife) -> current life missing fraction
// 1.1 -> fractional form of healing power bonus when unit has 0% health (110%)
// 1.1 * (1 - CurrentLife / MaxLife) -> work out the healing bonus to apply as a fraction
// (1 + 1.1 * (1 - CurrentLife / MaxLife)) -> work out the power fraction to apply by adding the bonus fraction to the default damage fraction of 1
// BaseHealValue * (1 + 1.1 * (1 - CurrentLife / MaxLife)) -> work out heal amount by applying the power fraction

This formula applies a linear increase as health is lost. If you want a stepped increase you will need some form of rounding procedure. This would be applied to the current life fraction part (or current life missing fraction part).
 
Level 6
Joined
Jan 2, 2015
Messages
171
yea sorry it is indeed 1-CurrentLife/MaxLife

  • heal primal amount
    • Events
      • Game - DamageModifierEvent becomes Equal to 1.00
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • DamageEventType Equal to 0
      • (Ability being cast) Equal to Healing Touch Primal
    • Actions
      • Unit - Set life of DamageEventTarget to ((Life of DamageEventTarget) + (400.00 x (1.00 + (1.10 x (1.00 - ((Life of DamageEventTarget) / (Max life of DamageEventTarget)))))))
      • Set DamageEventAmount = (400.00 x (1.00 + (1.10 x (1.00 - ((Life of DamageEventTarget) / (Max life of DamageEventTarget))))))
      • Set DamageEventHeal = (+ + (String((Integer(DamageEventAmount)))))
      • Floating Text - Create floating text that reads DamageEventHeal above DamageEventTarget with Z offset 0.00, using font size 10.00, color (0.00%, 100.00%, 0.00%), and 0.00% transparency
      • Floating Text - Change (Last created floating text): Disable permanence
      • Floating Text - Set the velocity of (Last created floating text) to 50.00 towards 90.00 degrees
      • Floating Text - Change the lifespan of (Last created floating text) to 1.00 seconds
      • Floating Text - Change the fading age of (Last created floating text) to 0.50 seconds
      • Custom script: call RemoveLocation(udg_TempPoint)
is this the correct formula?
 

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,188
Why not this?
  • Set DamageEventAmount = (400.00 x (1.00 + (1.10 x (1.00 - ((Life of DamageEventTarget) / (Max life of DamageEventTarget))))))
  • Unit - Set life of DamageEventTarget to ((Life of DamageEventTarget) + (DamageEventAmount))
Easier to maintain and more efficient as it only computes it once.
 
Status
Not open for further replies.
Top