• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Simple Damage Detection system

Status
Not open for further replies.
Level 8
Joined
Mar 17, 2016
Messages
133
I've recently been looking into damage engines because I want to include spells in my map that trigger when a unit attacks but do not wish to use the GUI version which triggers before the actual attack goes off, to avoid exploits.
However, when I look into these damage engines, they are vastly too complicated and unnecessary seeing as I only want that ONE feature and don't wish to upload a bunch of stuff that I don't understand. So my question is, how would I make only that one feature?

I had it working before, but the problem was I was using a very out-dated engine that, was simple, but still introduced problems that broke the map completely. It used a way that had like a Real Variable called ondamageevent and there were 2 variables called damage_source, & damage_target. That's all I want, thanks.
 
Use Damage Engine 5.5.0.0.

Follow the install instructions (basically just copy one or two triggers to your map).

Then you use the event "Real becomes Equal to" and change it to be "DamageEvent becomes equal to 1".

If you want to modify the damage use "DamageModifierEvent becomes equal to 1" and then use the action "set variable" to change the variable "Set DamageEventAmount" to "1337" for example.

Then you refer to the damaged with "DamageEventTarget" and the damage source with "DamageEventSource".
 
Last edited:

Uncle

Warcraft Moderator
Level 66
Joined
Aug 10, 2018
Messages
6,724
The Damage Engine FeelsGoodMan linked is the best one we have available and it honestly looks way more intimidating than it really is.

You can ignore 99% of the variables that come with it and focus on the main ones, which FeelsGoodMan posted.

But just to further clarify, once you copy and paste the Damage Engine folder into your map you simply need to create a new trigger using one of the Events that come with the system:
  • Damage Event Example
    • Events
      • Game - DamageModifierEvent becomes Equal to 1.00
    • Conditions
    • Actions
  • Damage Event Example
    • Events
      • Game - DamageEvent becomes Equal to 1.00
    • Conditions
    • Actions
And here are two examples of these Events being put to use:

This first one checks if the Damage came from a Footman and if it was from a Melee attack. If it comes back true then the damaged unit is killed.
  • Damage Event Example
    • 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
          • (Unit-type of DamageEventSource) Equal to Footman
          • IsDamageMelee Equal to True
        • Then - Actions
          • Unit - Kill DamageEventTarget
        • Else - Actions
This one checks the same conditions as the last trigger, but this time we use the DamageModifierEvent which allows us to modify the damage before it's dealt. This is where the system becomes really powerful. So I increase the DamageEventAmount (the damage the Footman dealt) by 25.00, resulting in the Footman's attack dealing 25 bonus damage.
  • Damage Event Example
    • Events
      • Game - DamageModifierEvent becomes Equal to 1.00
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of DamageEventSource) Equal to Footman
          • IsDamageMelee Equal to True
        • Then - Actions
          • Set VariableSet DamageEventAmount = (DamageEventAmount + 25.00)
        • Else - Actions
And here are the important variables. The names are all self-explanatory:

DamageEventSource = Unit that dealt the damage
DamageEventTarget = Unit that got damaged
DamageEventAmount = The amount of damage dealt
IsDamageMelee = This is a boolean similar to "Is Unit Alive = True/False". It asks if the damage dealt was from a Melee attack or not
IsDamageRanged = Damage was from a Ranged attack
IsDamageSpell = Damage was from a spell like Chain Lightning
IsDamageCode = Damage was from a trigger like this:
  • Unit - Cause (Triggering unit) to damage (Triggering unit), dealing 500.00 damage of attack type Spells and damage type Normal
 
Last edited:
Status
Not open for further replies.
Top