Damage Engine 5.7.1.2

This bundle is marked as approved. It works and satisfies the submission rules.
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

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 "DamageEvent Equal to 1.00". 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 "DamageModifierEvent Becomes Equal to 1.00, 2.00 or 3.00". 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 "DamageModifierEvent Becomes Equal to 4.00". 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 "DamageModifierEvent" 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 1.00" 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 DamageModifierEvents up to 3.99
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, DamageModifierEvent 4.00 and up 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 DamageEvent 1.00. 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: 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 <DamageModifierEvent> becomes Equal to 1.00".
    • 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 "DamageModifierEvent 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
    • Conditions
    • Actions
      • -------- - --------
      • -------- New in Damage Engine 5.7 - you can use the below to automatically assign conditions --------
      • -------- - --------
      • -------- Equal to - Same as no conditions, works as it always has --------
      • -------- Less than - Same as IsDamageAttack Equal to True --------
      • -------- Less than or equal to - Same as IsDamageMelee Equal to True --------
      • -------- Greater than or equal to - Same as IsDamageRanged Equal to True --------
      • -------- Greater than - Same as IsDamageSpell Equal to True --------
      • -------- Not Equal to - Same as IsDamageCode Equal to True --------
      • -------- - --------
      • -------- 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
      • -------- - --------
      • -------- Added 25 July 2017 to allow detection of things like Bash or Pulverize or AOE spread --------
      • -------- - --------
      • Set VariableSet DamageEventAOE = 1
      • Set VariableSet DamageEventLevel = 1
      • -------- - --------
      • -------- In-game World Editor doesn't allow Attack Type and Damage Type comparisons. Therefore I need to code them as integers into GUI --------
      • -------- - --------
      • Set VariableSet ATTACK_TYPE_SPELLS = 0
      • Set VariableSet ATTACK_TYPE_NORMAL = 1
      • Set VariableSet ATTACK_TYPE_PIERCE = 2
      • Set VariableSet ATTACK_TYPE_SIEGE = 3
      • Set VariableSet ATTACK_TYPE_MAGIC = 4
      • Set VariableSet ATTACK_TYPE_CHAOS = 5
      • Set VariableSet ATTACK_TYPE_HERO = 6
      • -------- - --------
      • Set VariableSet DAMAGE_TYPE_UNKNOWN = 0
      • Set VariableSet DAMAGE_TYPE_NORMAL = 4
      • Set VariableSet DAMAGE_TYPE_ENHANCED = 5
      • Set VariableSet DAMAGE_TYPE_FIRE = 8
      • Set VariableSet DAMAGE_TYPE_COLD = 9
      • Set VariableSet DAMAGE_TYPE_LIGHTNING = 10
      • Set VariableSet DAMAGE_TYPE_POISON = 11
      • Set VariableSet DAMAGE_TYPE_DISEASE = 12
      • Set VariableSet DAMAGE_TYPE_DIVINE = 13
      • Set VariableSet DAMAGE_TYPE_MAGIC = 14
      • Set VariableSet DAMAGE_TYPE_SONIC = 15
      • Set VariableSet DAMAGE_TYPE_ACID = 16
      • Set VariableSet DAMAGE_TYPE_FORCE = 17
      • Set VariableSet DAMAGE_TYPE_DEATH = 18
      • Set VariableSet DAMAGE_TYPE_MIND = 19
      • Set VariableSet DAMAGE_TYPE_PLANT = 20
      • Set VariableSet DAMAGE_TYPE_DEFENSIVE = 21
      • Set VariableSet DAMAGE_TYPE_DEMOLITION = 22
      • Set VariableSet DAMAGE_TYPE_SLOW_POISON = 23
      • Set VariableSet DAMAGE_TYPE_SPIRIT_LINK = 24
      • Set VariableSet DAMAGE_TYPE_SHADOW_STRIKE = 25
      • Set VariableSet DAMAGE_TYPE_UNIVERSAL = 26
      • -------- - --------
      • -------- The below variables don't affect damage amount, but do affect the sound played --------
      • -------- They also give important information about the type of attack used. --------
      • -------- They can differentiate between ranged and melee for units who are both --------
      • -------- - --------
      • Set VariableSet WEAPON_TYPE_NONE = 0
      • -------- Metal Light/Medium/Heavy --------
      • Set VariableSet WEAPON_TYPE_ML_CHOP = 1
      • Set VariableSet WEAPON_TYPE_MM_CHOP = 2
      • Set VariableSet WEAPON_TYPE_MH_CHOP = 3
      • Set VariableSet WEAPON_TYPE_ML_SLICE = 4
      • Set VariableSet WEAPON_TYPE_MM_SLICE = 5
      • Set VariableSet WEAPON_TYPE_MH_SLICE = 6
      • Set VariableSet WEAPON_TYPE_MM_BASH = 7
      • Set VariableSet WEAPON_TYPE_MH_BASH = 8
      • Set VariableSet WEAPON_TYPE_MM_STAB = 9
      • Set VariableSet WEAPON_TYPE_MH_STAB = 10
      • -------- Wood Light/Medium/Heavy --------
      • Set VariableSet WEAPON_TYPE_WL_SLICE = 11
      • Set VariableSet WEAPON_TYPE_WM_SLICE = 12
      • Set VariableSet WEAPON_TYPE_WH_SLICE = 13
      • Set VariableSet WEAPON_TYPE_WL_BASH = 14
      • Set VariableSet WEAPON_TYPE_WM_BASH = 15
      • Set VariableSet WEAPON_TYPE_WH_BASH = 16
      • Set VariableSet WEAPON_TYPE_WL_STAB = 17
      • Set VariableSet WEAPON_TYPE_WM_STAB = 18
      • -------- Claw Light/Medium/Heavy --------
      • Set VariableSet WEAPON_TYPE_CL_SLICE = 19
      • Set VariableSet WEAPON_TYPE_CM_SLICE = 20
      • Set VariableSet WEAPON_TYPE_CH_SLICE = 21
      • -------- Axe Medium --------
      • Set VariableSet WEAPON_TYPE_AM_CHOP = 22
      • -------- Rock Heavy --------
      • Set VariableSet WEAPON_TYPE_RH_BASH = 23
      • -------- - --------
      • -------- Since GUI still doesn't provide Defense Type and Armor Types, I needed to include the below --------
      • -------- - --------
      • Set VariableSet ARMOR_TYPE_NONE = 0
      • Set VariableSet ARMOR_TYPE_FLESH = 1
      • Set VariableSet ARMOR_TYPE_METAL = 2
      • Set VariableSet ARMOR_TYPE_WOOD = 3
      • Set VariableSet ARMOR_TYPE_ETHEREAL = 4
      • Set VariableSet ARMOR_TYPE_STONE = 5
      • -------- - --------
      • Set VariableSet DEFENSE_TYPE_LIGHT = 0
      • Set VariableSet DEFENSE_TYPE_MEDIUM = 1
      • Set VariableSet DEFENSE_TYPE_HEAVY = 2
      • Set VariableSet DEFENSE_TYPE_FORTIFIED = 3
      • Set VariableSet DEFENSE_TYPE_NORMAL = 4
      • Set VariableSet DEFENSE_TYPE_HERO = 5
      • Set VariableSet DEFENSE_TYPE_DIVINE = 6
      • Set VariableSet DEFENSE_TYPE_UNARMORED = 7
      • -------- - --------
      • Set VariableSet DamageFilterAttackT = -1
      • Set VariableSet DamageFilterDamageT = -1
      • -------- - --------
      • 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.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 5.7.1.2 (Map)

Lua Damage Engine 1.0.2.3 (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 16
Joined
Nov 13, 2006
Messages
1,814
It doesn't stop after two minutes. It's something to do with your map. I can't imagine what your map is doing to make it bug though. You should post the triggers.

yea, in my case too was something, but i cant remember what but exactly similiar after a time its disappeared and was something wrong in set damage trigger (coz i edited and i think something was mistyped with damageeventtype )

so i think something have with damage calculation what isnt it by default

it must work atleast with 30 unit coz i tryed on my map and worked fine :D

[edit]

oh if i remember well then damageventamount was negative number so after that died the system(if i remember well)
 
Last edited:
Level 1
Joined
Apr 11, 2011
Messages
63
Here's some of triggers from my map.

On Damage, it's your trigger, i'm using it so i can see if the unit is dealing the right damage.

  • On Damage
    • Events
      • Game - DamageModifierEvent becomes Equal to 1.00
    • Conditions
      • (DamageEventSource is A Hero) Equal to True
    • Actions
      • Set Point = (Position of DamageEventSource)
      • Floating Text - Create floating text that reads (String(DamageEventAmount)) at Point with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
      • Custom script: call RemoveLocation(udg_Point)
      • Floating Text - Change (Last created floating text): Disable permanence
      • Floating Text - Change the lifespan of (Last created floating text) to 4.50 seconds
      • Floating Text - Change the fading age of (Last created floating text) to 2.50 seconds
      • Floating Text - Set the velocity of (Last created floating text) to 100.00 towards DemoVelocity degrees
      • Set DemoVelocity = (DemoVelocity + 90.00)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • DemoVelocity Equal to 360.00
        • Then - Actions
          • Set DemoVelocity = 0.00
        • Else - Actions
Element, this trigger detects every element of the unit and modifying the damage. Since my map is aos every wave has an element attach on the unit. So it's really an huge amount of unit.

  • Element
    • Events
      • Game - DamageModifierEvent becomes Equal to 1.00
    • Conditions
      • DamageEventOverride Equal to False
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (DamageEventSource has buff Water ) Equal to True
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (DamageEventTarget has buff Fire ) Equal to True
            • Then - Actions
              • Set DamageEventOverride = True
              • Set DamageEventAmount = (DamageEventAmount + (DamageEventAmount x 0.25))
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (DamageEventTarget has buff Water ) Equal to True
                • Then - Actions
                  • Set DamageEventOverride = True
                  • Set DamageEventAmount = (DamageEventAmount - (DamageEventAmount x 0.50))
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (DamageEventTarget has buff Wind ) Equal to True
                    • Then - Actions
                      • Set DamageEventOverride = True
                      • Set DamageEventAmount = (DamageEventAmount - (DamageEventAmount x 0.25))
                    • Else - Actions
        • Else - Actions
          • -------- Earth --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (DamageEventSource has buff Earth ) Equal to True
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (DamageEventTarget has buff Wind ) Equal to True
                • Then - Actions
                  • Set DamageEventOverride = True
                  • Set DamageEventAmount = (DamageEventAmount + (DamageEventAmount x 0.25))
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (DamageEventTarget has buff Earth ) Equal to True
                    • Then - Actions
                      • Set DamageEventOverride = True
                      • Set DamageEventAmount = (DamageEventAmount - (DamageEventAmount x 0.50))
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (DamageEventTarget has buff Fire ) Equal to True
                        • Then - Actions
                          • Set DamageEventOverride = True
                          • Set DamageEventAmount = (DamageEventAmount - (DamageEventAmount x 0.25))
                        • Else - Actions
            • Else - Actions
              • -------- Fire --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (DamageEventSource has buff Fire ) Equal to True
                • Then - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (DamageEventTarget has buff Earth ) Equal to True
                    • Then - Actions
                      • Set DamageEventOverride = True
                      • Set DamageEventAmount = (DamageEventAmount + (DamageEventAmount x 0.25))
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (DamageEventTarget has buff Fire ) Equal to True
                        • Then - Actions
                          • Set DamageEventOverride = True
                          • Set DamageEventAmount = (DamageEventAmount - (DamageEventAmount x 0.50))
                        • Else - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • (DamageEventTarget has buff Water ) Equal to True
                            • Then - Actions
                              • Set DamageEventOverride = True
                              • Set DamageEventAmount = (DamageEventAmount - (DamageEventAmount x 0.25))
                            • Else - Actions
                • Else - Actions
                  • -------- Wind --------
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (DamageEventSource has buff Wind ) Equal to True
                    • Then - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (DamageEventTarget has buff Water ) Equal to True
                        • Then - Actions
                          • Set DamageEventOverride = True
                          • Set DamageEventAmount = (DamageEventAmount + (DamageEventAmount x 0.25))
                        • Else - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • (DamageEventTarget has buff Wind ) Equal to True
                            • Then - Actions
                              • Set DamageEventOverride = True
                              • Set DamageEventAmount = (DamageEventAmount - (DamageEventAmount x 0.50))
                            • Else - Actions
                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • (DamageEventTarget has buff Earth ) Equal to True
                                • Then - Actions
                                  • Set DamageEventOverride = True
                                  • Set DamageEventAmount = (DamageEventAmount - (DamageEventAmount x 0.25))
                                • Else - Actions
                    • Else - Actions
                      • -------- Holy --------
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (DamageEventSource has buff Holy ) Equal to True
                        • Then - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • (DamageEventTarget has buff Shadow ) Equal to True
                            • Then - Actions
                              • Set DamageEventOverride = True
                              • Set DamageEventAmount = (DamageEventAmount + (DamageEventAmount x 0.25))
                            • Else - Actions
                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • (DamageEventTarget has buff Holy ) Equal to True
                                • Then - Actions
                                  • Set DamageEventOverride = True
                                  • Set DamageEventAmount = (DamageEventAmount - (DamageEventAmount x 0.50))
                                • Else - Actions
                        • Else - Actions
                          • -------- Shadow --------
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • (DamageEventSource has buff Shadow ) Equal to True
                            • Then - Actions
                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • (DamageEventTarget has buff Holy ) Equal to True
                                • Then - Actions
                                  • Set DamageEventOverride = True
                                  • Set DamageEventAmount = (DamageEventAmount + (DamageEventAmount x 0.25))
                                • Else - Actions
                                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    • If - Conditions
                                      • (DamageEventTarget has buff Shadow ) Equal to True
                                    • Then - Actions
                                      • Set DamageEventOverride = True
                                      • Set DamageEventAmount = (DamageEventAmount - (DamageEventAmount x 0.50))
                                    • Else - Actions
                            • Else - Actions
Extra trigger, this trigger will activate if the unit deals a damage on the unit.

  • Doomhammer Damage
    • Events
      • Game - DamageEvent becomes Equal to 1.00
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (DamageEventSource is in z_DHammer_Group) Equal to True
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • DamageEventType Not equal to DamageTypeSpell
            • Then - Actions
              • For each (Integer z_DHammer_Int[1]) from 1 to z_DHammer_Int[0], do (Actions)
                • Loop - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • DamageEventSource Equal to z_DHammer_Learner[z_DHammer_Int[1]]
                    • Then - Actions
                      • -------- DESTROY ALL --------
                      • Unit Group - Remove z_DHammer_Learner[z_DHammer_Int[1]] from z_DHammer_Group
                      • Unit - Remove Doomhammer (Damage) from z_DHammer_Learner[z_DHammer_Int[1]]
                      • Special Effect - Destroy z_DHammer_SFX1[z_DHammer_Int[1]]
                      • -------- DESTROY ALL --------
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • z_DHammer_Int[2] Equal to 0
                        • Then - Actions
                          • Trigger - Turn on Doomhammer Loop <gen>
                        • Else - Actions
                      • Set z_DHammer_Int[2] = (z_DHammer_Int[2] + 1)
                      • Set z_DHammer_Int[3] = (z_DHammer_Int[3] + 1)
                      • Set z_DHammer_Caster[z_DHammer_Int[3]] = z_DHammer_Learner[z_DHammer_Int[1]]
                      • Set z_DHammer_Point[0] = (Position of z_DHammer_Caster[z_DHammer_Int[3]])
                      • Unit - Create 1 Dummy (Global) for (Owner of z_DHammer_Caster[z_DHammer_Int[3]]) at z_DHammer_Point[0] facing Default building facing degrees
                      • Set z_DHammer_Dummy[z_DHammer_Int[3]] = (Last created unit)
                      • Unit - Add Doomhammer (Purge) to z_DHammer_Dummy[z_DHammer_Int[3]]
                      • Unit - Set level of Doomhammer (Purge) for z_DHammer_Dummy[z_DHammer_Int[3]] to z_DHammer_L1[z_DHammer_Int[1]]
                      • Unit - Order z_DHammer_Dummy[z_DHammer_Int[3]] to Orc Shaman - Purge DamageEventTarget
                      • Set z_DHammer_CD_Max[z_DHammer_Int[3]] = (16.00 - (2.00 x (Real(z_DHammer_L1[z_DHammer_Int[1]]))))
                      • Set z_DHammer_CD_Min[z_DHammer_Int[3]] = 0.00
                      • Set z_DHammer_L2[z_DHammer_Int[3]] = z_DHammer_L1[z_DHammer_Int[1]]
                      • Set z_DHammer_On[z_DHammer_Int[3]] = True
                      • Custom script: call RemoveLocation(udg_z_DHammer_Point[0])
                    • Else - Actions
            • Else - Actions
        • Else - Actions
 
Level 1
Joined
Apr 11, 2011
Messages
63
Let's say 60+ units, in the show damage trigger, after 2 minutes only few units will show their damages, and for the Doomhammer Damage is not triggered same as the Element.

But another few minutes all trigger is working and after that it won't work again.
 
Level 16
Joined
Nov 13, 2006
Messages
1,814
yes i have the map. im gonna upload it somewhere

EDIT1: I am uploading the map atm

EDIT2: after a long time here it is :vw_death: http://up.ht/xr4cKt

ok i just tryed a bit, bit for me already annoying the floating text, change it i think, make only 1 floating text/dmg and make a simple like only damage, since i tryed without lan or soemthing vs normal creeps dont ahve problem, but i think maybe coz too many unit in same place like 50 if each make 4 floating text then its 200 and since they hit back and reicive dmg its could be really a flooded area by floating texts,no?

[EDIT]

Nvm i also noticed the incredible lagg when i died even was 7 enemy around me and 5 angel,
U tryed turn of the weep dmg engine and try it again also t turn off the movement trigger from dmg engine?
 
Level 3
Joined
May 15, 2006
Messages
11
Sorry if i missed something, but i cant understand - can this system check if damage dealt by spell(i mean non-trigger spells) or normal attack? And if yes than how?
I need to make 2 triggers:
First works with normal attacks.
Second with spells.

Btw nice system but i cant get how it works)
 
Level 3
Joined
Aug 12, 2011
Messages
44
I implemented your system into my map to prevent abuse at passive spells like X% chance to cast Y without changing attack animation but I failed to use it right.
I just skimmed the thread maybe I overlooked it.

Old Trigger:
  • lucky strike
    • Events:
      • Unit - is attacked
    • Conditions:
      • Unit Type equal to Lizard
    • Actions:
      • Set chance = random integer 1 - 20
      • If all cond. etc
        • If - Conditions
          • chance <= 1
        • Then - Actions
          • Set a = attacking unit
          • Set p = pos of a
          • Unit - create dummy for owner of a
          • Unit - hide dummy
          • Unit - add 1 sec timer
          • Unit - order dummy to cast chain lightning
          • Custom script: call RemoveLocation(udg_p)
        • Else - Actions
New one:
  • lucky strike
    • Events:
      • Game - DamageEvent = 1
    • Conditions:
      • DamageEventSource = Lizard
    • Actions:
      • see above
Two problems, it only selects one specific unit (that's because of the Indexer, I guess) and it still doesn't work :|
 
Level 3
Joined
Aug 12, 2011
Messages
44
Actually, it doesn't work.

  • lucky strike
    • Events
      • Game - DamageEvent becomes Equal to 1.00
    • Conditions
      • DamageEventSource Equal to Tiny Lizard 0011 <gen>
    • Actions
      • Set luckystrike_chance = (Random integer number between 1 and 20)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • luckystrike_chance Less than or equal to 6 (for testing purposes)
        • Then - Actions
          • Set luckystrike_unit = (Attacking unit)
          • Set luckystrike_pos = (Position of luckystrike_unit)
          • Unit - Create 1 Dummy (inept) for (Owner of luckystrike_unit) at luckystrike_pos facing Default building facing degrees
          • Unit - Hide (Last created unit)
          • Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
          • Unit - Order (Last created unit) to Orc Far Seer - Chain Lightning (Attacked unit)
          • Custom script: call RemoveLocation(udg_luckystrike_pos)
        • Else - Actions
(Dummy is used in another spell, too, but til now no problems occured with it)

Apart from this how can I use the indexer that it detects all Lizards that spawn later?

---

edit: found it, I forgot to use replace attacking unit with variable but that stuff with the specific unit remains
 
Level 1
Joined
Jan 31, 2012
Messages
1
hey i have a problem, in

call TimerStart(udg_DmgEvTimer, 0, false, function DmgEvRemoveAbilities)

it will be error said "Expected a name"

-and yes i have set the Cheat Death as DamageBlockingAbility
edit:
nvm i found out that DmgEvTimer is not automatically generated
 
Level 5
Joined
Dec 12, 2011
Messages
116
Hey, on the first posts you guys were wordering when zero-damage could happen normally in-game. I didn't read all posts (9 pages) to check if someone already pointed this, but the fact is that when a Mountain King casts a Storm Bolt skill in someone, and let's say it causes 75 damage and stuns for 3 seconds, here is what damage detection picks:

Mountain King damaged <whatever> for 0.000 damage
Mountain King damaged <whatever> for 75.000 damage

and, exactly after 3 seconds:

Mountain King damaged <whatever> for 0.000 damage

This is really nice (=

EDIT: Thanks Bribe, I wasn't expecting this you gave me. xD
 
Last edited:
Level 4
Joined
Jul 17, 2011
Messages
55
i just downloaded this again today, i can't seem to copy paste the engine in my map.. i keep receiving this error from the Damage Engine trigger:


Line 610: Expected a name

Code:
call TimerStart(udg_DmgEvTimer, 0, false, function DmgEvRemoveAbilities)
 
Level 16
Joined
Nov 13, 2006
Messages
1,814
maybe dont use DamageEvent becomes Equal to 2.00 only DamageEvent becomes Equal to 1.00
who got problem with system, about damage dont showing, i got 2 case when this happen

1. damage is negative, or when u triggered the damage or during set damage trigger

2. triggered damage is 0

so if somebody got problem then just try do this in begning of the set dmg trigger

if DamageEventAmount <= 0 then
set DamageEventAmount = 0.1
endif

3. put this to event
DamageEvent becomes Equal to 2.00
 
Last edited:
Level 16
Joined
Nov 13, 2006
Messages
1,814
if i do this, then this make noticeable slowdown if in same time alot unit attack?

in set damage trigger

set cv = GetUnitUserData(DamageEventTarget)
set cv1 = GetUnitUserData(DamageEventSource)

if loadreal (key1:cv,key2:cv1) == 0 then
index[cv] = index[cv] + 1
saveunit to hash(key1:cv,key2:index, saved unit = DamageEventSource)
endif

savereal to hash(key1:cv,key2:cv1, Save value = DamageEventAmount)



and flush both where key1=dying unit custom value
 
Level 16
Joined
Nov 13, 2006
Messages
1,814
You have to have like 10,000+ actions per second to bring the FPS down like that, and that's if you're on a really bad computer like mine.

so its mean if i want do a system for keep track the damage dealt on boss via hash then it is dont make any noticeable slow down coz its enough fast the save/load to/from hashtable, right?

still idk how to make something like timer for reset the boss damage table if boss dont got damage since long, without make alot timer :D
if i thought i make a timer for boss, but idk i can restart the timer without bug if it is running? so its mean udg_timer[cv] restart if he get attack, also idk if dont make complication if in short time i restart alot times this timer because maybe will be laggy, idk i have no ideea about timer memory/cpu usage :D

How will you know if the damage dealt is a magic type or a chaos type?

u must set DamageEventType for every spell and ckeck the damageeventype in set damage trigger if u dont use vjass
 
Level 16
Joined
Nov 13, 2006
Messages
1,814
How do you do that?

i give a example:


JASS:
function Trig_Blizzard_Conditions takes nothing returns boolean
    return GetSpellAbilityId() == 'A008'
endfunction

function BlizzardTimer takes nothing returns nothing
    local timer t = GetExpiredTimer()
    local integer id = GetHandleId(t)
    local unit u = LoadUnitHandle(udg_Channel_Table, id, 1)
    local integer cv = GetUnitUserData(u)
    local unit pu
    local real x = udg_Channel_X[cv]
    local real y = udg_Channel_Y[cv]
    local real mana = GetUnitState(u, UNIT_STATE_MANA)
    local integer i = 0
     
    set udg_Channel_Dur[cv] = udg_Channel_Dur[cv] + 1

    if mana >= udg_Channel_ManaCost[cv] and udg_Channel_Boolean[cv] then
        set udg_Channel_Count[cv] = udg_Channel_Count[cv] + 1
        call SetUnitState (u, UNIT_STATE_MANA, (mana - udg_Channel_ManaCost[cv]))
        loop
            exitwhen i > 15
            call DestroyEffect(AddSpecialEffect ("Abilities\\Spells\\Human\\Blizzard\\BlizzardTarget.mdl", x + 250 * Cos(GetRandomReal(0, 360.00) * bj_DEGTORAD) , y + 250 * Sin(GetRandomReal(0, 360.00) * bj_DEGTORAD)))
            set i = i + 1
        endloop
    endif

    if udg_Channel_Dur[cv] > 1 then
        set udg_Channel_Count[cv] = udg_Channel_Count[cv] - 1
        call GroupEnumUnitsInRange(udg_UG, x, y, 300.00, null)
            loop
                set pu = FirstOfGroup(udg_UG)
                exitwhen (pu==null)
                if IsUnitEnemy(pu, GetOwningPlayer(u)) then
                    call AddUnitBuff (pu, 37, -200, 5, -1, "overhead")
                    set udg_DamageEventType = 2
                    call UnitDamageTarget(u, pu, udg_Channel_Dmg[cv], true, false, ATTACK_TYPE_HERO, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_WHOKNOWS)
                endif
                call GroupRemoveUnit(udg_UG, pu)
            endloop
    endif

    if udg_Channel_Count[cv] == 0 then
        call PauseTimer(t)
        call DestroyTimer(t)
        call FlushChildHashtable(udg_Channel_Table, id)
        if udg_Channel_CasterSF[cv] != null then
            call IssueImmediateOrder( u, "stop" )
            call DestroyEffect(udg_Channel_CasterSF[cv])

        endif
    else
        call TimerStart(t, 1, false, function BlizzardTimer)
    endif

    set t = null
    set u = null
    set pu = null
endfunction

function Trig_Blizzard_Actions takes nothing returns nothing
    local unit u = GetTriggerUnit()
    local real x = GetSpellTargetX()
    local real y = GetSpellTargetY()
    local real radius = 300.00
    local timer t = CreateTimer()
    local integer id = GetHandleId(t)
    local integer cv = GetUnitUserData(u)
    local integer alv = GetUnitAbilityLevel(u, 'A008')
    local real dmg = alv * udg_TotalSpellPower[GetPlayerId(GetTriggerPlayer())+1] / 5 + udg_TotalSpellPower[GetPlayerId(GetTriggerPlayer())+1] +1


    set udg_Channel_Boolean[cv] = true
    set udg_Channel_X[cv] = x
    set udg_Channel_Y[cv] = y
    set udg_Channel_ManaCost[cv] = 10
    set udg_Channel_Dmg[cv] = dmg
    if GetUnitState(u, UNIT_STATE_MANA) >= 10 then
        set udg_Channel_Count[cv] = 0
        set udg_Channel_Dur[cv] = 0
        call SaveUnitHandle(udg_Channel_Table, id, 1, u)
        call TimerStart(t, 0.5, false, function BlizzardTimer)
        set udg_Channel_CasterSF[cv] = AddSpecialEffectTarget("Abilities\\Spells\\Other\\Drain\\ManaDrainTarget.mdl", u, "origin")
    endif
    set t = null
    set u = null
endfunction

//===========================================================================
function InitTrig_Blizzard takes nothing returns nothing
    set gg_trg_Blizzard = CreateTrigger( )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Blizzard, EVENT_PLAYER_UNIT_SPELL_CAST )
    call TriggerAddCondition( gg_trg_Blizzard, Condition( function Trig_Blizzard_Conditions ) )
    call TriggerAddAction( gg_trg_Blizzard, function Trig_Blizzard_Actions )
endfunction


i think u can do a simple if in set damage trigger where u just check the damageeventtype value :p
 
Level 16
Joined
Nov 13, 2006
Messages
1,814
Good morning all!,

I want to prepare Enchantment A Cure Found A Target, I Like It? This and That Allows System? Right Way And How to Prepare This spell?

God Bless to All!

:fp::goblin_good_job:

i dont understand :/
what u want do? because search a unit need simple pick all unit, that dont need damage detection because for heal you dont need damage, tell more about what u want or draw it (i am not good in english so maybe that too because i dont understanded what u want to do)
 
Level 15
Joined
Oct 17, 2009
Messages
1,575
i give a example:


JASS:
function Trig_Blizzard_Conditions takes nothing returns boolean
    return GetSpellAbilityId() == 'A008'
endfunction

function BlizzardTimer takes nothing returns nothing
    local timer t = GetExpiredTimer()
    local integer id = GetHandleId(t)
    local unit u = LoadUnitHandle(udg_Channel_Table, id, 1)
    local integer cv = GetUnitUserData(u)
    local unit pu
    local real x = udg_Channel_X[cv]
    local real y = udg_Channel_Y[cv]
    local real mana = GetUnitState(u, UNIT_STATE_MANA)
    local integer i = 0
     
    set udg_Channel_Dur[cv] = udg_Channel_Dur[cv] + 1

    if mana >= udg_Channel_ManaCost[cv] and udg_Channel_Boolean[cv] then
        set udg_Channel_Count[cv] = udg_Channel_Count[cv] + 1
        call SetUnitState (u, UNIT_STATE_MANA, (mana - udg_Channel_ManaCost[cv]))
        loop
            exitwhen i > 15
            call DestroyEffect(AddSpecialEffect ("Abilities\\Spells\\Human\\Blizzard\\BlizzardTarget.mdl", x + 250 * Cos(GetRandomReal(0, 360.00) * bj_DEGTORAD) , y + 250 * Sin(GetRandomReal(0, 360.00) * bj_DEGTORAD)))
            set i = i + 1
        endloop
    endif

    if udg_Channel_Dur[cv] > 1 then
        set udg_Channel_Count[cv] = udg_Channel_Count[cv] - 1
        call GroupEnumUnitsInRange(udg_UG, x, y, 300.00, null)
            loop
                set pu = FirstOfGroup(udg_UG)
                exitwhen (pu==null)
                if IsUnitEnemy(pu, GetOwningPlayer(u)) then
                    call AddUnitBuff (pu, 37, -200, 5, -1, "overhead")
                    set udg_DamageEventType = 2
                    call UnitDamageTarget(u, pu, udg_Channel_Dmg[cv], true, false, ATTACK_TYPE_HERO, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_WHOKNOWS)
                endif
                call GroupRemoveUnit(udg_UG, pu)
            endloop
    endif

    if udg_Channel_Count[cv] == 0 then
        call PauseTimer(t)
        call DestroyTimer(t)
        call FlushChildHashtable(udg_Channel_Table, id)
        if udg_Channel_CasterSF[cv] != null then
            call IssueImmediateOrder( u, "stop" )
            call DestroyEffect(udg_Channel_CasterSF[cv])

        endif
    else
        call TimerStart(t, 1, false, function BlizzardTimer)
    endif

    set t = null
    set u = null
    set pu = null
endfunction

function Trig_Blizzard_Actions takes nothing returns nothing
    local unit u = GetTriggerUnit()
    local real x = GetSpellTargetX()
    local real y = GetSpellTargetY()
    local real radius = 300.00
    local timer t = CreateTimer()
    local integer id = GetHandleId(t)
    local integer cv = GetUnitUserData(u)
    local integer alv = GetUnitAbilityLevel(u, 'A008')
    local real dmg = alv * udg_TotalSpellPower[GetPlayerId(GetTriggerPlayer())+1] / 5 + udg_TotalSpellPower[GetPlayerId(GetTriggerPlayer())+1] +1


    set udg_Channel_Boolean[cv] = true
    set udg_Channel_X[cv] = x
    set udg_Channel_Y[cv] = y
    set udg_Channel_ManaCost[cv] = 10
    set udg_Channel_Dmg[cv] = dmg
    if GetUnitState(u, UNIT_STATE_MANA) >= 10 then
        set udg_Channel_Count[cv] = 0
        set udg_Channel_Dur[cv] = 0
        call SaveUnitHandle(udg_Channel_Table, id, 1, u)
        call TimerStart(t, 0.5, false, function BlizzardTimer)
        set udg_Channel_CasterSF[cv] = AddSpecialEffectTarget("Abilities\\Spells\\Other\\Drain\\ManaDrainTarget.mdl", u, "origin")
    endif
    set t = null
    set u = null
endfunction

//===========================================================================
function InitTrig_Blizzard takes nothing returns nothing
    set gg_trg_Blizzard = CreateTrigger( )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Blizzard, EVENT_PLAYER_UNIT_SPELL_CAST )
    call TriggerAddCondition( gg_trg_Blizzard, Condition( function Trig_Blizzard_Conditions ) )
    call TriggerAddAction( gg_trg_Blizzard, function Trig_Blizzard_Actions )
endfunction


i think u can do a simple if in set damage trigger where u just check the damageeventtype value :p

So then what are the values for the different types of damage?
 
Level 16
Joined
Nov 13, 2006
Messages
1,814
So then what are the values for the different types of damage?

ok see, this is u must do manually

so when u trigger the damage like this

JASS:
                    set udg_DamageEventType = 2
                    call UnitDamageTarget(u, pu, udg_Channel_Dmg[cv], true, false, ATTACK_TYPE_HERO, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_WHOKNOWS)

then it set damage trigger

  • Set Damage
    • Events
      • Game - DamageModifierEvent becomes Equal to 1.00
    • Conditions
      • DamageEventOverride Equal to False
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • DamageEventType Equal to 1
        • Then - Actions
          • Set DamageEventAmount = (DamageEventAmount x 4.00)
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • DamageEventType Equal to 2
            • Then - Actions
              • Set DamageEventAmount = (DamageEventAmount x 0.50)
            • Else - Actions
      • Floating Text - Create floating text that reads ((String((Integer(DamageEventAmount)))) + <Empty String>) above DamageEventTarget with Z offset 50.00, using font size 13.00, color (100.00%, 100.00%, 10.00%), and 0.00% transparency
      • Floating Text - Set the velocity of (Last created floating text) to 75.00 towards 90.00 degrees
      • Floating Text - Change (Last created floating text): Disable permanence
      • Floating Text - Change the lifespan of (Last created floating text) to 3.50 seconds
      • Floating Text - Change the fading age of (Last created floating text) to 1.40 seconds
if u want complicate it more than my advice use global variables and make defence system :p

in my map if DamageEventType = 0 (if 1 then also but if 1 then its can be critical, because i use 1 for reflect back damage :p) then it is physical damage and calculate phyisical damage, if 2 on my map then magical damage and i show this part from my set damage trigger

JASS:
//tcv=DamageEventTarget - Unit Custom Value
//udg_Global_Pdef/udg_Global_Mdef is 2 variable array, i increase or decrease it when i pick a item, example if i pick armor then increase with 1000 the pdef and 200 the mdef if it is heavy armor
    set pdef = udg_Global_Pdef[tcv] + pdefb
    set mdef = udg_Global_Mdef[tcv] + mdefb
//i make if for avoid the problems when unit have negative defence
    if mdef < 0 then
        set mdef = 0
    endif
    if pdef < 0 then
        set pdef = 0
    endif
//this damage reduction part depend on unit defence 
//next 2 variable is array for calculate the the damage reduction/def, attackerlv = DamageEventSource level,dmgtype=DamageEventType
            set PhysicalRed = pdef / ( 40.00 * attackerlv + pdef + 25.00 )
            set MagicRed = mdef / ( 40.00 * attackerlv + mdef + 25.00 )
//so example if u got 7000 magic defence, lets say it is 45% damage reduction with this formula, then MagicRed = 0.45, so the final damage is dmg = dmg * 0.55
                if dmgtype > 1 then
                    set dmg = dmg * ( 1 - MagicRed )
                else
                    set dmg = dmg * ( 1 - PhysicalRed )
                endif
 

TKF

TKF

Level 14
Joined
Nov 29, 2006
Messages
1,267
Nice system. Rep+




The one I'm using in Naval Battle only uses 1 global variable and 2 triggers, but only damage on heroes. PlayerBoat[12] in this map. And unit custom value as counter. However it was only designed to show the damage taken during a second, not from each single attack. Prevents lots of overlapping damage texts. Also shows healing amount in the same trigger if its using a healing spell. For RPG, hero and AoS maps.


  • Damage Display System
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • For each (Integer A) from 3 to 12, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (PlayerBoat[(Integer A)] is alive) Equal to True
              • PlayerBoat[(Integer A)] Not equal to No unit
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Custom value of PlayerBoat[(Integer A)]) Greater than (Integer((Life of PlayerBoat[(Integer A)])))
                • Then - Actions
                  • Set Damage = ((Custom value of PlayerBoat[(Integer A)]) - (Integer((Life of PlayerBoat[(Integer A)]))))
                  • Floating Text - Create floating text that reads (- + (String(Damage))) above PlayerBoat[(Integer A)] with Z offset 0.00, using font size 9.00, color (100.00%, 8.00%, 8.00%), and 0.00% transparency
                  • Floating Text - Set the velocity of (Last created floating text) to 48.00 towards 270.00 degrees
                  • Floating Text - Change (Last created floating text): Disable permanence
                  • Floating Text - Change the fading age of (Last created floating text) to 1.30 seconds
                  • Floating Text - Change the lifespan of (Last created floating text) to 1.60 seconds
                  • Unit - Set the custom value of PlayerBoat[(Integer A)] to (Integer((Life of PlayerBoat[(Integer A)])))
                  • Set Damage = 0
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Custom value of PlayerBoat[(Integer A)]) Less than ((Integer((Life of PlayerBoat[(Integer A)]))) - 9)
                    • Then - Actions
                      • Set Damage = ((Integer((Life of PlayerBoat[(Integer A)]))) - (Custom value of PlayerBoat[(Integer A)]))
                      • Set TempPoint1 = (Position of PlayerBoat[(Integer A)])
                      • Floating Text - Create floating text that reads (+ + (String(Damage))) above PlayerBoat[(Integer A)] with Z offset 0.00, using font size 9.00, color (20.00%, 80.00%, 20.00%), and 0.00% transparency
                      • Floating Text - Set the velocity of (Last created floating text) to 48.00 towards 270.00 degrees
                      • Floating Text - Change (Last created floating text): Disable permanence
                      • Floating Text - Change the fading age of (Last created floating text) to 1.30 seconds
                      • Floating Text - Change the lifespan of (Last created floating text) to 1.60 seconds
                      • Unit - Set the custom value of PlayerBoat[(Integer A)] to (Integer((Life of PlayerBoat[(Integer A)])))
                      • Set Damage = 0
                      • Custom script: call RemoveLocation(udg_TempPoint1)
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (PlayerBoat[(Integer A)] is alive) Equal to True
                          • PlayerBoat[(Integer A)] Not equal to No unit
                        • Then - Actions
                          • Unit - Set the custom value of PlayerBoat[(Integer A)] to (Integer((Life of PlayerBoat[(Integer A)])))
                        • Else - Actions
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (PlayerBoat[(Integer A)] is alive) Equal to True
                  • PlayerBoat[(Integer A)] Not equal to No unit
                  • (Custom value of PlayerBoat[(Integer A)]) Less than (Integer((Life of PlayerBoat[(Integer A)])))
                • Then - Actions
                  • Unit - Set the custom value of PlayerBoat[(Integer A)] to (Integer((Life of PlayerBoat[(Integer A)])))
                • Else - Actions
Death Trigger

  • Death Damage Display
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Triggering unit) is A Hero) Equal to True
    • Actions
      • Floating Text - Create floating text that reads (- + (String((Custom value of (Triggering unit))))) above PlayerBoat[(Player number of (Owner of (Triggering unit)))] with Z offset 0.00, using font size 12.00, color (100.00%, 8.00%, 8.00%), and 0.00% transparency
      • Floating Text - Set the velocity of (Last created floating text) to 30.00 towards 270.00 degrees
      • Floating Text - Change (Last created floating text): Disable permanence
      • Floating Text - Change the fading age of (Last created floating text) to 1.30 seconds
      • Floating Text - Change the lifespan of (Last created floating text) to 2.20 seconds
      • Unit - Set Custom unit value of (Triggering unit) to 0
 
Level 34
Joined
Sep 26, 2009
Messages
8,435
Don't set the custom value of units, please read the disclaimer! You're going to completely tank your system, here's what you do:

Instead of this: Unit - Set the custom value of PlayerBoat[(Integer A)] to (Integer((Life of PlayerBoat[(Integer A)])))

Do this: Set Counter[(Custom value of PlayerBoat[(Integer A)])] = (Integer((Life of PlayerBoat[(Integer A)])))

And instead of getting the custom value of the unit to reference the counter, reference the "Counter" array variable.

This is what Unit Indexer does, it turns your unit's custom value into an array index.
 
Top