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

Bribe

Code Moderator
Level 50
Joined
Sep 26, 2009
Messages
9,456
Well I see that i'm not the only one experiencing the same thing. I'm also having this issue for some reason.

I dunno if pick a chew was turning off his damage detection trigger but I'm not so probably this is a Damage Engine v5.4.2.0 specific bug? I'm trying to check the reason as to why this happens but with no luck.

Could you please let me know how I can reproduce the error you describe (steps)? For example is that the map file where you encountered the issue?
 
Level 2
Joined
Apr 17, 2017
Messages
22
Could you please let me know how I can reproduce the error you describe (steps)? For example is that the map file where you encountered the issue?

Well like @pick-a-chew said, it is very random probably related to triggered spells. However, I managed to consistently replicate the issue.

Here I uploaded a map so to replicate the error, follow these steps:

1. Learn all the Ranger General Hero's skills. Make sure to activate Frost Arrows before anything else.
2. Go to the left side of the Ranger General's location (near the gold mine with the dragon turtle and hydras). Bring all the units with you especially the melee hero.
3. Cast the Split Cold Arrows ability of the Ranger General on any of the creeps on the gold mine.
4. Make sure the melee hero will attack as soon as after the spell was cast.
5. Then wait for the Dragon Turtle to cast his Crushing Wave on your units.

Then after all of these, the DE will stop working. This is the closest thing to replicate the issue. You'll notice that all damage are not working anymore. Hope this helps you pinpoint the cause since all my triggered spells as well as the vanilla spells works perfectly before 5.4.2.0.
 

Attachments

  • (24)IslandExpedition-Warcraft Conquest Mod.w3x
    6.4 MB · Views: 98
Level 13
Joined
Jul 15, 2007
Messages
763
I have not been able to reproduce my issue but I am gathering player feedback which I'm hoping will lead to something soon. Any potential lead I get doesn't result in anything in single player testing so at the moment I'm theorizing bad spell interactions could be at play (in my map, any unused triggers are deactivated if the appropriate heroes aren't chosen).

I have gone through all damage engine triggers in my map and cannot find anything offensive. I found a few surviving "NextDamageType=0", "Run ClearDamageEvent" and "Set DamageEventTrigger=This Trigger" which I have since removed, I'm not sure if there's any potential for those to do bad stuff. Also I am not turning DE triggers on/off since the more recent versions of DE. I am now confident my DE triggers are how they should be.

I just put out a new version of my map for my players to bug test. I will let you know if i'm still having issues and if I make any discoveries.

Edit: also I don't use DamageEngine_inception.
 

Bribe

Code Moderator
Level 50
Joined
Sep 26, 2009
Messages
9,456
Well like @pick-a-chew said, it is very random probably related to triggered spells. However, I managed to consistently replicate the issue.

Here I uploaded a map so to replicate the error, follow these steps:

1. Learn all the Ranger General Hero's skills. Make sure to activate Frost Arrows before anything else.
2. Go to the left side of the Ranger General's location (near the gold mine with the dragon turtle and hydras). Bring all the units with you especially the melee hero.
3. Cast the Split Cold Arrows ability of the Ranger General on any of the creeps on the gold mine.
4. Make sure the melee hero will attack as soon as after the spell was cast.
5. Then wait for the Dragon Turtle to cast his Crushing Wave on your units.

Then after all of these, the DE will stop working. This is the closest thing to replicate the issue. You'll notice that all damage are not working anymore. Hope this helps you pinpoint the cause since all my triggered spells as well as the vanilla spells works perfectly before 5.4.2.0.

I've attached your map with two potential avenues of Damage Engine failure that had to do with 5.4.2.0 mechanics - can you please try those steps of yours again and let me know if either of the debug messages appear when it fails?
 

Attachments

  • (24)IslandExpedition-Warcraft Conquest Mod.w3x
    6.4 MB · Views: 108
Level 2
Joined
Apr 17, 2017
Messages
22
I've attached your map with two potential avenues of Damage Engine failure that had to do with 5.4.2.0 mechanics - can you please try those steps of yours again and let me know if either of the debug messages appear when it fails?


I've done the same steps as before and there's no debug messages popping up when the DE stops working.
 

Bribe

Code Moderator
Level 50
Joined
Sep 26, 2009
Messages
9,456
I've done the same steps as before and there's no debug messages popping up when the DE stops working.
Thank you for running those tests - I didn't think those would fail, but I chose those particular statements because their logical was changed in 5.4.2.

The fault is 100% in damage engine, because I went over all your code and there's nothing wrong with your implementation. I will keep trying.
 
Last edited:
Level 2
Joined
Apr 17, 2017
Messages
22
Thank you for running those tests - I didn't think those would fail, but I chose those particular statements because their logical was changed in 5.4.2.

The fault is 100% in damage engine, because I went over all your code and there's nothing wrong with your implementation. I will keep trying.

You're very much welcome, in the meantime I'll focus on other aspects of my project while you look for the root cause of this problem. Please just let me know if you want me to test it again. Don't give up on this awesome system! :psmile:
 
Level 13
Joined
Jul 15, 2007
Messages
763
After some feedback I have come to notice that the issue occurs when players are fighting creeps with a Cold Arrows based ability. I don't have any game completion data yet so can't 100% postulate that these creep waves are the reason for the breakage, but I think it's a pretty strong pattern at this point.

I will disable these creep waves in my map and I'll let you know if the issue is avoided.
 
Level 2
Joined
Apr 17, 2017
Messages
22
After some feedback I have come to notice that the issue occurs when players are fighting creeps with a Cold Arrows based ability. I don't have any game completion data yet so can't 100% postulate that these creep waves are the reason for the breakage, but I think it's a pretty strong pattern at this point.

I will disable these creep waves in my map and I'll let you know if the issue is avoided.

@Bribe maybe this is the answer to the problem as the spell that i used for replicating the issue was based on the cold arrows ability as well. This could help narrow down your efforts to fix the bug. I'll run some more test to see if this is the root of the problem.
 
Level 13
Joined
Jul 15, 2007
Messages
763
I can now confirm that disabling these creeps in the game avoids the issue completely.

Thankfully no player abilities have cold arrows so I now have a workaround for the issue in my map.

I took another look at the clip i captured of the issue and this was the sequence of events I was able to discern (hidden below, it may or may not be useful). I tried reproducing this externally but could not, so there may be other pieces of the puzzle I haven't realized.


1. Teal's hero hits a cold arrows ranged creep with a black arrows based ability.
2. Blue's hero attacks a melee creep but misses (just a regular melee attack)
2. Yellow's hero hits a melee creep (his hero has a passive that heals nearby allies based on the damage he deals).
3. Red's hero hits a melee creep (just a regular melee attack)
4. Purple hits a melee creep (just a regular melee attack)
5. Orange's hero hits a melee creep (just a regular melee attack)
6. Three cold arrows ranged creeps hit Yellow's hero in quick succession (with cold arrows)
7. A different type of ranged creep hits purple's hero (just a regular ranged attack)
8. Teal's hero hits a melee creep (with a black arrows based ability).
9. Orange's hero casts starfall
10. A cold arrows creep is killed by starfall, two other creeps are hit by starfall and take damage but don't die.
11. Red attacks a melee creep (just a regular attack) but does no damage, DE is broken from here on out.

*Purple = Based on a W3 ability, trigger enhanced to deal damage
*Pink = Based on a W3 ability, augmented by DE in a way that doesn't cause coded damage
*Yellow = Based on a W3 ability
 

Bribe

Code Moderator
Level 50
Joined
Sep 26, 2009
Messages
9,456
If Cold Arrows is the culprit, then I suspect the issue is related to the following situation:

In 5.4.2, I made it so that the Damage Engine deals the zero damage event from the initial trigger because I found the secondary trigger doesn't always run. In order to fix the issue with Sunken City, I made it skip the second event sequence in such a scenario.

However, with Cold Arrows, there is a weird damage sequence where 3 events go off - one for the buff application, one for the on-hit damage, and then 0.01 seconds later there is some other damage event.

I think that third event might be getting played immediately following the very quick events you guys describe, so in the sense that damage from unit a to b (cold arrows) deploys, the timer finishes, but then another attack is resolving in the same instant that the 3rd proc event is firing, amd botching the predictable workflow. Or something along those lines.

So I feel the solution to the problem is to add a third layer of security (I have a layer for spirit link and another for Thorns) which somehow catches and deals with this third rogue damage instance.

I will have to test the sequence of damage from Cold Arrows - ie. which of the three occurrences fire the DAMAGING event and the DAMAGED event, or only one or the other.

Edit: I went over the logic in my head and found a way that the DAMAGED event would break the system if it ran without a DAMAGING event, and the fix is to change the first if-statement:

JASS:
if dreaming or udg_DamageEventPrevAmt == 0.00 then

//should add to it the following:

or (r == 0.00 and not alarmSet and not kicking)

That would definitely plug up that glitch 100%.

Ultimately I think the easiest solution is to set udg_DamageEvenrPrevAmt to 0.00 after the 0.00 second timer expires. In fact I'll just do that.
 
Last edited:
Level 2
Joined
Apr 17, 2017
Messages
22
Ok I've updated to 5.4.2.1 - including porting the same fix to the Lua variant. I am very confident this will fix the issues recently reported (thought unfortunately I could not replicate the issue they reported, I at least fixed the hypothetical situation where such a system failure should occur).

Well, I really don't want to burst your bubble but upon testing with your updated code, the same issue still occurs for me.

How bout on your end @pick-a-chew ?? any luck??

Other thing that I noticed is if you make the damage of cold arrows coded, It works just fine. I'm not 100% sure but I'll run some tests just to be safe.

EDIT: Well scratch that last, it made it worse as it now happens the instance that a Cold arrow spell is cast. But it is 100% that the issue is with Cold Arrows (and by extension, Frost Arrows).
 
Last edited:
Level 13
Joined
Jul 15, 2007
Messages
763
I haven't had time to implement the new version of DE and I will be away until Tuesday now, so I wont be able to check until then.

My players have still not encountered the problem since I disabled creeps with Cold Arrows so I am more confident that Cold Arrows is the issue. I did do some testing earlier and basically had a cold arrows Gatling gun at the same time as all kinds of triggered damage going on and I still couldn't recreate the issue.

More bothersome was that I looked at a different replay of the issue and the events before the breakage were rather benign; the DE broke on a Serpent Ward landing its attack, and before that, was another Serpent Ward landing its attack and a damage tick of a triggered damage over time spell. The last cold arrow was like 2 seconds before the bug.

But yeah I can't provide any useful updates on the newest version until I'm back!
 

Bribe

Code Moderator
Level 50
Joined
Sep 26, 2009
Messages
9,456
Well, I really don't want to burst your bubble but upon testing with your updated code, the same issue still occurs for me.

How bout on your end @pick-a-chew ?? any luck??

Other thing that I noticed is if you make the damage of cold arrows coded, It works just fine. I'm not 100% sure but I'll run some tests just to be safe.

EDIT: Well scratch that last, it made it worse as it now happens the instance that a Cold arrow spell is cast. But it is 100% that the issue is with Cold Arrows (and by extension, Frost Arrows).

If it now happens in the same instant for you (didn't break anything in the demo map), I will try again to replicate it in your map but with my debug messages on.

I have no idea what's causing this tbh.
 

Bribe

Code Moderator
Level 50
Joined
Sep 26, 2009
Messages
9,456
I have updated the scripts in the Damage Engine thread to fix the glitch, it is done by adding an extra line to the timer callback to set dreaming = false. It is occuring on one of the "tick" calls of the cold arrows debuff.

I haven't updated either map yet because my internet went out, but the script updates I posted are enough.

Ideally I'd like to try to find out why the threads are crashing in the first place. I ruled out division by zero via debugs, which unfortunately wasn't the culprit. I obviously don't want that thread to crash even if the primary issue is fixed, so I will make sure the thread doesn't crash prior to uploading the fixed version.
 
Last edited:
Level 2
Joined
Apr 17, 2017
Messages
22
I have updated the scripts in the Damage Engine thread to fix the glitch, it is done by adding an extra line to the timer callback to set dreaming = false. It is occuring on one of the "tick" calls of the cold arrows debuff.

I haven't updated either map yet because my internet went out, but the script updates I posted are enough.

Ideally I'd like to try to find out why the threads are crashing in the first place. I ruled out division by zero via debugs, which unfortunately wasn't the culprit. I obviously don't want that thread to crash even if the primary issue is fixed, so I will make sure the thread doesn't crash prior to uploading the fixed version.

Well upon copying the script, it runs smoothly on my map now. But of course, thorough testing is in order just to be safe. Will let you know if things are stable for good this time.
 
Level 2
Joined
Apr 17, 2017
Messages
22
5.4.2.2 has been released in both Lua and vJass formats. This completely squashes the root cause of the Cold Arrows glitch.

I think I can finally focus my resources back into my other projects now like getting Unit Event, Knockback 2.5D and Spell System converted to Lua.

I second this now. The Cold Arrow glitch is no more. Keep up the good work man.
 
Level 13
Joined
Oct 18, 2013
Messages
690
Great to see the frequent support for this DDS, many thanks Bribe. Unfortunately I can't use any of these new versions in a production environment for my map, stuck with testing on this testmap.
 
Level 13
Joined
Jul 15, 2007
Messages
763
Just thought I'd let you know the newest version fixed up the bug on my map too.

I have been optimizing my map to reduce the recent performance issues I've had with DDS and have established two main sources of performance problems:

  1. dealing damage within a damage event trigger can cause spikes of lag if it fires multiple times simultaneously (example: adding a feedback effect to a Tauren's pulverize)
  2. dummy cast abilities that are set to 0 damage (such as a storm bolt for stun) that are utilized within a damage event trigger can also cause spikes of lag if also triggered simultaneously (example: adding a stun to a Tauren's pulverize).

I am making good progress in cutting down the number of 1. type situations as there is much less need to deal damage within damage event triggers, but the type of 2. situations are more difficult to avoid. Is there a way for DE to not care about 0 damage spells or should i realistically be considering ways to replace 0 damage abilities?
 

Bribe

Code Moderator
Level 50
Joined
Sep 26, 2009
Messages
9,456
Just thought I'd let you know the newest version fixed up the bug on my map too.

I have been optimizing my map to reduce the recent performance issues I've had with DDS and have established two main sources of performance problems:

  1. dealing damage within a damage event trigger can cause spikes of lag if it fires multiple times simultaneously (example: adding a feedback effect to a Tauren's pulverize)
  2. dummy cast abilities that are set to 0 damage (such as a storm bolt for stun) that are utilized within a damage event trigger can also cause spikes of lag if also triggered simultaneously (example: adding a stun to a Tauren's pulverize).

I am making good progress in cutting down the number of 1. type situations as there is much less need to deal damage within damage event triggers, but the type of 2. situations are more difficult to avoid. Is there a way for DE to not care about 0 damage spells or should i realistically be considering ways to replace 0 damage abilities?

The second one I am pretty sure you can change the damage amount from there, although you'd have to set the damage event amount via custom script and I am not 100% sure if it even works. I will try it in a couple weeks.

Basically from a zero damage event, do custom script: BlzSetEventDamage(100.00) and see if it actually changes up the damage.

If it works, then I will update Damage Engine to allow that amount to be set - and if it works then I'll also have it use the DamageModifierEvent process as well.
 
Level 1
Joined
Jul 21, 2019
Messages
7
Hello Bribe, i'm new to vjass and I was looking at your damage system, I wanted to know is there a way to use it to change the damage value to only living/undead units? I was looking for a way to do that but I am not able to find any way to identify the unit instead of the player race. Also whenever I try to import the triggers to a new map I always get an error about a missing endblock and I do not know how to fix that.
 
Last edited:
Level 1
Joined
Jul 21, 2019
Messages
7
Thank you very much it has been a long time since I have used the editor, but I have checked and I have the JassHelper enabled with it off it gives many more errors. I keep getting the error. I'm not sure what I am doing wrong.
 

Attachments

  • Untitled1.png
    Untitled1.png
    167.9 KB · Views: 135
Level 13
Joined
Oct 18, 2013
Messages
690
What's with all the units on the map periodically taking 1 damage? It's blue, indicating spell damage I think? Very odd.

Spirit Link also seems to be broken on this latest patch of DDS, which is fine for my map but probably troublesome for some mappers.
 

Bribe

Code Moderator
Level 50
Joined
Sep 26, 2009
Messages
9,456
What's with all the units on the map periodically taking 1 damage? It's blue, indicating spell damage I think? Very odd.

Spirit Link also seems to be broken on this latest patch of DDS, which is fine for my map but probably troublesome for some mappers.

If you link all your units together, they all will get the damage distributed. That's how Spirit Link works in WarCraft 3. It's not done in groups but in all units total that are linked.
 
Level 13
Joined
Oct 18, 2013
Messages
690
I know how Spirit Link works, I'll clarify. Walker was buffed with 7 other units, and damage to a Spirit Linked unit was dealing 0 damage to the Walker.

Any word on units periodically taking 1 damage?
 
Level 1
Joined
Jul 21, 2019
Messages
7
When i was looking at it it seemed to happen around the priest when he cast heal, not sure why. It was only for the GUI version, the vjass didnt have the same problem. Just looked at it again and there is a trigger untitled 2 that causes the damage.
 
Last edited:
Level 6
Joined
Jul 12, 2017
Messages
139
So I have been using this tool lately and it's working nicely but I have constant lag at all time so I wonder what did I do wrong with my triggers?

this is one of my trigger that I think it has been causing lag from time to time

upload_2019-7-25_1-51-7.png

Any idea on how to fix this? Thank you in advance.
 

Attachments

  • upload_2019-7-25_1-50-13.png
    upload_2019-7-25_1-50-13.png
    48.8 KB · Views: 89

Bribe

Code Moderator
Level 50
Joined
Sep 26, 2009
Messages
9,456
I know how Spirit Link works, I'll clarify. Walker was buffed with 7 other units, and damage to a Spirit Linked unit was dealing 0 damage to the Walker.

Any word on units periodically taking 1 damage?

Make sure your Damage Engine is up to date.

When i was looking at it it seemed to happen around the priest when he cast heal, not sure why. It was only for the GUI version, the vjass didnt have the same problem. Just looked at it again and there is a trigger untitled 2 that causes the damage.
Need clarification.
 
Level 1
Joined
Jul 21, 2019
Messages
7
I was referring to the periodic 1 damage, it comes from the trigger Untitled Trigger 002.
 

Attachments

  • Untitled1.png
    Untitled1.png
    123.2 KB · Views: 237
Level 4
Joined
Jul 28, 2019
Messages
75
I'm getting the 1 damage and mass "dodges" when attacking something with the peasant. Also when importing the lua version into a fresh map with lua set in map options, the Wc3 crashes soon as a unit attacks.
bVay8Ms.jpg

pb6mY4l.jpg
 
Level 9
Joined
Jul 18, 2005
Messages
319
But, I suspect the Poison Arrows ability might be causing a similar glitch as Cold Arrows in 5.4.2.1? In particular, when you deal damage with the UnitDamageTarget native on one the event responses and it fails to run the subsequent events. I'll get around to sorting out a test map of this sometime this week...
 

Bribe

Code Moderator
Level 50
Joined
Sep 26, 2009
Messages
9,456
But, I suspect the Poison Arrows ability might be causing a similar glitch as Cold Arrows in 5.4.2.1? In particular, when you deal damage with the UnitDamageTarget native on one the event responses and it fails to run the subsequent events. I'll get around to sorting out a test map of this sometime this week...
Make sure your Damage Engine is up to date there. If so, please do provide that demo map so I can troubleshoot (once I am back from vacation; soonest this time next week).
 
Level 9
Joined
Jul 18, 2005
Messages
319
Make sure your Damage Engine is up to date there. If so, please do provide that demo map so I can troubleshoot (once I am back from vacation; soonest this time next week).

I've attached a simple demo map with a modified Poison Arrows [AEpa] ability that uses a 0.01 buff duration to detect whether the player uses and auto-casts the ability. Two additional triggers have been implemented on top of the latest version of Damage Engine. The first trigger (Flame Arrows) checks for the buff proc'd by the Poison Arrows ability, then deals bonus damage. The second trigger (Effect Generation) generates the lifesteal SFX for attacks.

Set the custom ability to autocast on Sylvanas, and you'll observe that the lifesteal SFX stops appearing. This still holds if the custom ability's autocast is turned off. However, the bonus damage still goes through.

Commenting out the UnitDamageTarget call in the Flame Arrows trigger renders the lifesteal SFX regardless of the autocast state.
 

Attachments

  • DamageEngine_Test.w3x
    39.6 KB · Views: 22

Bribe

Code Moderator
Level 50
Joined
Sep 26, 2009
Messages
9,456
I've attached a simple demo map with a modified Poison Arrows [AEpa] ability that uses a 0.01 buff duration to detect whether the player uses and auto-casts the ability. Two additional triggers have been implemented on top of the latest version of Damage Engine. The first trigger (Flame Arrows) checks for the buff proc'd by the Poison Arrows ability, then deals bonus damage. The second trigger (Effect Generation) generates the lifesteal SFX for attacks.

Set the custom ability to autocast on Sylvanas, and you'll observe that the lifesteal SFX stops appearing. This still holds if the custom ability's autocast is turned off. However, the bonus damage still goes through.

Commenting out the UnitDamageTarget call in the Flame Arrows trigger renders the lifesteal SFX regardless of the autocast state.
Thanks for the report! I just updated Damage Engine to fix this problem, which was the result of IsDamageCode reflecting a false positive.

The autocast issue you talk about is fixable by removing the buff from within the damage event. Why are you using two triggers? The lifesteal trigger isn't checking for the buff, so there's your answer on that one.
 
Last edited:
Level 9
Joined
Jul 18, 2005
Messages
319
The autocast issue you talk about is fixable by removing the buff from within the damage event.

Alright, I'll make sure to do that.

Why are you using two triggers? The lifesteal trigger isn't checking for the buff, so there's your answer on that one.

Two triggers was... the fastest way I could think of to make a reproducible test-map. The lifesteal SFX trigger was how I noticed something went awry.
 

Bribe

Code Moderator
Level 50
Joined
Sep 26, 2009
Messages
9,456
I am curious, is this capable of telling which Weapon Index a unit is using at a given time? Like telling the difference between using Attack 1 and Attack 2?
We talked about this on the Discord, but if any future readers are curious the main points are:

1) not exactly
2) melee attackers with a ranged attack 2 such as heroes or gargoyles use WEAPON_TYPE_NONE for the attack 2 while using a weapon type above 0 for the attack 1
3) mixed ranged like Siege Tank and Gyrocopter you'll have to distinguish the attack type (siege is 1, pierce is 2) and similar for mixed melee attackers like Mountain Giant (though in his case Siege is attack 2).
 

Bribe

Code Moderator
Level 50
Joined
Sep 26, 2009
Messages
9,456
First don't use DamageEventAOEGroup, use your own.

Second, I recommend using bj_wantDestroyGroup instead of a custom group variable,

Third, I recommend not using a (Matching conditions) in the pick, instead check the conditions of the group inside an if/else/then block inside the multiple actions of the group pick itself. Refer to said unit as (Picked unit).

If it still lags, then what's happening is your other damage event triggers are running quite a few instances due to this one modifier trigger activating them all.

I recommend using a "main" damage trigger with one key event that then dispatches other triggers which shared that event. Or switch to Lua Damage Engine with Fast Triggers enabled and that kind of lag will be a thing of the past.
 
Top