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

Damage Engine applies damage and the stops working

Level 9
Joined
Jun 13, 2010
Messages
365
I made this trigger using Bribe's Damage Engine. The first time Holy Light (based on Finger of Death) heals 200 (base from spell) + 12 from 0,75 intelligence ratio. The second time I cast it and onwards it only heals 200 (and skips the intelligence ratio). What am I doing wrong?

Damage Engine trigger:
  • Holy Light Damage and Heal
    • Events
      • Game - PreDamageEvent becomes Greater than -1.00
    • Conditions
    • Actions
      • Custom script: //! runtextmacro DAMAGE_TRIGGER_CONFIG()
      • Set VariableSet DamageFilterSourceA = Holy Light
      • Set VariableSet StatUnit = DamageEventSource
      • Trigger - Run Stat Calculator <gen> (checking conditions)
      • Set VariableSet DamageEventAmount = (DamageEventAmount + (0.75 x (Real(StatINT))))
      • Custom script: //! runtextmacro DAMAGE_TRIGGER_CONFIG_END()
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Owner of DamageEventTarget) is an ally of (Owner of DamageEventSource).) Equal to True
        • Then - Actions
          • Set VariableSet DamageEventAmount = (0.00 - DamageEventAmount)
          • Set VariableSet DamageEventOverride = True
        • Else - Actions
Stat Calculator trigger (if needed):
  • Stat Calculator
    • Events
    • Conditions
    • Actions
      • Set VariableSet StatHP = (Life of StatUnit)
      • Set VariableSet StatHPMax = (Max life of StatUnit)
      • Set VariableSet StatMP = (Mana of StatUnit)
      • Set VariableSet StatMPMax = (Max mana of StatUnit)
      • Set VariableSet StatAR = (Armor of StatUnit)
      • Set VariableSet StatAD = (Base Damage of StatUnit for weapon index 0)
      • Set VariableSet StatCritChance = StatCritChanceArray[(Player number of (Owner of StatUnit))]
      • Set VariableSet StatCritMultiplier = StatCritMultiplierArray[(Player number of (Owner of StatUnit))]
      • Set VariableSet StatThornsChance = StatThornsChanceArray[(Player number of (Owner of StatUnit))]
      • Set VariableSet StatThornsValue = StatThornsValueArray[(Player number of (Owner of StatUnit))]
      • Set VariableSet StatRecastChance = StatRecastChanceArray[(Player number of (Owner of StatUnit))]
      • Set VariableSet StatAGI = (Agility of Hero_Array[(Player number of (Owner of StatUnit))] (Include bonuses))
      • Set VariableSet StatSTR = (Strength of Hero_Array[(Player number of (Owner of StatUnit))] (Include bonuses))
      • Set VariableSet StatINT = (Intelligence of Hero_Array[(Player number of (Owner of StatUnit))] (Include bonuses))
      • Set VariableSet StatLevelHero = (Hero level of Hero_Array[(Player number of (Owner of StatUnit))])
      • Set VariableSet StatLevelUnit = (Level of StatUnit)
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,876
I'm not sure, but the weird Custom Script stuff looks suspicious. It's commented out // so I don't think it'd even do anything. I've never used DamageFilterSourceA or any kind of "filter" and couldn't find any information about them, but that may be an issue as well.

Anyway, here's some optimizations plus a more normalized trigger. This is a setup that I know works (at least last I tried):
  • Holy Light Damage and Heal
    • Events
      • Game - DamageEvent becomes Equal to 1.00
    • Conditions
    • Actions
      • Set VariableSet StatUnit = DamageEventSource
      • Trigger - Run Stat Calculator <gen> (ignoring conditions)
      • Set VariableSet DamageEventAmount = (DamageEventAmount + (0.75 x (Real(StatINT))))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Owner of DamageEventTarget) is an ally of (Owner of DamageEventSource).) Equal to True
        • Then - Actions
          • Set VariableSet DamageEventAmount = (DamageEventAmount x -1.00)
        • Else - Actions
^ You'll eventually want to add Conditions to ensure it only runs on Holy Light. This type of spell is much better triggered from scratch without the needing of inversing the damage dealt (like I showed in that previous thread). It doesn't need to be this awkward.

Also, you can use an Integer to cache the Player Number instead of calling multiple functions to get it over and over again:
  • Stat Calculator
    • Events
    • Conditions
    • Actions
      • Set VariableSet StatPN = (Player number of (Owner of StatUnit)) <----
      • Set VariableSet StatHP = (Life of StatUnit)
      • Set VariableSet StatHPMax = (Max life of StatUnit)
      • Set VariableSet StatMP = (Mana of StatUnit)
      • Set VariableSet StatMPMax = (Max mana of StatUnit)
      • Set VariableSet StatAR = (Armor of StatUnit)
      • Set VariableSet StatAD = (Base Damage of StatUnit for weapon index 0)
      • Set VariableSet StatCritChance = StatCritChanceArray[StatPN]
      • Set VariableSet StatCritMultiplier = StatCritMultiplierArray[StatPN]
      • Set VariableSet StatThornsChance = StatThornsChanceArray[StatPN]
      • Set VariableSet StatThornsValue = StatThornsValueArray[StatPN]
      • Set VariableSet StatRecastChance = StatRecastChanceArray[StatPN]
      • Set VariableSet StatAGI = (Agility of Hero_Array[StatPN] (Include bonuses))
      • Set VariableSet StatSTR = (Strength of Hero_Array[StatPN] (Include bonuses))
      • Set VariableSet StatINT = (Intelligence of Hero_Array[StatPN] (Include bonuses))
      • Set VariableSet StatLevelHero = (Hero level of Hero_Array[StatPN])
      • Set VariableSet StatLevelUnit = (Level of StatUnit)
^ Running this trigger whenever a unit deals damage is pretty inefficient.
 
Last edited:
Level 9
Joined
Jun 13, 2010
Messages
365
I'm not sure, but the weird Custom Script stuff looks suspicious. It's commented out // so I don't think it'd even do anything. I've never used DamageFilterSourceA or any kind of "filter" and couldn't find any information about them, but that may be an issue as well.

Anyway, here's some optimizations plus a more normalized trigger. This is a setup that I know works (at least last I tried):
  • Holy Light Damage and Heal
    • Events
      • Game - DamageEvent becomes Equal to 1.00
    • Conditions
    • Actions
      • Set VariableSet StatUnit = DamageEventSource
      • Trigger - Run Stat Calculator <gen> (ignoring conditions)
      • Set VariableSet DamageEventAmount = (DamageEventAmount + (0.75 x (Real(StatINT))))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Owner of DamageEventTarget) is an ally of (Owner of DamageEventSource).) Equal to True
        • Then - Actions
          • Set VariableSet DamageEventAmount = (DamageEventAmount x -1.00)
        • Else - Actions
^ Obviously you'll eventually want to add Conditions to ensure it only runs on Holy Light. This type of spell is much better triggered from scratch without the needing of inversing the damage dealt (like I showed in that previous thread). It doesn't need to be this awkward.

Also, you can use an Integer to cache the Player Number instead of calling multiple functions to get it over and over again:
  • Stat Calculator
    • Events
    • Conditions
    • Actions
      • Set VariableSet StatPN = (Player number of (Owner of StatUnit)) <----
      • Set VariableSet StatHP = (Life of StatUnit)
      • Set VariableSet StatHPMax = (Max life of StatUnit)
      • Set VariableSet StatMP = (Mana of StatUnit)
      • Set VariableSet StatMPMax = (Max mana of StatUnit)
      • Set VariableSet StatAR = (Armor of StatUnit)
      • Set VariableSet StatAD = (Base Damage of StatUnit for weapon index 0)
      • Set VariableSet StatCritChance = StatCritChanceArray[StatPN]
      • Set VariableSet StatCritMultiplier = StatCritMultiplierArray[StatPN]
      • Set VariableSet StatThornsChance = StatThornsChanceArray[StatPN]
      • Set VariableSet StatThornsValue = StatThornsValueArray[StatPN]
      • Set VariableSet StatRecastChance = StatRecastChanceArray[StatPN]
      • Set VariableSet StatAGI = (Agility of Hero_Array[StatPN] (Include bonuses))
      • Set VariableSet StatSTR = (Strength of Hero_Array[StatPN] (Include bonuses))
      • Set VariableSet StatINT = (Intelligence of Hero_Array[StatPN] (Include bonuses))
      • Set VariableSet StatLevelHero = (Hero level of Hero_Array[StatPN])
      • Set VariableSet StatLevelUnit = (Level of StatUnit)
^ Running this trigger whenever a unit deals damage is pretty inefficient.

Okay it's working, thanks a lot. I honestly just copied Bribes example of healing from the original Damage Engine tester to understand how to convert damage to healing.

How would you recommend making a condition for Holy Light only? If I make a condition in the trigger for like
  • DamageFilterSourceA Equal to Holy Light
... it won't work. How else do I check for the damage source being Holy Light?
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,876
Okay it's working, thanks a lot. I honestly just copied Bribes example of healing from the original Damage Engine tester to understand how to convert damage to healing.

How would you recommend making a condition for Holy Light only? If I make a condition in the trigger for like
  • DamageFilterSourceA Equal to Holy Light
... it won't work. How else do I check for the damage source being Holy Light?
I don't think Damage Engine provides a way to directly check for Holy Light or in your case Finger of Death.

What people usually do is narrow it down with a combination of Conditions:
  • Conditions
    • (Level of Holy Light for DamageEventSource) Greater than 0
    • IsDamageSpell Equal to True
    • DamageEventAmount Greater than 0.00
Another way is to have a unique Dummy unit cast the damaging spell:
  • Conditions
    • (Unit-type of DamageEventSource) Equal to Holy Light (Dummy)
But in your specific case I would simply trigger the effects myself. Set Finger of Death's damage to 0.00 and do something like this:
  • Events
    • Unit - A unit Starts the effect of an ability
  • Conditions
    • (Ability being cast) Equal to Your Spell
  • Actions
    • Set VariableSet StatUnit = (Triggering unit)
    • Trigger - Run Stat Calculator <gen> (ignoring conditions)
    • Set VariableSet X = (100.00 x (Real(Level of (Ability being cast)))
    • Set VariableSet X = (X + (0.75 x (Real(StatINT))))
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • ((Target unit of ability being cast) belongs to an Ally of (Triggering player)) Equal to True
      • Then - Actions
        • Unit - Set life of (Target unit of ability being cast) to (Life of (Target unit of ability being cast) + X)
      • Else - Actions
        • Unit - Cause (Triggering unit) to damage (Target unit of ability being cast), dealing X damage of attack type Spells and damage type Normal
 
Level 9
Joined
Jun 13, 2010
Messages
365
I don't think Damage Engine provides a way to directly check for Holy Light or in your case Finger of Death.

What people usually do is narrow it down with a combination of Conditions:
  • Conditions
    • (Level of Holy Light for DamageEventSource) Greater than 0
    • IsDamageSpell Equal to True
    • DamageEventAmount Greater than 0.00
Another way is to have a unique Dummy unit cast the damaging spell:
  • Conditions
    • (Unit-type of DamageEventSource) Equal to Holy Light (Dummy)
But in your specific case I would simply trigger the effects myself. Set Finger of Death's damage to 0.00 and do something like this:
  • Events
    • Unit - A unit Starts the effect of an ability
  • Conditions
    • (Ability being cast) Equal to Your Spell
  • Actions
    • Set VariableSet StatUnit = (Triggering unit)
    • Trigger - Run Stat Calculator <gen> (ignoring conditions)
    • Set VariableSet X = (100.00 x (Real(Level of (Ability being cast)))
    • Set VariableSet X = (X + (0.75 x (Real(StatINT))))
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • ((Target unit of ability being cast) belongs to an Ally of (Triggering player)) Equal to True
      • Then - Actions
        • Unit - Set life of (Target unit of ability being cast) to (Life of (Target unit of ability being cast) + X)
      • Else - Actions
        • Unit - Cause (Triggering unit) to damage (Target unit of ability being cast), dealing X damage of attack type Spells and damage type Normal

I was thinking about doing this - but some of my spells are projectiles and not instant, which is why i downloaded Damage engine in the first place to be able to actually do some more interesting spells. :)
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,876
Whether you use a missile like Death Coil or an instant effect like Finger of Death, Damage Engine is unnecessary here.

If you want triggered Missiles then I highly suggest using this: Relativistic Missiles [vJASS][LUA][GUI]

^ That'll avoid all of the pitfalls that come with relying on an Ability to generate a Missile.

Then you can rely on Damage Engine to implement things like Ability Power (scaling spell damage), custom damage types/resistances, etc...
 
Last edited:
Top