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

Damage Engine 5.A.0.0

This bundle is marked as director's cut. It exceeds all expectations and excels in every regard.
Damage Engine

Three GUI Damage systems for the community of The Hive,
Seven vJass Damage systems for the JASS-heads on their pedestals high,
Nine competing Damage systems, doomed to die,
One for Bribe on his dark throne
In the Land of the Hive where the Workshop lies.
One Damage Engine to rule them all, One Damage Engine to find them,
One Damage Engine to bring them all and in cross-compatibility unite them.


Whether you're looking for a simple DDS (Damage Detection System), need to modify damage or even if you want a complex network of damage pre-and post-processing, this resource is for you. Damage Engine is the most adapted DDS in existence to take full advantage of the new damage detection natives, and is constantly evaluated and scrutinized by both the community and myself for performance improvements, bug fixes and new features alike.

What started with humble beginnings to bring a Unit Indexer-based version of DDS to GUI users to improve on the previous standard (at the time it was Weep's GDDS) would eventually evolve to incorporate other aspects of damage systems out there. @looking_for_help had identified an extremely useful technique with negative spell resistance being used to detect spell damage, and for a time his Physical Damage Detection system became the new standard. It wouldn't be until much later when Damage Engine would resurface and use the same technique in order to be more useful for the community.

Fast forward to 2020, and you'll find not only that cross-compatibility with Weep's and LFH's systems are incorporated, but the most popular DDS systems in existence - even vJass ones - are fully supported via stripped-down API wrappers. All of the functionality of prior DDS systems has been infused into Damage Engine 5.7, and as such the transition to a "one size fits all" DDS is complete. I hope you find this to be useful, and I also hope that it will help you in developing your map to be more dynamic what than you had previously thought possible.

Features

Legacy Code & Requirements

How it works

How to install/upgrade

Video Guides

FAQs

Thanks


  • Damage Type, Attack Type, Weapon Type, Armor Type and Defense Type detection and modification to alter/understand the fundamentals of WarCraft 3's damage processing;
  • Access to the view and change the damage amount before and/or after reduction by armor, armor type and shields.
  • Fully cross-compatible with every major DDS - vJass and GUI alike.
  • Correctly distribute/negate Spirit Link damage.
  • Differentiate between Ranged, Melee, Spell or other types of attack.
  • Does not require any Object Editor data nor Unit Indexer.
  • As of 5.4, it is now completely recursion-proof.
  • Other features:
    • Damage Blocking, reducing, amplifying and/or conversion to healing
    • Does not require you to know nor use Jass NewGen Pack nor any custom script
    • Custom DamageType association available to be set before and/or during damage event
    • Detect when multiple targets were hit simultaneously via DamageEventAOE > 1.
    • Detect when the same unit was hit simultaneously by the same source via DamageEventLevel > 1.
  • Detect damage: use the event "OnDamageEventEqual to <any value>". You have access to the following variables for reference:
    • DamageEventSource - the unit dealing the damage
    • DamageEventTarget - the unit receiving the damage
    • DamageEventAmount - the amount of damage the unit will receive
    • DamageEventPrevAmt - the amount of damage prior to being modified by the game engine.
    • DamageEventAttackT - the attack type (Chaos, Spells, Pierce, etc.)
    • DamageEventDamageT - the damage type - for comprehensive info, click here.
    • DamageEventWeaponT - the weapon type determines if an attack plays some kind of sound on attack (ie. Metal Heavy Bash). It is always NONE for spells and almost always NONE for ranged attacks.
    • DamageEventArmorT - the armor type (Flesh, Stone, Ethereal, etc.)
    • DamageEventDefenseT - the defense type (Hero, Fortified, Unarmored, etc.)
    • DamageEventArmorPierced - if DAMAGE_TYPE_NORMAL, how much armor was set to be ignored by the user.
    • IsDamageSpell, IsDamageRanged, IsDamageMelee - determine the source category of damage dealt.
    • IsDamageCode - Determine if the damage was dealt natively or by the user. This can give incorrect readings if the user has not identified to Damage Engine that it is code damage. Therefore I recommend setting NextDamageType prior to dealing damage.
    • DamageEventType - An integer identifier that can be referenced by you for whatever extra differentiation you need. You can also create your own special damage types and add them to the definitions in the Damage Event Config trigger. If you the unit should explode on death by that damage, use a damage type integer less than 0. If you want the damage to ignore all modifications, use DamageTypePure.
  • To change damage before it's processed by the WarCraft 3 engine: use the event "PreDamageEvent Becomes Equal to <any value>". Whether you just want to use one monolithic trigger for all damage modification like I do in the demo map, or use the different modifier events here, is up to you.
  • To interact with damage after it's been factored for armor and resistances, use "ArmorDamageEvent Becomes Equal to <any value>". This is typically useful for custom shields. If you fully block or absorb DamageEventAmount (setting it to 0 or less), this event doesn't run.
  • To set the DamageEventType before dealing triggered Damage, use:
    - Set NextDamageType = DamageTypeWhatever
    - Unit - Cause...
  • You can modify the following variables from a "PreDamageEvent" trigger:
    • DamageEventAmount
    • DamageEventAttackT/DamageT/WeaponT/ArmorT/DefenseT
    • DamageEventArmorPierced
    • DamageEventType
    • DamageEventOverride - You can set this if you want to remind yourself not to modify the damage further. If you use the UNKOWN damage type from a Unit - Damage Target native or set "NextDamageType = DamageTypePure" before that function, damage modification is skipped.
  • To catch a unit the moment before it would die from damage, use LethalDamageEvent Becomes Equal to 1.00. Instead of modifying the DamageEventAmount here, modify LethalDamageHP to let the system know how much life to keep the unit alive with. Or you can just reference that LethalDamageHP value in order to know how much "overkill" damage was dealt.
  • To catch a unit as soon as the damage is applied against its Hit Points, use AfterDamageEvent Equal to 1.00.
  • Usage of the "<Event> becomes EQUAL to <value>" can be extrapolated as per the below:
    • EQUAL works as it always has - will run for any damage.
    • NOT EQUAL only runs for code damage.
    • LESS THAN only runs for damage from attacks but not coded attacks.
    • LESS THAN OR EQUAL only runs for melee attacks but not coded attacks.
    • GREATER THAN OR EQUAL only runs for ranged attacks but not coded attacks.
    • GREATER THAN only runs for Spell damage but not coded spell damage.

  • Damage Engine 5 and higher requires the latest Warcraft 3 patch (currently 1.32).
  • For people who did not update their game to Reforged / have not updated to Reforged yet. Alternatively, adding the below JASS script to the top of the DamageEngine library SHOULD enable it to work too:

    JASS:
    function BlzGetEventIsAttack takes nothing returns boolean
         return BlzGetEventDamageType() == DAMAGE_TYPE_NORMAL
    endfunction
  • I have created a Pastebin for all information pertaining to Damage Engine 3.8, including the link to download it, via: Damage Engine 3.8.0.0 | HIVE.
  • As of 20 June 2020, JNGP users who are still on WarCraft 3 1.26 can benefit from Damage Engine 3A, which integrates many of the design choices added in various stages of Damage Engine 5. This is a special update which only requires the JASS script be replaced (no new GUI variables added). Can be found here: Damage Engine 3A.0.0.0 and 3.8.0.0 | HIVE

1
Unit attacks or casts a spell. The pure damage is assessed at this point - damage dice, evasion, critical strike. There is currently no event to affect or modify these at source.
→ →
2
The projectile or weapon hits the target unit
→ →
3
EVENT_UNIT_DAMAGING is fired before any modifications to the damage are made.
→ ↓
↓ ←
6
User changes to DamageEventAmount and/or to DamageEventDamageT/AttackT/WeaponT are saved into the WC3 engine.
← ←
5
If any recursive damage is detected from any of those events, it is postponed and the current damage will continue first.
← ←
4
Damage Engine deploys the PreDamageEvent
7
WarCraft 3 processes the user damage.
→ →
8
WarCraft 3 then distributes the user damage into Spirit Link (before armor)
→ →
9
WarCraft 3 runs any interrupting events, such as spirit link or defensive damage like Thorns Aura
→ ↓
↓ ←
12
The EVENT_UNIT_DAMAGED event runs. This is the original event we have always had access to. Damage Engine will either keep using the original variables from the DAMAGING event, or if there was Spirit Link/defensive damage it will freshly retrieve the event values from WC3 and only retain DamageEventPrevAmt.
← ←
11
Once any potential recursive WarCraft 3 damage is processed, the armor/mana shield modifications to the damage are performed.
← ←
10
If such events such as Spirit Link were detected, they fire their own EVENT_UNIT_DAMAGING & EVENT_UNIT_DAMAGED, and DamageEngine processes it along the way for the user.
13
If the damage is above zero, ArmorDamageEvent will run. If any recursive damage is detected, it is postponed.
→ →
14
The user can make modification to the damage here with the after-damage amount.
→ →
15
The user can access DamageEventPrevAmount if they want to know the damage amount before user changes/WarCraft 3 changes.
→ ↓
↓ ←
18
The user can specify whether or not to change LethalDamageHP in order to stop the unit from dying.
← ←
17
If the damage is still above zero, check if the damage is lethal. If so, run LethalDamageEvent 1.00. If any recursive damage is detected, it is postponed.
← ←
16
If the user wants the value that DamageEngine used to have with DamageEventPrevAmt (after WarCraft 3 processing but before user changes) they multiply DamageEventPrevAmt x DamageScalingWC3.
19
Once all modification is done, run OnDamageEvent. If any recursive damage is detected, it is postponed.
→ →
20
After a new damage instance is detected, or the 0.00 timer expires, run AfterDamageEvent. If any recursive damage is detected, it is postponed.
→ →
21
Run all potential recursive Unit - Damage Target function calls in chronological order (first in, first out).

How to install Damage Engine:
  1. Use WarCraft 3 Version 1.32
  2. If you're upgrading from 3.8 or prior, please delete the entire "Damage Engine" category from your map.
  3. Copy & Paste the Damage Engine category from the attached map to your own map.
How do I upgrade to the latest Damage Engine?
- Depending on the complexity, you'll either need to re-copy the Damage Engine category or just the Damage Engine script. Generally, you can use this as a guide:

  • Damage Engine _._._.x - only requires copying of the JASS script
  • Damage Engine _._.x._ - generally only needs copying of the JASS script, but read the patch notes in case there are changes you may want to make to your own code in order to utilize the changes.
  • Damage Engine _.x._._ - delete your current Damage Engine category or manually add the missing variables to your Variable Editor, and update your JASS script.
  • Damage Engine x._._._ - this occurs very infrequently. Typically requires changes to the way Damage Engine needs to be installed and used.

Notes about upgrading from Damage Engine 4.0 or prior:
  • Revert any custom Object Editor changes made (such as Life Drain reversal, Spell Damage Reduction inversion, etc).
  • You can safely delete the custom spells "Spell Damage Detection" and "Cheat Death Ability"
  • You can delete the Unit Indexer trigger if you do not use it or would prefer to use a different indexer.
  • You should delete any "Mana Shield fix" or "Finger of Death fix" you may have imported, as well as revert any Object Editor data that was required to make it work, as these are no longer needed.
  • !!!DEPRECATED FEATURE!!! As of 5.4, do not bother to take any recursive damage mitigation - Damage Engine will now handle all of that for you!
  • !!!DEPRECATED FEATURE!!! Do not use "ClearDamageEvent" - it does nothing. Just delete it.
  • !!!DEPRECATED FEATURE!!! Do not use "NextDamageOverride" - set NextDamageType = DamageTypePure instead.
  • !!!CHANGED FEATURE!!! If the system detects code damage and the user did not specify it as any particular DamageEvenType, the system will assign it DamageTypeCode automatically.
  • !!!CHANGED FEATURE!!! DamageModifierEvent 1.00-3.00 now run prior to armor reduction. This enables the user to modify the damage before armor and resistance changes are applied - also before Mana Shield and Anti-Magic shell kick in, so no more need for special triggers.


  • Q: Why am I getting a bunch of 'trigger was disabled' errors when I save my map?
  • A: This issue is not unique to Damage Engine, but to all vJass resources. Blizzard has taken the very confusing decision to make JassHelper 'disabled' by default, meaning that every new map that uses a vJass resource has to manually enable JassHelper. Please see this thread if you want to know where to find the Enable JassHelper option.
    .
  • Q: How can I detect when a unit gets damaged?
  • A: Create a trigger with the event: "Game - Value of Real Variable <DamageEvent> becomes Equal to 1.00".
    • Use the following custom variables to reference the event responses:
      • DamageEventSource - the unit dealing the damage
      • DamageEventTarget - the unit getting damaged
      • DamageEventAmount - how much damage is being dealt
      • DamageEventAttackT - which attack type was used by DamageEventSource to damage DamageEventTarget
      • DamageEventDamageT - which damage type was used to damage the target (ie. UNIVERSAL for ultimate damage, or NORMAL for damage that gets reduced by armor).
      • DamageEventDefenseT - which defense type does the target unit have (ie. Hero, Fortified, Unarmored).
      • DamageEventArmorT - which armor type does the target unit have (ie. Flesh, Ethereal, Stone).
      • DamageEventPrevAmt - what the value of the damage was before being modified by armor, ethereal/item bonuses or user changes.
        .
  • Q: How do I modify the damage that is dealt to a unit?
  • A: Create a trigger with the event: "Game - Value of Real Variable <PreDamageEvent> becomes Equal to <any value>".
    • You can change the following variables to affect the damage that will be dealt:
      • DamageEventAmount - how much damage will be dealt (before armor reductions)
      • DamageEventAttackT - which attack type will be used by DamageEventSource to damage DamageEventTarget
      • DamageEventDamageT - which damage type will be used to damage the target.
      • DamageEventDefenseT - which defense type should the target unit have during this attack.
      • DamageEventArmorT - which armor type should the target unit have during this attack.
      • DamageEventArmorPierced - how much armor value to ignore when dealing this damage (applies to DAMAGE_TYPE_NORMAL only, otherwise all armor is ignored).
        .

  • Q: How do I deal Pure damage to a unit (bypassing armor/skipping user modification)?
  • A: Use the following actions:
    • Set NextDamageType = DamageTypePure
    • Unit - Cause Source to damage Target for Amount using attack type Spells and damage type Universal
      .

  • Q: How do I protect against recursive damage?
  • A: Damage Engine 5.4 and above is completely recursion-proof, using vJass hooks to detect registered Damage Event triggers.
    .

  • Q: I've been using <insert Damage system here>. Can I use those with Damage Engine?
  • A: Better - Damage Engine has integrated cross-compatibility with all other approved Damage systems and even the major ones from outside of Hiveworkhop.
    .

  • Q: Can I cause an attack to 'Miss' its target?
  • A: Kind of. Ranged attacks will still explode on the target, and on-hit effects will still apply, but you can do the following:
    • Use the event "PreDamageEvent becomes Equal to 1.00"
    • Use the following actions:
      • Set DamageEventAmount = 0.00
      • Set DamageEventArmorT = ARMOR_TYPE_NONE
      • Set DamageEventWeaponT = WEAPON_TYPE_NONE
    • Setting the weapon type and armor type to none like the above will stop any on-hit sounds from playing. When the Peasant attacks in the demo map, this is the trick I'm using. Instead of saying "MISSED!" I have the Floating Text saying "FAIL!" because - again - it's not exactly a "miss".

Thank you to Blizzard for continuing to work on this amazing game to give us awesome new natives that have the best possible control over incoming damage. Damage Engine brings that power to GUI. Also, a very special thank you to @KILLCIDE for getting me motivated to start up the 5.0 project in the first place.

Thank you to the users of this system who have helped me mold this project into the stable, powerful form it is in today!

For versions 3.8 and prior:

Thank you @looking_for_help for finding the spell damage detection method used in Damage Engine 3 - it was the greatest find since the undefend bug.

Thanks to Jesus4Lyf and @Nestharus for building the inspiration that originally led me to create DamageEngine.

Thank you Wietlol and looking_for_help for challenging me on this project to integrate solutions to problems I had not been made aware of, such as the importance of an After-Damage Event.

Thanks to @Spellbound for several crucial bug reports.


Damage Engine Config

Damage Engine vJass

Damage Engine Lua

Changelog


  • Damage Engine Config
    • Events
      • Map initialization
      • Game - DamageModifierEvent becomes Greater than 0.00
      • Game - LethalDamageEvent becomes Less than or equal to 0.00
      • Game - DamageEvent becomes Not equal to 0.00
      • Game - AfterDamageEvent becomes Less than 0.00
      • Game - AOEDamageEvent becomes Greater than or equal to 0.00
      • Game - SourceDamageEvent becomes Equal to 0.00
      • Game - PreDamageEvent becomes Equal to 0.00
      • Game - ArmorDamageEvent becomes Equal to 0.00
      • Game - ZeroDamageEvent becomes Equal to 0.00
    • Conditions
    • Actions
      • -------- You can add extra classifications here if you want to differentiate between your triggered damage --------
      • -------- Use DamageTypeExplosive (or any negative value damage type) if you want a unit killed by that damage to explode --------
      • -------- - --------
      • -------- The pre-defined type Code might be set by Damage Engine if Unit - Damage Target is detected and the user didn't define a type of their own. --------
      • -------- "Pure" is especially important because it overrides both the Damage Engine as well as WarCraft 3 damage modification. --------
      • -------- I therefore gave the user "Explosive Pure" in case one wants to combine the functionality of the two. --------
      • -------- - --------
      • Set VariableSet DamageTypePureExplosive = -2
      • Set VariableSet DamageTypeExplosive = -1
      • Set VariableSet DamageTypeCode = 1
      • Set VariableSet DamageTypePure = 2
      • -------- - --------
      • Set VariableSet DamageTypeHeal = 3
      • Set VariableSet DamageTypeBlocked = 4
      • Set VariableSet DamageTypeReduced = 5
      • -------- - --------
      • Set VariableSet DamageTypeCriticalStrike = 6
      • -------- - --------
      • Custom script: call DamageEngine_DebugStr()

BribeFromTheHive/DamageEngine

Lua 1.0.2.3 - Fixed to match adjustment made in vJass version 5.4.2.3.
Lua 1.0.2.2 - Fixed to match adjustment made in vJass version 5.4.2.2.
Lua 1.0.2.1 - Fixed to match adjustment made in vJass version 5.4.2.1.
Lua 1.0.2.0 - Added support for Lua Fast Triggers ([Lua] Ridiculously Fast Triggers). Fixed an issue where the AfterDamageEvent wasn't always timed the correct way like it was in the JASS verion.
Lua 1.0.1.0 - Fixed encapsulation issue and recursion issue with DamageEngine_inception. Now hooks UnitDamageTarget.
Lua 1.0.0.0 - Release based on Damage Engine 5.4.2.0

5.9.0.0 - Added the following clearer event names to make things less confusing for new users:
  • PreDamageEvent - can be used in place of DamageModifierEvent pre-armor modification
  • ArmorDamageEvent - can be used in place of DamageModifierEvent post-armor modification
  • OnDamageEvent - can be used instead of a non-zero DamageEvent
  • ZeroDamageEvent - can be used instead of a zero damage DamageEvent
  • SourceDamageEvent - runs at the same time as AOEDamageEvent, but doesn't need to hit multiple units.
Added "DamageFilterRunChance" - odds for the trigger to BE run (works inversely to DamageFilterFailChance).
Shortened the Configuration trigger so that it focuses primarily on what the user can modify.
Organized all variables into categories to help users better understand what does what.
Installation or updating from a previous version will require re-copying the entire Damage Engine folder.
Updated the demo map's text tag production to include a new custom update for ArcingTextTag, thanks to @Ugabunda and @Kusanagi Kuro.
Side note - the Demo Map's triggers have been heavily cleaned up and will now no longer cause crashes when being imported into a new map.
5.8.0.0 -
  • Added a new functionality to the AOEDamageEvent, which allows it to fire even when only one unit is hit, if the AOEDamageEvent is registered as "Not Equal" instead of "Equal to". This is useful in a very specific scenario where an AfterDamageEvent may not be able to be relied upon to properly deallocate data from a running instance that needs to be able to function when multiple units are hit, but also needs to not fail when only one unit is hit.
  • Added additional filters for GUI users to avoid using trigger conditions in even more scenarios:
    • DamageFilterSource/TargetI (has item)
    • DamageFilterSource/TargetA (has ability)
    • DamageFilterSource/TargetC (has a certain classification, like hero or Tauren)
    • DamageFilterFailChance - odds for the trigger to not be run (ideal for critical strike or evasion)
  • Provided a way for GUI to un-register a Damage Event by setting "RemoveDamageEvent" to true from within their trigger's actions.
  • Moved the CreateTimer/CreateTrigger/CreateGroup calls that had been included in the globals block down to the onInit block as per request of @Ricola3D
  • Minor performance improvements thanks to @BLOKKADE
5.7.1.2 - Fixed an issue with armor penetration sometimes bugging out.
5.7.1.1 - Fixed an issue with the eventFilter not retaining its value during an AOE event. Fixed an issue with eventFilter when USE_MELEE_RANGE was set to false. Both issues reported by @lolreported
5.7.1.0 -
I have fixed several potential points of failure reported by multiple users that stopped Damage Engine from working for the rest of the game. In any case there should no longer be ANY SITUATION where Damage Engine just "stops working", even in ways I can't predict. The most likely issue was with DamageScalingWC3/User having possible 0-division errors.​
Fixed the "configured" issue reported by @lolreported where manual configuration didn't work unless the damage and attack type checks were initialized tto -1.​
In addition to these fixed bugs, I have added several more static ifs so that advanced users have more control over getting rid of features they might not care about.​

5.7.0.3 - Fixed the issue reported by @KitsuneTailsPrower wherein the DamageInterface extension wasn't working. This needed to be fixed both in the Damage Engine source as well as the DamageInterface plugin itself.
5.7.0.2 - Fixed the issue reported by @Wazzz where the armor reduction wasn't taken into consideration. Actually there was a much bigger flaw that I had overlooked that was prompting this.
5.7.0.1 - Improved the logic of the 0 damage event.
5.7.0.0:

  • Usage of the "DamageEvent becomes EQUAL to 1.00" now can be extrapolated further than ever before:
    • EQUAL works as it always has.
    • NOT EQUAL only runs for code damage.
    • LESS THAN only runs for damage from attacks.
    • LESS THAN OR EQUAL only runs for melee attacks.
    • GREATER THAN OR EQUAL only runs for ranged attacks.
    • GREATER THAN only runs for Spell damage.
  • Fully adapted Damage Engine to work with every other major DDS
  • Rewrote the internal script to use vJass structs: Damage and DamageTrigger.
  • Changed some of the vJass API. You can find the API listed in the Damage Engine trigger. Notably:
    • I removed UnitDamageTargetEx. You can replace this with Damage.apply.
      • The reason for this change is because of cross-compatibility. Rising Dusk's IDDS uses a different set of parameters for this function, so I removed it from my library to allow this to work seamlessly.
    • TriggerRegisterDamageEvent -> TriggerRegisterDamageEngine
    • RegisterDamageEvent -> RegisterDamageEngine
      • The reason for the above two changes is, like for UnitDamageTargetEx, because Rising Dusk's IDDS uses them. I don't want to make the same mistake I did with Table's API and preferred to walk back my API choices before things got out of hand again.
  • Various performance tweaks, bug fixes and re-commenting of variables.
  • Recursive damage is now processed more intelligently and possibly be more performance-friendly.
  • Adapted the cross-compatibility libraries for Weep and LFH's systems to use textmacros to insert themselves into Damage Engine (this might have been in the 5.6 update, but these two updates were both tailored to achieve similar goals).
5.6.2.0 - Fixed a bug with Damage modification and laid groundwork for a bunch of optional vJass compatibility addons.
5.6.1.0 - Patchwork on Melee/Ranged detection, recursion tracking. Also added the ability to modify damage from a DamageEvent to make it easier on beginners.
5.6.0.1 - Fixed an issue where the DamageEventType for recursive damage that used NextDamageType would always default to DamageTypeCode.
5.6.0.0
Rewrote a significant amount of the internal code so that struct and GUI syntax both work - and are synchronized with each other. vJass-exclusive users can disable the GUI synchronization if they don't use any GUI damage events in their maps.​
Four new variables must be added to your variable editor:​
  • boolean NextDamageIsAttack
  • boolean NextDamageIsMelee
  • boolean NextDamageIsRanged
  • integer NextDamageWeaponT
Struct syntax should not need too much introduction - Damage.index is the triggering event ID, and the syntax is Damage.index.amount/source/target/etc. To initialize a JASS damage event, use:​
JASS:
function RegisterDamageEvent takes code c, string eventName, real value returns nothing
The string is simplified: "Modifier", "" (for simple DamageEvent), "After", "Lethal", "AOE"​
Finally, a neat QOL improvement is that I have assigned weight to each of the events. When registering an event, you can include numbers different than 1, 2, 3 or 4 (for modification) or just the plain "1" for the others. Now you can set your own sequencing and use 1.5, 3.14 or even -1 to give an even more extreme priority to something. Lower numbers run first, higher ones last.​
5.5.0.0 - Added support for the new native BlzGetEventIsAttack via "IsDamageAttack". Also updated the Config trigger to make importing a bit easier
5.4.2.3 - Fixed a mis-flag of the IsDamageSpell value when not being actual spell damage.
5.4.2.2 - Actually fixed the Cold Arrows issue (division by 0.00001 or something ...somehow... either way, it is fixed).
5.4.2.1 - A fix which should hopefully quell the recent reports of damage events failing in complex situations involving Cold Arrows.
5.4.2.0 - A ton of fixes to repair the issues plaguing Sunken City and anyone else who might be pushing this engine well beyond what I imagined it would be used for. Also added a couple of variables intended to be used to ricochet damage: CONVERTED_ATTACK_TYPE and CONVERTED_DAMAGE_TYPE. Check the demo map for how they can be used in a Unit - Damage Target action.
5.4.1.0 - The "Inception" update. Advanced users can interact with Damage Engine via custom script to set DamageEvent_inception = true to allow their damage to potentially go recursive (to a fixed extent).
5.4.0.1 - Hotfixed that modifiers 2 and 3 weren't running.
5.4.0.0 - By using an innovative approach of hooking TriggerRegisterVariableEvent, I've permanently eliminated all risks of recursion in the engine.
5.3.0.1 - Fixed unexpected behavior with DamageTypePure when it is affected by Anti-Magic Shell or Mana Shield. DamageTypePure now no longer ignores DamageScalingWC3.
5.3.0.0 - Fixed an issue with AfterDamageEvent sometimes being delayed. Added DamageScalingUser to track the ratio of user modified damage, as well as DamageEventArmorPierced which allows the user to define how much armor to ignore when working with DAMAGE_TYPE_NORMAL.
5.2.0.1 - Fixed an issue where with the final unit in a Spirit Link chain or the retaliating damage of Thorns/Carapace would not deploy an AfterDamageEvent. Also fixed an issue where AfterDamageEvent would still fire from DAMAGE_TYPE_UNKNOWN if it was greater than 0. Simply copy over the JASS from this post in order to update your own implementation.
5.2.0.0

  • Now features DamageEventArmorT and DamageEventDefenseT, which pull from the target unit's Object Editor data in order to allow you more complete access to detect and even MODIFY those defenses. Changes must be made in a DamageModifierEvent, and they are reverted as soon as armor is calculated.
  • Re-introduced AfterDamageEvent, which is the moment after the unit's life is changed, but before any recursive damage has run.

5.1.3.1 - Bug fixes and performance improvements. No, really. Fixed an issue with the DAMAGED event running even though it was turned off (who would've guessed that?)
5.1.3.0 - Engine re-tooling to improve accuracy and get Spirit Link/Defensive damage out of hardcoded mode - it will now work even in circumstances I haven't tested for (in case those weren't the only issues). Also fixed the Is Unit Moving resource.
5.1.2.1 - Fixed an issue with Spiked Carapace and Thorns Aura where the melee attacker would not get recorded correctly. This required the same fix as I needed to apply for the initial target in a spirit link chain.
5.1.2.0 - Tweaked recursion and fixed a few bugs. Re-introduced the zero damage event now that patch 1.31.1 brought it back.
5.1.1.1 - Minor tweak to Spirit Link in rare situation.
5.1.1.0 - Fixed issues related to Spirit Link. Now works intuitively as expected.
5.1.0.0 - Crazy improvements - check out the details in "How to upgrade from Damage Engine 4.0 or earlier" and "How to use Damage Engine 5.1"
5.0.0.0 - Oh man. Where do I even start?
  • You can now set/compare DamageEventDamageT, DamageEventAttackT or DamageEventWeaponT
  • No longer needs Unit Indexer nor any custom Object Editor data nor modifications.
  • Requires WarCraft 3 1.31 or higher.
  • Changed vanilla JASS code to vJass to clean up a lot of things such as making certain variables private.
  • Look for more details in "How to upgrade from Damage Engine 4.0 or earlier"

4.0.0.0 - Never officially released, but was the first iteration which used SetEventDamage.
For 3.8.0.0 and prior, see: Damage Engine 3.8.0.0 | HIVE


Cross-Compatibility:

BribeFromTheHive/DamageEngine

Keywords:unit indexer, damage detection, damage event, weep, nestharus, looking_for_help, EVENT_PLAYER_UNIT_DAMAGED, damage engine, spell, physical, EVENT_PLAYER_UNIT_DAMAGED, attacktype, damagetype, weapontype, armortype, defensetype, BlzSetEventDamage
Previews
Contents

Damage Engine Demo Map (Map)

Lua Damage Engine 2.0.0.0 (Map)

Reviews
23:20, 11th Jan 2015, BPower Criticism: On the one hand Damage Engine offers extremely high utility to every spell, system and map maker independent of the coding style ( GUI, JASS, vJass, .... ) on the other hand it's very easy to import and...
Level 5
Joined
Dec 25, 2014
Messages
111
As long as you have bought the (non-reforged) game, it's not some illegal copy of the game, and it is up-to-date, it should work. The Reforged thing is only about graphics/campaign, but it doesn't change the common.j/blizzard.j API.
Yeah i know. It's just that i can't really open the map to easily copy variables needed to update the engine.
Thank you, anyway.
 
Yeah i know. It's just that i can't really open the map to easily copy variables needed to update the engine.
Thank you, anyway.
Here is a 1.31.1 test-map with latest damage-engine and 5.7.1.2
Note: This is my "installation" of Damage Engine that I've upgraded since Damage Engine 3.4 or so. It may contain unused variables.
 
Level 4
Joined
Apr 22, 2022
Messages
31
How would you detect when a unit deals a critical strike from the ability critical strike? I am trying to display my own floating text when a unit deals a critical from the ability but cant seem to get it to work. I see there is DamageTypeCriticalStrike but I am unsure how to utilize it. I am using an OnDamageEvent trigger.
 

Bribe

Code Moderator
Level 50
Joined
Sep 26, 2009
Messages
9,464
How would you detect when a unit deals a critical strike from the ability critical strike? I am trying to display my own floating text when a unit deals a critical from the ability but cant seem to get it to work. I see there is DamageTypeCriticalStrike but I am unsure how to utilize it. I am using an OnDamageEvent trigger.
You would need to trigger the Critical Strike to accurately detect that (like what I did in the demo map with the Knight).
 
Level 3
Joined
Jan 3, 2019
Messages
25
Hello guys, after last patch something happend to my map, can't save it.

Is DE broken now?
1667486441910.png
 

Attachments

  • Damage_Engine_v5_9_0_0_2.w3x
    2 MB · Views: 5
Level 5
Joined
Dec 25, 2014
Messages
111
1669208349490.png

Can't detect if a unit is stunned. Is it because the every stun like bash or storm bolt happens after the damage occured? But then when i test it again while the unit is permanently stunned while i'm damaging them and still nothing.
 

Bribe

Code Moderator
Level 50
Joined
Sep 26, 2009
Messages
9,464
View attachment 414374
Can't detect if a unit is stunned. Is it because the every stun like bash or storm bolt happens after the damage occured? But then when i test it again while the unit is permanently stunned while i'm damaging them and still nothing.
Have you tried removing some conditions? Maybe the damage type of the spell damage you're trying to detect is not actually Force?

I'm not aware of the "is stunned" boolean (I guess I've never used it). Does that detection work from other triggers?
 
Level 5
Joined
Dec 25, 2014
Messages
111
Have you tried removing some conditions? Maybe the damage type of the spell damage you're trying to detect is not actually Force?

I'm not aware of the "is stunned" boolean (I guess I've never used it). Does that detection work from other triggers?
Well from the trigger above you can see i already disabled the conditions. Turns out a simple trigger like this
1669215727163.png

Won't detect them either. So i think it's the boolean that didn't work.
 

Bribe

Code Moderator
Level 50
Joined
Sep 26, 2009
Messages
9,464
Hmmm, alright. But can I change the damage to that when it is registered? Will that work?
Yes, you can change DamageEventAttackT and DamageEventDamageT.

I'll also take this opportunity to announce what Lua version 3 currently looks like:

Lua Damage Engine 3 Preview

I'll mention the upcoming features once the update is actually tested and published, but the main achievements are:
  • A 40% reduction in code length.
  • Highly modernized and efficient (pure Lua; this was a total rewrite).
  • Tidied up a bunch of legacy code.
  • Added more configurables.
  • Definitely works without any GUI variables, and enabling GUI does not slow down Lua.
  • Emphasis on the new Event library.
 
Level 2
Joined
Dec 6, 2022
Messages
3
Hello There! I tried installing the Damge Engine into my world, but I keep getting syntax errors whenever I try to activate it. I copied all the founders in the Triggers section of the Damage Engine map as said in the installation guide. Could you help me fix it?
1670371761296.png
1670371780131.png
 
Level 19
Joined
Feb 27, 2019
Messages
577
Hello There! I tried installing the Damge Engine into my world, but I keep getting syntax errors whenever I try to activate it. I copied all the founders in the Triggers section of the Damage Engine map as said in the installation guide. Could you help me fix it?
View attachment 415243View attachment 415244
You have to enable jasshelper inside the trigger editor each time you open a new map since 1.33. It comes disabled now so that you dont forget to enable it.
See if that helps.
 

Bribe

Code Moderator
Level 50
Joined
Sep 26, 2009
Messages
9,464
How to detect spesific spell damage? Like, i'm using firebolt/breath to deal no damage againts water elemental. Please help!
You can check the damage type: Spell/Ability Damage Types and what they mean

Firebolt deals Fire damage, Breath of Fire deals Sonic damage (unless it triggers with Drunken Haze, in which case it still does Sonic damage but the damage-over-time is Fire).

I don't know of a way to know "spell X dealt damage", but I think the damage types are a good way of narrowing it down. It is easier to determine which specific attack damaged a unit (attack 1 or attack 2), whether it was melee or ranged, because I already have systems that show such detection is working.
 
Level 6
Joined
Jul 22, 2015
Messages
65
You can check the damage type: Spell/Ability Damage Types and what they mean

Firebolt deals Fire damage, Breath of Fire deals Sonic damage (unless it triggers with Drunken Haze, in which case it still does Sonic damage but the damage-over-time is Fire).

I don't know of a way to know "spell X dealt damage", but I think the damage types are a good way of narrowing it down. It is easier to determine which specific attack damaged a unit (attack 1 or attack 2), whether it was melee or ranged, because I already have systems that show such detection is working.
Thanks!! it workedd but yeah even didnt know that "spell x dealt damage" atleast i can make with custom spell to make it happen.
 
Last edited:

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,503
Thanks!! it workedd yeah event didnt know that "spell x dealt damage" atleast i can make with custom spell to make it happen.
One trick is to use two spells. One spell is used by your Hero which acts as a "fake" spell intended to fire a trigger, and the other is the real spell which will be cast by a Dummy unit inside of said trigger.

YourHero casts Firebreath (Fake) -> Create 1 FirebreathDummy -> Add Firebreath to it -> Order it to cast Firebreath

Then in your DamageEvent trigger you can check if the Unit-type of DamageEventSource is Equal to FirebreathDummy:
  • Conditions
  • (Unit-type of DamageEventSource) Equal to FirebreathDummy
Alternatively, you can check if the Dummy has the specified ability, which is probably better in most cases since you can re-use existing Dummy units:
  • Conditions
  • (Level of Firebreath for DamageEventSource) Greater than 0
The main issue here is that the Dummy is dealing the damage, but with a proper system setup you could have your Dummy linked to the Hero in a way that they act as one for things like DamageEvents and Kill credit.
 
Level 6
Joined
Jul 22, 2015
Messages
65
One trick is to use two spells. One spell is used by your Hero which acts as a "fake" spell intended to fire a trigger, and the other is the real spell which will be cast by a Dummy unit inside of said trigger.

YourHero casts Firebreath (Fake) -> Create 1 FirebreathDummy -> Add Firebreath to it -> Order it to cast Firebreath

Then in your DamageEvent trigger you can check if the Unit-type of DamageEventSource is Equal to FirebreathDummy:
  • Conditions
  • (Unit-type of DamageEventSource) Equal to FirebreathDummy
Alternatively, you can check if the Dummy has the specified ability, which is probably better in most cases since you can re-use existing Dummy units:
  • Conditions
  • (Level of Firebreath for DamageEventSource) Greater than 0
The main issue here is that the Dummy is dealing the damage, but with a proper system setup you could have your Dummy linked to the Hero in a way that they act as one for things like DamageEvents and Kill credit.
It also worked, just confused for linking Dummy to Hero, because if dummy died before target die, it didnt get any gold or exp.
 

Bribe

Code Moderator
Level 50
Joined
Sep 26, 2009
Messages
9,464
It also worked, just confused for linking Dummy to Hero, because if dummy died before target die, it didnt get any gold or exp.
In those cases, you set the timed life to be much higher, or you can use a dummy recycling system which recycles the dummy after a longer delay.
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,503
It also worked, just confused for linking Dummy to Hero, because if dummy died before target die, it didnt get any gold or exp.
In my map I create a permanent Hero Dummy that is linked to each Hero as they first enter the map. This linking effect is done using a Unit array variable and a Unit Indexer. You may want two Unit array variables actually, one that gets you the Dummy from the Hero, and another that gets you the Hero from the Dummy. Alternatively, you could use a Hashtable and avoid the need for these variables/Unit Indexer.

Here's an example using the Unit Indexer method:
  • Events
    • Unit - A unit Enters the map
  • Conditions
    • (Triggering unit) is a Hero Equal to True
  • Actions
    • Set Variable Hero = (Triggering unit)
    • Unit - Create 1 Hero Dummy for (Owner of Hero)...
    • Set Variable HeroDummy = (Last created unit)
    • -------- Link the Dummy to the Hero --------
    • Set Variable CV = (Custom value of Hero)
    • Set Variable HD_Dummy[CV] = HeroDummy
    • -------- Link the Hero to Dummy --------
    • Set Variable CV = (Custom value of HeroDummy)
    • Set Variable HD_Hero[CV] = Hero
Then whenever one of my Heroes casts a triggered spell which would require the use of a Dummy unit, I simply grab their Hero Dummy, remove it's previously casted ability, add the new one, and order it to cast the new spell. This is done using a simple system that tracks the Hero Dummy's previously casted ability and also simplifies the process to a certain extent, for example like this:
  • Events
    • Unit - A unit Starts the effect of an ability
  • Conditions
    • (Ability being cast) Equal to Firebreath (Fake)
  • Actions
    • Set Variable Hero = (Triggering unit)
    • Set Variable HeroDummy = HD_Dummy[(Custom value of Hero)]
    • Set Variable HeroDummyAbility = Firebreath
    • Trigger - Run Hero Dummy Setup (ignoring conditions)
    • Unit - Order HeroDummy to cast Neutral - Firebreath at (Target point of ability being cast)
This works fine even when players control multiple Heroes since each individual Hero will have its own exclusive Hero Dummy. From there I can manage the Damage events and Death events by checking whether or not a Hero Dummy was involved. If one was, I can change the DamageEventSource/Killing Unit to the Hero that is linked to the Hero Dummy. Note that you can't literally change the Event Response (Killing Unit), so you would use a variable instead.

For example, let's intercept the Death event and make a system that allows us to always give the kill credit to the Hero instead of the Hero Dummy:
  • Events
    • Unit - A unit dies
  • Conditions
  • Actions
    • Set Variable KillingUnit = (Killing unit)
    • If (Unit-type of KillingUnit Equal to Hero Dummy) then Set Variable KillingUnit = HD_Hero[(Custom value of KillingUnit)]
    • Set Variable DeathEvent = 1.00
    • Set Variable DeathEvent = 0.00
So now using the same method that Damage Engine uses with it's custom DamageEvents, we can create our own custom "A unit dies" triggers which have already managed the Hero Dummy -> Hero process for us:
  • Events
    • Game - DeathEvent becomes Equal to 1.00
  • Conditions
    • (KillingUnit Equal to Paladin)
    • (Level of Redemption for KillingUnit Greater than 0)
  • Actions
    • Unit - Set life of KillingUnit to life of KillingUnit + 100.00
NOTE that this isn't a perfect example and will crash the map if you use the Kill Unit function inside of a DeathEvent trigger (recursion issues), but that is easily avoided.

Also, turning it into a system like this isn't necessary but it's wise to do if you have or plan on having a lot of "A unit dies" triggers. Alternatively, you could just do the whole "Set KillingUnit / If KillingUnit Equal to..." process in each of your individual "A unit dies" triggers.

For your DamageEvent triggers you can create another system that's similar to what I did above, however that may start to feel overcomplicated and inefficient. Instead you could just handle the changing of DamageEventSource manually in your DamageEvent triggers.
  • Events
    • Game - DamageEvent becomes Equal to 1.00
  • Conditions
  • Actions
    • If (Unit-type of DamageEventSource Equal to Hero Dummy) then Set Variable DamageEventSource = HD_Hero[(Custom value of DamageEventSource )]
    • Unit - Set life of DamageEventSource to life of DamageEventSource + 100.00
^ So if our Hero Dummy dealt damage and is the DamageEventSource, change the DamageEventSource to the Hero that is linked to the Dummy. Now our Hero is getting healed instead of the Dummy.
 
Last edited:
Level 3
Joined
Jan 23, 2014
Messages
32
Hi Bribe, good morning, i have two problems and i need help.

1) How do i differentiate between direct damage and DPS? that is, i want for example:
100 spell damage + 100 spell damage increase = 200.
10 spell damage(DPS) + 100 spell damage increase = 20.
How can i get the system to detect when it's direct damage and when it's DPS? It happens that when i use skills like "bladestorm", "immolation" or "poison", they do exaggerated damage making them OP.

2) I am creating a poison type ability that does damage based on the amount of life, something like the Heartstopper Aura from "DotA", the problem is that whenever a unit is under the effects of said poison, when attacked, this one receives an exaggerated damage, as if the poison, instead of causing damage, will increase it, until it is trying to cause the damage to be caused by a dummy but still, why is this? How do i make the poison damage not alter or be altered by external factors?

Btw i am using version Damage Engine 5.5.0.0.
 
Last edited:

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,503
Hi Bribe, good morning, i have two problems and i need help.

1) How do i differentiate between direct damage and DPS? that is, i want for example:

How can i get the system to detect when it's direct damage and when it's DPS? It happens that when i use skills like "bladestorm", "immolation" or "poison", they do exaggerated damage making them OP.

2) I am creating a poison type ability that does damage based on the amount of life, something like the Heartstopper Aura from "DotA", the problem is that whenever a unit is under the effects of said poison, when attacked, this one receives an exaggerated damage, as if the poison, instead of causing damage, will increase it, until it is trying to cause the damage to be caused by a dummy but still, why is this? How do i make the poison damage not alter or be altered by external factors?

Btw i am using version Damage Engine 5.5.0.0.
1) Games like League of Legends use an Ability Power ratio that acts like a multiplier for things like bonus flat spell damage. So if an ability hits 10 times per second you would make it's multiplier 0.10. So the +100 spell damage would get reduced down to 10 spell damage. You need to manage this yourself in your triggers.

2) You can turn off the Damage Engine before dealing the Heartstopper damage and then turn it back on after. That or just add a condition that can be checked -> If IgnoreDamage == True then Skip remaining actions
 
Level 3
Joined
Jan 23, 2014
Messages
32
1) Games like League of Legends use an Ability Power ratio that acts like a multiplier for things like bonus flat spell damage. So if an ability hits 10 times per second you would make it's multiplier 0.10. So the +100 spell damage would get reduced down to 10 spell damage. You need to manage this yourself in your triggers.

2) You can turn off the Damage Engine before dealing the Heartstopper damage and then turn it back on after. That or just add a condition that can be checked -> If IgnoreDamage == True then Skip remaining actions
Hi Uncle.

1) In that case it would not work for me, because in my map i use two types of increases, percentage and flat, so if i seek to simplify the increase using multipliers(which i use for percentages) it will only work for DPS, not for direct damage, for example:
On my map there are two items, one grants "spell damage increase by 50%" while the other grants "spell damage increase by 50", if the Mountain King possesses both items, his Storm Bolt(100 Damage) would end up dealing 200 damage, while the KOTG using his Entangling Roots(10 DPS) would do 65 DPS(650 DAMAGE!), if i do what you say, then the Storm Bolt would end up doing 15 damage and the Entangling Roots 6.0(60 damage), so it would be meaningless. I want to find a way for a group of skills like DPS to have its own particular damage.

2)Ok, i'll try it, thanks.
 

Bribe

Code Moderator
Level 50
Joined
Sep 26, 2009
Messages
9,464
for 2), I can't recall if 5.5 was already using the "hide damage" damage type of ignoring damage if the source is "DAMAGE_TYPE_UNKNOWN".

For 1), the given suggestion came in 2 parts, while you had only addressed the first. The second suggestion was to trigger the damage so you know thoroughly which is DoT and which is initial damage (and you can do this using DamageEventType and specify a DamageTypeDoT).
 
Level 6
Joined
Jul 22, 2015
Messages
65
In my map I create a permanent Hero Dummy that is linked to each Hero as they first enter the map. This linking effect is done using a Unit array variable and a Unit Indexer. You may want two Unit array variables actually, one that gets you the Dummy from the Hero, and another that gets you the Hero from the Dummy. Alternatively, you could use a Hashtable and avoid the need for these variables/Unit Indexer.

Here's an example using the Unit Indexer method:
  • Events
    • Unit - A unit Enters the map
  • Conditions
    • (Triggering unit) is a Hero Equal to True
  • Actions
    • Set Variable Hero = (Triggering unit)
    • Unit - Create 1 Hero Dummy for (Owner of Hero)...
    • Set Variable HeroDummy = (Last created unit)
    • -------- Link the Dummy to the Hero --------
    • Set Variable CV = (Custom value of Hero)
    • Set Variable HD_Dummy[CV] = HeroDummy
    • -------- Link the Hero to Dummy --------
    • Set Variable CV = (Custom value of HeroDummy)
    • Set Variable HD_Hero[CV] = Hero
Then whenever one of my Heroes casts a triggered spell which would require the use of a Dummy unit, I simply grab their Hero Dummy, remove it's previously casted ability, add the new one, and order it to cast the new spell. This is done using a simple system that tracks the Hero Dummy's previously casted ability and also simplifies the process to a certain extent, for example like this:
  • Events
    • Unit - A unit Starts the effect of an ability
  • Conditions
    • (Ability being cast) Equal to Firebreath (Fake)
  • Actions
    • Set Variable Hero = (Triggering unit)
    • Set Variable HeroDummy = HD_Dummy[(Custom value of Hero)]
    • Set Variable HeroDummyAbility = Firebreath
    • Trigger - Run Hero Dummy Setup (ignoring conditions)
    • Unit - Order HeroDummy to cast Neutral - Firebreath at (Target point of ability being cast)
This works fine even when players control multiple Heroes since each individual Hero will have its own exclusive Hero Dummy. From there I can manage the Damage events and Death events by checking whether or not a Hero Dummy was involved. If one was, I can change the DamageEventSource/Killing Unit to the Hero that is linked to the Hero Dummy. Note that you can't literally change the Event Response (Killing Unit), so you would use a variable instead.

For example, let's intercept the Death event and make a system that allows us to always give the kill credit to the Hero instead of the Hero Dummy:
  • Events
    • Unit - A unit dies
  • Conditions
  • Actions
    • Set Variable KillingUnit = (Killing unit)
    • If (Unit-type of KillingUnit Equal to Hero Dummy) then Set Variable KillingUnit = HD_Hero[(Custom value of KillingUnit)]
    • Set Variable DeathEvent = 1.00
    • Set Variable DeathEvent = 0.00
So now using the same method that Damage Engine uses with it's custom DamageEvents, we can create our own custom "A unit dies" triggers which have already managed the Hero Dummy -> Hero process for us:
  • Events
    • Game - DeathEvent becomes Equal to 1.00
  • Conditions
    • (KillingUnit Equal to Paladin)
    • (Level of Redemption for KillingUnit Greater than 0)
  • Actions
    • Unit - Set life of KillingUnit to life of KillingUnit + 100.00
NOTE that this isn't a perfect example and will crash the map if you use the Kill Unit function inside of a DeathEvent trigger (recursion issues), but that is easily avoided.

Also, turning it into a system like this isn't necessary but it's wise to do if you have or plan on having a lot of "A unit dies" triggers. Alternatively, you could just do the whole "Set KillingUnit / If KillingUnit Equal to..." process in each of your individual "A unit dies" triggers.

For your DamageEvent triggers you can create another system that's similar to what I did above, however that may start to feel overcomplicated and inefficient. Instead you could just handle the changing of DamageEventSource manually in your DamageEvent triggers.
  • Events
    • Game - DamageEvent becomes Equal to 1.00
  • Conditions
  • Actions
    • If (Unit-type of DamageEventSource Equal to Hero Dummy) then Set Variable DamageEventSource = HD_Hero[(Custom value of DamageEventSource )]
    • Unit - Set life of DamageEventSource to life of DamageEventSource + 100.00
^ So if our Hero Dummy dealt damage and is the DamageEventSource, change the DamageEventSource to the Hero that is linked to the Dummy. Now our Hero is getting healed instead of the Dummy.
Nice tutorial!! now i can link my hero properly thanks a lot!!
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,503
Hi Uncle.

1) In that case it would not work for me, because in my map i use two types of increases, percentage and flat, so if i seek to simplify the increase using multipliers(which i use for percentages) it will only work for DPS, not for direct damage, for example:
On my map there are two items, one grants "spell damage increase by 50%" while the other grants "spell damage increase by 50", if the Mountain King possesses both items, his Storm Bolt(100 Damage) would end up dealing 200 damage, while the KOTG using his Entangling Roots(10 DPS) would do 65 DPS(650 DAMAGE!), if i do what you say, then the Storm Bolt would end up doing 15 damage and the Entangling Roots 6.0(60 damage), so it would be meaningless. I want to find a way for a group of skills like DPS to have its own particular damage.

2)Ok, i'll try it, thanks.
I'm not sure I understand your example with 15 damage Storm Bolts. The math for the Ability Power method would go something like this if done properly:

Storm Bolt deals 100 damage and has a 1.0 Ability Power ratio.
The MK has 100 Ability Power and +50% Ability Power: 100 * 1.5 = 150 Ability Power.
The final result: 100 base damage + (150 bonus damage * 1.0 AP Ratio) = 250 total damage

Entangling Roots deals 10 damage per second and has a 0.1 Ability Power ratio.
The KOTG has 100 Ability Power and +50% Ability Power: 100 * 1.5 = 150 Ability Power.
The final result: 10 base damage + (150 bonus damage * 0.1 AP Ratio) = 25 total damage

You could also introduce a 3rd stat which multiplies total spell damage without being affected by ratios.
So you'd have three stats, Ability Power, Ability Power %, and % Bonus Spell Damage.

You can experiment with these methods and find something that works for you.
 
Last edited:
Level 3
Joined
Jan 23, 2014
Messages
32
I'm not sure I understand your example with 15 damage Storm Bolts. The math for the Ability Power method would go something like this if done properly:



You could also introduce a 3rd stat which multiplies total spell damage without being affected by ratios.
So you'd have three stats, Ability Power, Ability Power %, and % Bonus Spell Damage.

You can experiment with these methods and find something that works for you.
Hi Uncle! i was testing your method and worked, but not the way i wanted, basically, i had to do all DPS but customized skills and directly add 0.10(10%) to the damage they cause, that is, all additional aggregates to these skills, will automatically transform into 10% of the causes of damage. I have always had these types of problems and i don't know if i am the only one, hopefully there was any way to index skills, or that there was something type of trigger called "Custom value of ABILITY" or a variable called "Ability-type" similar to "Unit-Type", i think that would save many headaches. Thanks for the help, Uncle.

for 2), I can't recall if 5.5 was already using the "hide damage" damage type of ignoring damage if the source is "DAMAGE_TYPE_UNKNOWN".

For 1), the given suggestion came in 2 parts, while you had only addressed the first. The second suggestion was to trigger the damage so you know thoroughly which is DoT and which is initial damage (and you can do this using DamageEventType and specify a DamageTypeDoT).
Hi Bribe, on my map the variable "DamageTypeDoT" does not appear :cry:
 
Level 6
Joined
Jul 22, 2015
Messages
65
Here is a 1.31.1 test-map with latest damage-engine and 5.7.1.2
Note: This is my "installation" of Damage Engine that I've upgraded since Damage Engine 3.4 or so. It may contain unused variables.
Hello , i have found bug on this system, it cannot heal my unit if i set like this :
  • Damage
    • Events
      • Game - DamageModifierEvent becomes Equal to 1.00
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of DamageEventSource) Equal to Sorceress
        • Then - Actions
          • Set DamageEventAmount = (0.00 - DamageEventAmount)
        • Else - Actions
how to heal my unit with this system? or just use set unit life? thanks!
 
how to heal my unit with this system? or just use set unit life? thanks!
So, is conversion to healing still done by simply changing the DamageEventAmount to a negative number? Because I can't get it to work in my map.
Yes, but you have to use the "Spells" attack type and the damage type must NOT be "Normal".
I'd guess you'll have to add these "Set" in your if
  • ProbablyMissingStuff
    • Events
    • Conditions
    • Actions
      • Set DamageEventAttackT = ATTACK_TYPE_SPELLS
      • Set DamageEventDamageT = DAMAGE_TYPE_DIVINE
(Attack Type Spells seems to be important, Damage-type is any NOT "normal")
 
Level 39
Joined
Feb 27, 2007
Messages
4,989
I think this needs a compatibility offshoot for all of the insane pre-1.31 developers who keep needing what this system does but end up having to use other even worse older systems that are compatible. Even just an old version from before you swapped over to use the Any Unit Takes Damage event.
 

Bribe

Code Moderator
Level 50
Joined
Sep 26, 2009
Messages
9,464
I think this needs a compatibility offshoot for all of the insane pre-1.31 developers who keep needing what this system does but end up having to use other even worse older systems that are compatible. Even just an old version from before you swapped over to use the Any Unit Takes Damage event.
Don't you mean Damage Engine 3A? If they don't have the any-unit-takes-damage event, they won't have the BlzSetUnitDamage. If they have BlzSetUnitDamage, then I would also think they would have the Any Unit Takes Damage event.
 
Level 11
Joined
Jul 4, 2016
Messages
627
is the numbers used to determine different points of damage based on numbers under How it Works? Or is there documentation somewhere I can find this information?
 
Level 11
Joined
Jul 4, 2016
Messages
627
Where in the documentation am I referencing these numbers? I can cross-reference it.
It is not in the current documentation but I recall a post a while back indicating that you can detect specifically damage before armor, after armor, ect. by making an DamageEvent equal to 1,2,3, or 4 ect. It might be a older version. Would it be correct to assume it doesn't work that way anymore?
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,503
Hey Bribe, would you be so kind as to explain to me how you detect lethal damage? Is it as simple as "If damage amount >= life of damage target". I was wondering because I wanted to use the GUI event:
  • Events
    • Unit - A unit Takes damage
But I wasn't sure if the Damage from this Event was before armor calculations / other sources of mitigation, which could change things. Is there an Event Response I'm missing or something?
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,503
LethalDamageEvent itself would work better than the generic unit takes damage event, because by that point Damage Engine as well as WarCraft 3 have already calculated all damage. The you set LethalDamageHP to whatever HP you want if you want to prevent death.
Right, so there's no easy way to do it outside of your system? Because I was hoping I could recreate whatever method was used to calculate lethal damage without needing Damage Engine. Sometimes I only need one tiny aspect of the system and importing 100 variables is a bit much :p
 
Top