1. Are you planning to upload your awesome spell or system to Hive? Please review the rules here.
    Dismiss Notice
  2. Updated Resource Submission Rules: All model & skin resource submissions must now include an in-game screenshot. This is to help speed up the moderation process and to show how the model and/or texture looks like from the in-game camera.
    Dismiss Notice
  3. DID YOU KNOW - That you can unlock new rank icons by posting on the forums or winning contests? Click here to customize your rank or read our User Rank Policy to see a list of ranks that you can unlock. Have you won a contest and still havn't received your rank award? Then please contact the administration.
    Dismiss Notice
  4. We have recently started the 16th edition of the Mini Mapping Contest. The theme is mini RPG. Do check it out and have fun.
    Dismiss Notice
  5. Dismiss Notice
  6. The Highway to Hell has been laid open. Come along and participate in the 5th Special Effect Contest.
    Dismiss Notice
  7. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

Damage Detection System (GUI) For Reforged v0.5b

Submitted by M4gz
This bundle is marked as pending. It has not been reviewed by a staff member yet.
Small & Simple GUI Damage Detection System (Reforged)
In Reforged exists native DDS and that system to handle these functions and methods without 100kb of JASS
It is a tiny system which gives you a powerful tool to detect and Modify:

  • Damage Source
  • Damage Target
  • Damage Amount
  • Damage Type
  • Defense Type (Medium/Heavy/Hero etc)
  • Armor Type (flesh/metal/stone etc)
  • Attack Type
  • Attack is Normal or Not (if skill or regular attack)
Features:

  • Easy BOOL conditions usage for detecting any types of Damage or Armor
  • Modify dealing damage through any deep modifications.
  • Attaching unique Key to each damage event to prevent useless conditions during several damage modifications
  • Based on GUI triggers for any modifications.
  • Full Version and Tiny.
  • new Native Blizzard's functions and methods. Which makes you free out of tones of JASS and so on.

Added an event key let you to generate unique key to work with futher damage (attach key to event) modifications without repeating conditions. Just one time generate a key and then check its value and make the operations with future damage modifications. Needs 1 extra real variable and generator trigger (1 action) also need a real variable (or array) for each case when you want to handle unique modification events.

Added event after damage modification - now it is possible to handle event after damage been modified to get new damage amount and make extra actions with it. (in both verisons) in Verison 0.5a Added several stages of handing.

Added Armor Type detection for Damage Target.

Added Defense Type of Damage Target. In BOOL variables implementation. Now its possible to modify damage depending on units defense type.

Added Damage Modifier to change amout of dealing damage can be possitive or negative value. Must be not equal to 0 to modify.
Important! - if you causing damage via trigger and using Damage Modifier variable you need to paste Damage Modifier AFTER damaging action. (Its Blizzard's mechanics) - in v 0.5 added way how to make it possible


At first you need to attach Engine to Event:

  • Damage Engine Event
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set VariableSet Damage_Trigger = Damage Engine Core <gen>
      • Custom script: call TriggerRegisterAnyUnitEventBJ(udg_Damage_Trigger, EVENT_PLAYER_UNIT_DAMAGED)

The system itself is made in two versions - Light and Full

Light version allows you to detect:

  • Damage Source
  • Damage Target
  • Damage Amount
  • Attack is Normal or Not
Its enought for common usage. Attack is Normal or Not is a BOOL which is true if Attack is Normal or False if Attack is skill. That means you can easly use it for custom spells, abilities and so on. It needs only 5 variables to work!

  • Damage Engine Core Light
    • Events
    • Conditions
    • Actions
      • -------- Set Basic Variables --------
      • Set VariableSet Damage_source = (Damage source)
      • Set VariableSet Damage_target = (Damage Target)
      • Set VariableSet Damage_amount = (Damage taken)
      • Set VariableSet Damage_type = (Damage Type)
      • Set VariableSet Damage_AttackType = (Damage Attack Type)
      • Set VariableSet Damage_modifier = 0.00
      • -------- End Damage Type Detecting --------
      • -------- Simple Detection IsNormal OR Not --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Damage From Normal Attack) Equal to True
        • Then - Actions
          • Set VariableSet Damage_isNormal = True
        • Else - Actions
      • -------- Run Event --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Damage_amount Greater than 0.00
        • Then - Actions
          • Set VariableSet Damage_event = 1.00
        • Else - Actions
      • -------- Apply damage modify --------
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • Damage_modifier Not equal to 0.00
    • Then - Actions
      • Custom script: call BlzSetEventDamage(udg_Damage_modifier)
      • Set VariableSet Damage_amount = (Damage taken)
      • Set VariableSet Damage_event = 2.00
    • Else - Actions
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • Damage_modifier Not equal to 0.00
    • Then - Actions
      • Custom script: call BlzSetEventDamage(udg_Damage_modifier)
      • Set VariableSet Damage_amount = (Damage taken)
      • Set VariableSet Damage_event = 3.00
    • Else - Actions
      • -------- Clear --------
      • -------- Variables --------
      • Set VariableSet Damage_isNormal = False
      • Set VariableSet Damage_event = 0.00
      • Set VariableSet Damage_source = No unit
      • Set VariableSet Damage_target = No unit
      • Set VariableSet Damage_amount = 0.00
      • Set VariableSet Damage_type = Unknown
      • Set VariableSet Damage_modifier = 0.00

The Full Verison Gives you full information about type of damage and type of attack (normal/divine/hero/pierce/cold/fire and so on)

Added Armor types.
All Variables are BOOL so it let you to make checks easly.

  • Damage Engine Core
    • Events
    • Conditions
    • Actions
      • -------- Set Basic Variables --------
      • Set VariableSet Damage_source = (Damage source)
      • Set VariableSet Damage_target = (Damage Target)
      • Set VariableSet Damage_amount = (Damage taken)
      • Set VariableSet Damage_type = (Damage Type)
      • Set VariableSet Damage_AttackType = (Damage Attack Type)
      • Set VariableSet Damage_modifier = 0.00
      • -------- Detect Targets Defense type --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit: Damage_target's Integer Field: Defense Type ('udty')) Equal to 0
        • Then - Actions
          • Set VariableSet DefenseType_SMALL = True
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Unit: Damage_target's Integer Field: Defense Type ('udty')) Equal to 1
            • Then - Actions
              • Set VariableSet DefenseType_MEDIUM = True
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Unit: Damage_target's Integer Field: Defense Type ('udty')) Equal to 2
                • Then - Actions
                  • Set VariableSet DefenseType_LARGE = True
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Unit: Damage_target's Integer Field: Defense Type ('udty')) Equal to 3
                    • Then - Actions
                      • Set VariableSet DefenseType_FORT = True
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Unit: Damage_target's Integer Field: Defense Type ('udty')) Equal to 4
                        • Then - Actions
                          • Set VariableSet DefenseType_NORMAL = True
                        • Else - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • (Unit: Damage_target's Integer Field: Defense Type ('udty')) Equal to 5
                            • Then - Actions
                              • Set VariableSet DefenseType_HERO = True
                            • Else - Actions
                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • (Unit: Damage_target's Integer Field: Defense Type ('udty')) Equal to 6
                                • Then - Actions
                                  • Set VariableSet DefenseType_DIVINE = True
                                • Else - Actions
                                  • Set VariableSet DefenseType_NONE = True
      • -------- Detect Targets Armor type --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit: Damage_target's Integer Field: Armor Type ('uarm')) Equal to 1
        • Then - Actions
          • Set VariableSet ArmorType_FLESH = True
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Unit: Damage_target's Integer Field: Armor Type ('uarm')) Equal to 2
            • Then - Actions
              • Set VariableSet ArmorType_METAL = True
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Unit: Damage_target's Integer Field: Armor Type ('uarm')) Equal to 3
                • Then - Actions
                  • Set VariableSet ArmorType_WOOD = True
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Unit: Damage_target's Integer Field: Armor Type ('uarm')) Equal to 4
                    • Then - Actions
                      • Set VariableSet ArmorType_ETHEREAL = True
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Unit: Damage_target's Integer Field: Armor Type ('uarm')) Equal to 5
                        • Then - Actions
                          • Set VariableSet ArmorType_STONE = True
                        • Else - Actions
      • -------- Detect Attack Type --------
      • Custom script: if udg_Damage_AttackType == ATTACK_TYPE_NORMAL then
      • Set VariableSet AttackType_NORMAL = True
      • Custom script: elseif udg_Damage_AttackType == ATTACK_TYPE_MELEE then
      • Set VariableSet AttackType_MELEE = True
      • Custom script: elseif udg_Damage_AttackType == ATTACK_TYPE_PIERCE then
      • Set VariableSet AttackType_PIERCE = True
      • Custom script: elseif udg_Damage_AttackType == ATTACK_TYPE_SIEGE then
      • Set VariableSet AttackType_SIEGE = True
      • Custom script: elseif udg_Damage_AttackType == ATTACK_TYPE_MAGIC then
      • Set VariableSet AttackType_MAGIC = True
      • Custom script: elseif udg_Damage_AttackType == ATTACK_TYPE_CHAOS then
      • Set VariableSet AttackType_CHAOS = True
      • Custom script: elseif udg_Damage_AttackType == ATTACK_TYPE_HERO then
      • Set VariableSet AttackType_HERO = True
      • Custom script: endif
      • -------- Detect Damage Type --------
      • Custom script: if udg_Damage_type == DAMAGE_TYPE_UNKNOWN then
      • Set VariableSet DamageType_UNKNOWN = True
      • Custom script: elseif udg_Damage_type == DAMAGE_TYPE_NORMAL then
      • Set VariableSet DamageType_NORMAL = True
      • Custom script: elseif udg_Damage_type == DAMAGE_TYPE_ENHANCED then
      • Set VariableSet DamageType_ENCHANCED = True
      • Custom script: elseif udg_Damage_type == DAMAGE_TYPE_FIRE then
      • Set VariableSet DamageType_FIRE = True
      • Custom script: elseif udg_Damage_type == DAMAGE_TYPE_COLD then
      • Set VariableSet DamageType_COLD = True
      • Custom script: elseif udg_Damage_type == DAMAGE_TYPE_LIGHTNING then
      • Set VariableSet DamageType_LIGHTNING = True
      • Custom script: elseif udg_Damage_type == DAMAGE_TYPE_POISON then
      • Set VariableSet DamageType_POISON = True
      • Custom script: elseif udg_Damage_type == DAMAGE_TYPE_DISEASE then
      • Set VariableSet DamageType_DISEASE = True
      • Custom script: elseif udg_Damage_type == DAMAGE_TYPE_DIVINE then
      • Set VariableSet DamageType_DIVINE = True
      • Custom script: elseif udg_Damage_type == DAMAGE_TYPE_MAGIC then
      • Set VariableSet DamageType_MAGIC = True
      • Custom script: elseif udg_Damage_type == DAMAGE_TYPE_SONIC then
      • Set VariableSet DamageType_SONIC = True
      • Custom script: elseif udg_Damage_type == DAMAGE_TYPE_ACID then
      • Set VariableSet DamageType_ACID = True
      • Custom script: elseif udg_Damage_type == DAMAGE_TYPE_FORCE then
      • Set VariableSet DamageType_FORCE = True
      • Custom script: elseif udg_Damage_type == DAMAGE_TYPE_DEATH then
      • Set VariableSet DamageType_DEATH = True
      • Custom script: elseif udg_Damage_type == DAMAGE_TYPE_MIND then
      • Set VariableSet DamageType_MIND = True
      • Custom script: elseif udg_Damage_type == DAMAGE_TYPE_PLANT then
      • Set VariableSet DamageType_PLANT = True
      • Custom script: elseif udg_Damage_type == DAMAGE_TYPE_DEFENSIVE then
      • Set VariableSet DamageType_DEFENSIVE = True
      • Custom script: elseif udg_Damage_type == DAMAGE_TYPE_DEMOLITION then
      • Set VariableSet DamageType_DEMOLITION = True
      • Custom script: elseif udg_Damage_type == DAMAGE_TYPE_SLOW_POISON then
      • Set VariableSet DamageType_SLOW_POISON = True
      • Custom script: elseif udg_Damage_type == DAMAGE_TYPE_SPIRIT_LINK then
      • Set VariableSet DamageType_SPIRIT_LINK = True
      • Custom script: elseif udg_Damage_type ==DAMAGE_TYPE_SHADOW_STRIKE then
      • Set VariableSet DamageType_SHADOW_STRIKE = True
      • Custom script: elseif udg_Damage_type == DAMAGE_TYPE_UNIVERSAL then
      • Set VariableSet DamageType_UNIVERSAL = True
      • Custom script: endif
      • -------- End Damage Type Detecting --------
      • -------- Simple Detection IsNormal OR Not --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Damage From Normal Attack) Equal to True
        • Then - Actions
          • Set VariableSet Damage_isNormal = True
        • Else - Actions
      • -------- Run Event --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Damage_amount Greater than 0.00
        • Then - Actions
          • Set VariableSet Damage_event = 1.00
        • Else - Actions
      • -------- Apply damage modify --------
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • Damage_modifier Not equal to 0.00
    • Then - Actions
      • Custom script: call BlzSetEventDamage(udg_Damage_modifier)
      • Set VariableSet Damage_amount = (Damage taken)
      • Set VariableSet Damage_event = 2.00
    • Else - Actions
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • Damage_modifier Not equal to 0.00
    • Then - Actions
      • Custom script: call BlzSetEventDamage(udg_Damage_modifier)
      • Set VariableSet Damage_amount = (Damage taken)
      • Set VariableSet Damage_event = 3.00
    • Else - Actions
      • -------- Clear --------
      • -------- Variables --------
      • Set VariableSet Damage_isNormal = False
      • Set VariableSet Damage_event = 0.00
      • Set VariableSet Damage_source = No unit
      • Set VariableSet Damage_target = No unit
      • Set VariableSet Damage_amount = 0.00
      • Set VariableSet Damage_type = Unknown
      • Set VariableSet Damage_modifier = 0.00
      • -------- ----- --------
      • Set VariableSet DefenseType_NORMAL = False
      • Set VariableSet DefenseType_MEDIUM = False
      • Set VariableSet DefenseType_SMALL = False
      • Set VariableSet DefenseType_LARGE = False
      • Set VariableSet DefenseType_HERO = False
      • Set VariableSet DefenseType_FORT = False
      • Set VariableSet DefenseType_DIVINE = False
      • Set VariableSet DefenseType_NONE = False
      • -------- ----- --------
      • Set VariableSet ArmorType_ETHEREAL = False
      • Set VariableSet ArmorType_FLESH = False
      • Set VariableSet ArmorType_METAL = False
      • Set VariableSet ArmorType_STONE = False
      • Set VariableSet ArmorType_WOOD = False
      • -------- ----- --------
      • Set VariableSet DamageType_UNKNOWN = False
      • Set VariableSet DamageType_NORMAL = False
      • Set VariableSet DamageType_ENCHANCED = False
      • Set VariableSet DamageType_FIRE = False
      • Set VariableSet DamageType_COLD = False
      • Set VariableSet DamageType_LIGHTNING = False
      • Set VariableSet DamageType_POISON = False
      • Set VariableSet DamageType_DISEASE = False
      • Set VariableSet DamageType_DIVINE = False
      • Set VariableSet DamageType_MAGIC = False
      • Set VariableSet DamageType_SONIC = False
      • Set VariableSet DamageType_ACID = False
      • Set VariableSet DamageType_FORCE = False
      • Set VariableSet DamageType_DEATH = False
      • Set VariableSet DamageType_MIND = False
      • Set VariableSet DamageType_PLANT = False
      • Set VariableSet DamageType_DEFENSIVE = False
      • Set VariableSet DamageType_DEMOLITION = False
      • Set VariableSet DamageType_SLOW_POISON = False
      • Set VariableSet DamageType_SPIRIT_LINK = False
      • Set VariableSet DamageType_UNIVERSAL = False
      • -------- ----- --------
      • Set VariableSet AttackType_NORMAL = False
      • Set VariableSet AttackType_MELEE = False
      • Set VariableSet AttackType_PIERCE = False
      • Set VariableSet AttackType_SIEGE = False
      • Set VariableSet AttackType_MAGIC = False
      • Set VariableSet AttackType_CHAOS = False
      • Set VariableSet AttackType_HERO = False

After we attach units to engine we need to handle the event it is looks like in others damage systems:

  • Event Attack Damage Type
    • Events
      • Game - Damage_event becomes Equal to 1.00
    • Conditions
    • Actions
      • Game - Display to (All players) the text: (String(Damage_amount))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • AttackType_HERO Equal to True
        • Then - Actions
          • Game - Display to (All players) the text: Attack type HERO
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • AttackType_PIERCE Equal to True
        • Then - Actions
          • Game - Display to (All players) the text: Attack type PIERCE
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Damage_isNormal Equal to True
        • Then - Actions
          • Game - Display to (All players) the text: is normal damage
        • Else - Actions
          • Game - Display to (All players) the text: not a normal damage...
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • DamageType_MAGIC Equal to True
        • Then - Actions
          • Game - Display to (All players) the text: Damage type is magic
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • DamageType_COLD Equal to True
        • Then - Actions
          • Game - Display to (All players) the text: Damage type is cold
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • DamageType_DIVINE Equal to True
        • Then - Actions
          • Game - Display to (All players) the text: Damage type is divi...
        • Else - Actions


  • Event Modify Damage
    • Events
      • Game - Damage_event becomes Equal to 1.00
    • Conditions
    • Actions
      • Game - Display to (All players) the text: (String(Damage_amount))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of Damage_source) Equal to Паладин
          • Damage_isNormal Equal to True
        • Then - Actions
          • Unit - Cause Damage_source to damage Damage_target, dealing 500.00 damage of attack type Chaos and damage type Universal
          • Set VariableSet Damage_modifier = 20.00
          • -------- DMG = 500+20 --------
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • AttackType_MAGIC Equal to True
        • Then - Actions
          • Game - Display to (All players) the text: Magic
        • Else - Actions
          • Game - Display to (All players) the text: Type is not a Magic
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of Damage_source) Equal to Верховный маг
        • Then - Actions
          • Set VariableSet Damage_modifier = -100.00
          • Game - Display to (All players) the text: Set -100 Damage for...
        • Else - Actions


  • Event Defence Type
    • Events
      • Game - Damage_event becomes Equal to 1.00
    • Conditions
    • Actions
      • Game - Display to (All players) the text: (String(Damage_amount))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • DefenseType_HERO Equal to True
        • Then - Actions
          • Game - Display to (All players) the text: Target has hero Def...
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • DefenseType_LARGE Equal to True
        • Then - Actions
          • Game - Display to (All players) the text: Target has Heavy De...
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • DefenseType_FORT Equal to True
        • Then - Actions
          • Game - Display to (All players) the text: Target has Fortifie...
        • Else - Actions
  • Event Armor Type
    • Events
      • Game - Damage_event becomes Equal to 1.00
    • Conditions
    • Actions
      • Game - Display to (All players) the text: (String(Damage_amount))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ArmorType_FLESH Equal to True
        • Then - Actions
          • Game - Display to (All players) the text: Armor type flesh
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ArmorType_METAL Equal to True
        • Then - Actions
          • Game - Display to (All players) the text: Armor type metal
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ArmorType_STONE Equal to True
        • Then - Actions
          • Game - Display to (All players) the text: Armor type stone
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ArmorType_WOOD Equal to True
        • Then - Actions
          • Game - Display to (All players) the text: Armor type wood
        • Else - Actions

Examples With Handling Damage Modify Event
For example makes 2x damage modifier:
  • Event Modify Damage x2
    • Events
      • Game - Damage_event becomes Equal to 1.00
    • Conditions
    • Actions
      • Game - Display to (All players) the text: Basic Damage
      • Game - Display to (All players) the text: (String(Damage_amount))
      • Set VariableSet Damage_modifier = (Damage_amount x 2.00)

After that the Variable Damage_event becomes 2.0 and we can get new Damage_amount value and do what we want:
  • Event Modify Damage 2nd Call
    • Events
      • Game - Damage_event becomes Equal to 2.00
    • Conditions
    • Actions
      • Game - Display to (All players) the text: Damage after Modify
      • Game - Display to (All players) the text: (String(Damage_amount))
      • Set VariableSet Damage_modifier = (Damage_amount x 2.00)

And After 2nd modification you can handle 3rd stage of that event

  • Event Modify Damage 3rd Call
    • Events
      • Game - Damage_event becomes Equal to 3.00
    • Conditions
    • Actions
      • Game - Display to (All players) the text: Damage after 2nd Mo...
      • Game - Display to (All players) the text: (String(Damage_amount))

Work with Event Key same 3 previous triggers with Key usage. Here we run key generator and getting random value then store it in our variable:

  • Event Modify Damage 1st Call
    • Events
      • Game - Damage_event becomes Equal to 1.00
    • Conditions
    • Actions
      • Game - Display to (All players) the text: Basic Damage
      • Game - Display to (All players) the text: (String(Damage_amount))
      • -------- IF MK generate custom key to make future work easly --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of Damage_source) Equal to Горный король
        • Then - Actions
          • Trigger - Run Damage Key Gen <gen> (checking conditions)
          • Set VariableSet Damage_key_MK = Damage_key
          • Set VariableSet Damage_modifier = (Damage_amount x 2.00)
        • Else - Actions

Now you dont need to check if hero is MK or any conditios which were in 1st trigger, just use the key to handle the event:

  • Event Modify Damage 2nd Call
    • Events
      • Game - Damage_event becomes Equal to 2.00
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Damage_key Equal to Damage_key_MK
        • Then - Actions
          • Game - Display to (All players) the text: Key is MK 2nd call
          • Game - Display to (All players) the text: Damage after Modify
          • Game - Display to (All players) the text: (String(Damage_amount))
          • Set VariableSet Damage_modifier = (Damage_amount x 2.00)
        • Else - Actions

Same solution for 3rd deep of trigger (deeps could be changed in core by any count):
  • Event Modify Damage 3rd Call
    • Events
      • Game - Damage_event becomes Equal to 3.00
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Damage_key Equal to Damage_key_MK
        • Then - Actions
          • Game - Display to (All players) the text: Key is MK 3nd call
          • Game - Display to (All players) the text: Damage after 2nd Mo...
          • Game - Display to (All players) the text: (String(Damage_amount))
        • Else - Actions
For using it just add 1 variable Damage_key (real) and one simple trigger:

  • Damage Key Gen
    • Events
    • Conditions
      • Damage_event Not equal to 0.00
    • Actions
      • Set VariableSet Damage_key = (Random real number between 0.00 and 1000.00)

v 0.5b Updated - Added key damage generator for each event to prevent unnessery extra conditions.
v 0.5a Updated - Added extra handle after second call of damage modification
v 0.5 Updated - New event added when damage has been modified
v 0.4b Updated - Added TYPE OF ARMOR of target unit.
v 0.4 Updated - Added TYPE OF DEFENSE of target unit.
v 0.3b Updated - Added Test For Reccursion in Event trigger. System is safe out of it.
v 0.3 Updated - Added Damage Modify variable to change amount of damage.
v 0.2 Updated - Changed specific to generic damage event to avoid leaks.
That's all. Try test map it gives more info.


Keywords: damage detection, damage modification, gui, dds, armor type, attack type
Contents

Damage Engine (GUI) Reforged by M4gz (Map)

  1. Bribe

    Bribe

    Joined:
    Sep 26, 2009
    Messages:
    8,121
    Resources:
    25
    Maps:
    3
    Spells:
    10
    Tutorials:
    3
    JASS:
    9
    Resources:
    25
    Damage Engine already works with Reforged, uses a well-established API and does a lot more, more accurately, etc.
     
  2. M4gz

    M4gz

    Joined:
    Dec 30, 2019
    Messages:
    31
    Resources:
    0
    Resources:
    0
    Thanks for you comment. That system using native reforged functions and variables. It saves tones lines of unnecessary JASS code and gives overall same as other damage engines. For example in your great DDS is a big problem to detect Attack type is normal i was need to detect if not a spell but it doesnt works in every case. That solution can easly filtering by damage and attack types, or in lightweight version just by BOOL is attack type is normal = false
     
  3. Pyrogasm

    Pyrogasm

    Joined:
    Feb 27, 2007
    Messages:
    3,648
    Resources:
    1
    Spells:
    1
    Resources:
    1
    Damage Engine can modify damage in the damaged event, but this system cannot. For that reason alone I would never use this, as modifying event damage is often one of the core things you want to do with a DDS.

    This system should use the new “any unit takes damage” event instead of manually adding specific unit events for all units on the map. This method results in many erroneous and useless events populating the trigger. I do not know of a reason this is explicitly bad but it surely can’t be good.
     
  4. M4gz

    M4gz

    Joined:
    Dec 30, 2019
    Messages:
    31
    Resources:
    0
    Resources:
    0
    Thanks for your comment. That system made on GUI triggers and its not able to use event like "any unit damaged" blizzard gives only event "specific unit event" but in other way it makes more accurate and less costly solution if you need to determinate units to save resources. Can you show "erroneous and useless events populating the trigger" for me to fix it. As for me that is what blizzard's did to make in game DDS more friendly.
    About modify damage you have same variables as in DDS and you can deal extra damage as you like. You have type of damage, amount, target and source - just make 1 trigger to deal damage to the target as type and amount you want - it's just 1 action. I was thinking about that but as i get the right way is to make it clean and let maker to do what he wants with damage.
    PS it's a damage detect system not a damage modify system.
     
    Last edited: Feb 4, 2020
  5. Uncle

    Uncle

    Joined:
    Aug 10, 2018
    Messages:
    752
    Resources:
    0
    Resources:
    0
    Isn't there a limit with using Specific Unit Events like this? I'm pretty sure after a certain number of units are added to the Events it will stop supporting newer units.
     
  6. Clanzion

    Clanzion

    Joined:
    Jul 4, 2016
    Messages:
    425
    Resources:
    0
    Resources:
    0
    I'm not sure what patch you are on, but Blizzard did made available a "any unit damaged" event in the latest patches. Bribe's Damage Engine essentially adds this jass only(afaik) event to GUIers. Since I don't have reforged, I have no clue if blizzard added the event to GUI.

    What Pryogasm meant was is that these events you add to the trigger will stay after the unit dies, essentially causing a permanent leak since the events are no longer in use or traceable until the trigger is destroyed (jass only)
     
    Last edited: Feb 5, 2020
  7. Uncle

    Uncle

    Joined:
    Aug 10, 2018
    Messages:
    752
    Resources:
    0
    Resources:
    0
    He's using:
    • Trigger - Add to Damage Engine Core <gen> the event (Unit - (Triggering unit) Takes damage)

    I'm like 90% sure this will stop working once you add a certain number of units.
     
  8. Pyrogasm

    Pyrogasm

    Joined:
    Feb 27, 2007
    Messages:
    3,648
    Resources:
    1
    Spells:
    1
    Resources:
    1
    I forgot it was JASS only but yes this is what I meant.
    I can't deal negative damage to reduce the damage dealt by something.
     
  9. Bribe

    Bribe

    Joined:
    Sep 26, 2009
    Messages:
    8,121
    Resources:
    25
    Maps:
    3
    Spells:
    10
    Tutorials:
    3
    JASS:
    9
    Resources:
    25
    Looks like Blizzard quietly added a nee native! I'm preparing an update to Damage Engine in light of this exciting news! Nice discovery, +rep
     
  10. M4gz

    M4gz

    Joined:
    Dec 30, 2019
    Messages:
    31
    Resources:
    0
    Resources:
    0
    Thank you all for your interest. I changed the event made generic event instead of specific as you told. Unfortunately in WE Reforged (Im using regular WE in Reforged) event is not exists and i was need to make like that:

    • Damage Engine Event
      • Events
        • Map initialization
      • Conditions
      • Actions
        • Set VariableSet Damage_Trigger = Damage Engine Core <gen>
        • Custom script: call TriggerRegisterAnyUnitEventBJ(udg_Damage_Trigger, EVENT_PLAYER_UNIT_DAMAGED)

    Variable Damage_Trigger is not necessary you can replace it with trigger name in custom script.
    Also found an interesting thing how to detect last hit (dying moment)
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Life of (Damage Target)) Less than or equal to (Damage taken)
      • Then - Actions
        • Game - Display to (All players) the text: Unit is dead (lasth...
      • Else - Actions
     
    Last edited: Feb 5, 2020
  11. M4gz

    M4gz

    Joined:
    Dec 30, 2019
    Messages:
    31
    Resources:
    0
    Resources:
    0
    New Verison 0.3
    Now its possible to use damage modifier as you like. It can be possitive to deal extra damage or reduce incoming damage. Or negative to up hp.
    Just set variable value:
    • Set VariableSet Damage_modifier = 10.00

    Or
    • Set VariableSet Damage_modifier = -100.00


    Done.
     
    Last edited: Feb 5, 2020
  12. M4gz

    M4gz

    Joined:
    Dec 30, 2019
    Messages:
    31
    Resources:
    0
    Resources:
    0
    Added tests for reccursions in 0.3b version in Event trigger. System is safe out of it.
    What I need to add or change for approval?
     
  13. Bribe

    Bribe

    Joined:
    Sep 26, 2009
    Messages:
    8,121
    Resources:
    25
    Maps:
    3
    Spells:
    10
    Tutorials:
    3
    JASS:
    9
    Resources:
    25
    Never mind! Uninstalling Reforged nuked my entire Maps folder, so the progress I made in implementing this is gone.
     
  14. M4gz

    M4gz

    Joined:
    Dec 30, 2019
    Messages:
    31
    Resources:
    0
    Resources:
    0
    Sad to hear that. Could you give a review or some ideads to make it better
     
  15. Bribe

    Bribe

    Joined:
    Sep 26, 2009
    Messages:
    8,121
    Resources:
    25
    Maps:
    3
    Spells:
    10
    Tutorials:
    3
    JASS:
    9
    Resources:
    25
    Philosophically I am against having two differing systems with two different sets of APIs. If the idea is that you want yours to be a minimalist Damage Engine, I give you permission to have your API match mine so that implementers can at least have an easier time switching between the two.

    As far as approvals go, I'm thankfully no longer a moderator so that's up to them to decide.
     
  16. M4gz

    M4gz

    Joined:
    Dec 30, 2019
    Messages:
    31
    Resources:
    0
    Resources:
    0
    Thanks for answer. Ill try to implement with your system. If i add Armor type and Defence type (Do i need to store both types? Or only Defence type) And do i need to store these type/types for both - Source and Target unit or only for target?
     
  17. M4gz

    M4gz

    Joined:
    Dec 30, 2019
    Messages:
    31
    Resources:
    0
    Resources:
    0
    Update 0.4 : now its possible to detect targets type of defense (normal/heavy/fort/hero and so on)
    -------
    Update 0.4b : now its possible to detect targets type of armor (flesh/metal/wood/stone and so on)
     
    Last edited: Feb 7, 2020
  18. M4gz

    M4gz

    Joined:
    Dec 30, 2019
    Messages:
    31
    Resources:
    0
    Resources:
    0
    Update 0.5 : New event added when damage has been modified. You can handle new event after modification to get new value of damage and, for example, do extra damage or what you need.
    ----------------
    Update 0.5a : Added extra handle for damage modification. Now it is possible to catch the event after 1st damage modification and after 2nd damage modification. For example tt would be usefully if you need to modificate damage by item then by passive skill and so on. You can add any count of handling just copypaste that part of code in core and change damage_event variable to +1
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • Damage_modifier Not equal to 0.00
      • Then - Actions
        • Custom script: call BlzSetEventDamage(udg_Damage_modifier)
        • Set VariableSet Damage_amount = (Damage taken)
        • Set VariableSet Damage_event = 2.00
      • Else - Actions

    Next will be = 3.00 then = 4.00 and so on.
    ----------------
    Update 0.5b : added damage key now you can get uniue key and compare it in future damage modifications to prevent useless conditions. For example make 1 time a key allow you to detect if event call was from point where you generate it.
     
    Last edited: Feb 7, 2020