• 🏆 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 Health-Based Damage Stutter

Level 1
Joined
Jun 16, 2023
Messages
6
Hello, I'm new in using the Damage Engine. I tried making a basic attack that deals based off the Health of the target. The damage works but it stutters upon execution. Any help will be appreciated. :ogre_haosis:

Sample:

  • Events
    • Game - DamageEvent becomes Equal to 1.00
  • Conditions
    • IsDamageAttack Equal to True
  • Actions
    • Unit - Cause DamageEventSource to damage DamageEventTarget, dealing (0.50 x (Max life of DamageEventTarget)) damage of attack type Hero and damage type Normal
 
Level 19
Joined
Feb 27, 2019
Messages
592
Stutter? I dont see anything in the trigger that would simply cause some slight stutter. A fast infinite loop would freeze the game. An instant infinite loop would crash the game. If the damage detection system has a way to prevent infinite loops it could cause stutter which would be fixed by turning off the trigger, deal damage, then turn on the trigger. The infinite loops may occur because when damage is dealt, new damage is dealt which would cause the trigger to excecute again and deal more damage and so on...
 
Last edited:
Level 1
Joined
Jun 16, 2023
Messages
6
Stutter? I dont see anything in the trigger that would simply cause some slight stutter. A fast infinite loop would freeze the game. An instant infinite loop would crash the game. If the damage detection system has a way to prevent infinite loops it could cause stutter which would be fixed by turning off the trigger, deal damage, then turn on the trigger. The infinite loops may occur because when damage is dealt, new damage is dealt which would cause the trigger to excecute again and deal more damage and so on...

Thanks for the reply. I tried it last night and it worked. :gg:
 
Level 1
Joined
Jun 16, 2023
Messages
6
You can also change the Damage dealt to incorporate this bonus damage:
  • Set Variable DamageEventAmount = DamageEventAmount + (0.50 x (Max life of DamageEventTarget)
Thanks, Uncle!

By the way, I also have this question, can you give me an example how to do an armor penetration? Let's say I want my hero to ignore 5 armor using attack type Hero and Damage type normal.
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,546
The Damage Engine thread has answers to everything you need to know. This is taken straight from it:

Detect damage: use the event "OnDamageEvent Equal 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 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.

You can modify the following variables from a "PreDamageEvent" trigger:
  • DamageEventAmount
  • DamageEventAttackT/DamageT/WeaponT/ArmorT/DefenseT
  • DamageEventArmorPierced
  • DamageEventType
  • DamageEventOverride

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.

So DamageEventArmorPierced is what you're looking for.
 
Level 1
Joined
Jun 16, 2023
Messages
6
The Damage Engine thread has answers to everything you need to know. This is taken straight from it:

Detect damage: use the event "OnDamageEvent Equal 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 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.

You can modify the following variables from a "PreDamageEvent" trigger:
  • DamageEventAmount
  • DamageEventAttackT/DamageT/WeaponT/ArmorT/DefenseT
  • DamageEventArmorPierced
  • DamageEventType
  • DamageEventOverride

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.

So DamageEventArmorPierced is what you're looking for.
So this, should I deal the damage next and it will automatically ignore the set armor?

  • Damage
    • Events
      • Game - OnDamageEvent becomes Equal to 0.00
    • Conditions
      • DamageEventAttackT Equal to ATTACK_TYPE_HERO
      • DamageEventDamageT Equal to DAMAGE_TYPE_NORMAL
    • Actions
      • Set VariableSet DamageEventArmorPierced = 5.00
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,546
  • 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.
So you would use the PreDamageEvent and then Set DamageEventArmorPierced to however much Armor you want to pierce.

This Event runs before the damage is dealt and before armor is calculated. So after your trigger runs, the system will take whatever value DamageEventArmorPierced is equal to and subtract that from the Damage Target's armor. Maybe not immediately but this will occur at some point during the whole damage process.
 
Last edited:
Level 1
Joined
Jun 16, 2023
Messages
6
  • 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.
So you would use the PreDamageEvent and then Set DamageEventArmorPierced to however much Armor you want to pierce.

This Event runs before the damage is dealt and before armor is calculated. So after your trigger runs, the system will take whatever value DamageEventArmorPierced is equal to and subtract that from the Damage Target's armor. Maybe not immediately but this will occur at some point during the whole damage process.
Got it! Thank you so much for your fast replies. :wthumbsup:
 
Top