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 haven't received your rank award? Then please contact the administration.
    Dismiss Notice
  4. Lead your forces to battle in the 15th Techtree Contest. The call is yours, commander!
    Dismiss Notice
  5. The reforging of the races is complete. Come see the 14th Techtree Contest Results.
    Dismiss Notice
  6. It's time to choose your horse in the race - the 32nd Modeling Contest Poll is up!
    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.6b

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.
Using same variables and methods as Bribe's DDS.
Differences:
1 - To detect Damage Type/Armor Type/Defense Type/Weapon Type/Attack Type BOOL variables are used. Instead of custom integer. for example - if (DEFENSE_TYPE_MEDIUM == true)
2 - To change Damage Type/Attack Type new variables are used.
for example - DamageEventDamageT == Spell)
3 - To change Armor Type/Defense Type/Weapon Type used BOOL variables. Just set value to TRUE and engine will change the type.
4 - It is made on triggers that allows you to simply understand and change according to needs.
5 - New Event Response and Variables from Blizzard are used.

It is a tiny system which gives you a powerful tool to detect and Modify:

  • Damage Source
  • Damage Target
  • Damage Amount + Modification +/-
  • Damage Type + Modification (by setting type)
  • Defense Type (Medium/Heavy/Hero etc)
  • Armor Type (flesh/metal/stone etc)
  • Attack Type+ Modification (by setting type)
  • Weapon Type+ Modification (by bool)
  • Attack is Normal or Not (if skill or regular attack)
  • IsSpell
  • is Melee/ IsRange
  • isLethal
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.
  • Same varibales as in Bribe's system so you can easly implement.

Reworked all variables to compare with Bribe's DDS. Added Lethal detection and HP, Weapon Type Detection and Modification. IsMelee or IsRange detection.
New Events:
  • AfterDamageEvent
  • DamageModifierEvent
  • LethalDamageEvent
New modification:
  • Attack Type (by setting variable DamageEventAttackT = Type of Attack)
  • Damage Type (by setting variable DamageEventDamageT = Type of Damage)
  • Weapon Type (by setting bool variable WEAPON_TYPE_ML_CHOP = true)

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!


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 detection and modify - weapon, armor and defense
Added Armor types.
All Variables are BOOL so it let you to make checks easly.

  • Damage Engine Core
    • Events
    • Conditions
    • Actions
      • Custom script: local real DamageAmount = 0.00
      • Custom script: local attacktype AttackType = null
      • Custom script: local damagetype DamageType = null
      • Custom script: local armortype ArmorType = null
      • Custom script: local integer ArmorTypeTemp = 0
      • Custom script: local defensetype DefenseType = null
      • Custom script: local integer DefenseTypeTemp = 0
      • Custom script: local weapontype WeaponType = null
      • Custom script: local integer WeaponTypeIndex = 0
      • Custom script: local integer WeaponTypeIndexMod = 0
      • Set VariableSet DamageEvent = 0.00
      • -------- Set Basic Variables --------
      • Set VariableSet DamageEventSource = (Damage source)
      • Set VariableSet DamageEventTarget = (Damage Target)
      • Set VariableSet DamageEventAmount = (Damage taken)
      • Set VariableSet DamageEventDamageT = (Damage Type)
      • Set VariableSet DamageEventAttackT = (Damage Attack Type)
      • Custom script: set DamageAmount = udg_DamageEventAmount
      • Custom script: set DamageType = udg_DamageEventDamageT
      • Custom script: set AttackType = udg_DamageEventAttackT
      • Custom script: set WeaponType = BlzGetEventWeaponType()
      • -------- Detect Targets Defense type --------
      • Custom script: set DefenseTypeTemp = BlzGetUnitIntegerField(udg_DamageEventTarget, UNIT_IF_DEFENSE_TYPE)
      • Custom script: if (DefenseTypeTemp == 0) then
      • Set VariableSet DEFENSE_TYPE_LIGHT = True
      • Custom script: elseif (DefenseTypeTemp == 1) then
      • Set VariableSet DEFENSE_TYPE_MEDIUM = True
      • Custom script: elseif (DefenseTypeTemp == 2) then
      • Set VariableSet DEFENSE_TYPE_HEAVY = True
      • Custom script: elseif (DefenseTypeTemp == 3) then
      • Set VariableSet DEFENSE_TYPE_FORTIFIED = True
      • Custom script: elseif (DefenseTypeTemp == 4) then
      • Set VariableSet DEFENSE_TYPE_NORMAL = True
      • Custom script: elseif (DefenseTypeTemp == 5) then
      • Set VariableSet DEFENSE_TYPE_HERO = True
      • Custom script: elseif (DefenseTypeTemp == 6) then
      • Set VariableSet DEFENSE_TYPE_DIVINE = True
      • Custom script: else
      • Set VariableSet DEFENSE_TYPE_UNARMORED = True
      • Custom script: endif
      • -------- Detect Targets Armor type --------
      • Custom script: set ArmorTypeTemp = BlzGetUnitIntegerField(udg_DamageEventTarget, UNIT_IF_ARMOR_TYPE)
      • Custom script: if (ArmorTypeTemp == 1) then
      • Set VariableSet ARMOR_TYPE_FLESH = True
      • Custom script: elseif (ArmorTypeTemp == 2) then
      • Set VariableSet ARMOR_TYPE_METAL = True
      • Custom script: elseif (ArmorTypeTemp == 3) then
      • Set VariableSet ARMOR_TYPE_WOOD = True
      • Custom script: elseif (ArmorTypeTemp == 4) then
      • Set VariableSet ARMOR_TYPE_ETHEREAL = True
      • Custom script: elseif (ArmorTypeTemp == 5) then
      • Set VariableSet ARMOR_TYPE_STONE = True
      • Custom script: else
      • Set VariableSet ARMOR_TYPE_NONE = True
      • Custom script: endif
      • -------- Detect Attack Type --------
      • Custom script: if udg_DamageEventAttackT == ATTACK_TYPE_NORMAL then
      • Set VariableSet ATTACK_TYPE_SPELLS = True
      • Custom script: elseif udg_DamageEventAttackT == ATTACK_TYPE_MELEE then
      • Set VariableSet ATTACK_TYPE_NORMAL = True
      • Custom script: elseif udg_DamageEventAttackT == ATTACK_TYPE_PIERCE then
      • Set VariableSet ATTACK_TYPE_PIERCE = True
      • Custom script: elseif udg_DamageEventAttackT == ATTACK_TYPE_SIEGE then
      • Set VariableSet ATTACK_TYPE_SIEGE = True
      • Custom script: elseif udg_DamageEventAttackT == ATTACK_TYPE_MAGIC then
      • Set VariableSet ATTACK_TYPE_MAGIC = True
      • Custom script: elseif udg_DamageEventAttackT == ATTACK_TYPE_CHAOS then
      • Set VariableSet ATTACK_TYPE_CHAOS = True
      • Custom script: elseif udg_DamageEventAttackT == ATTACK_TYPE_HERO then
      • Set VariableSet ATTACK_TYPE_HERO = True
      • Custom script: endif
      • -------- Detect Damage Type --------
      • Custom script: if udg_DamageEventDamageT == DAMAGE_TYPE_UNKNOWN then
      • Set VariableSet DAMAGE_TYPE_UNKNOWN = True
      • Custom script: elseif udg_DamageEventDamageT == DAMAGE_TYPE_NORMAL then
      • Set VariableSet DAMAGE_TYPE_NORMAL = True
      • Custom script: elseif udg_DamageEventDamageT == DAMAGE_TYPE_ENHANCED then
      • Set VariableSet DAMAGE_TYPE_ENCHANCED = True
      • Custom script: elseif udg_DamageEventDamageT == DAMAGE_TYPE_FIRE then
      • Set VariableSet DAMAGE_TYPE_FIRE = True
      • Custom script: elseif udg_DamageEventDamageT == DAMAGE_TYPE_COLD then
      • Set VariableSet DAMAGE_TYPE_COLD = True
      • Custom script: elseif udg_DamageEventDamageT == DAMAGE_TYPE_LIGHTNING then
      • Set VariableSet DAMAGE_TYPE_LIGHTNING = True
      • Custom script: elseif udg_DamageEventDamageT == DAMAGE_TYPE_POISON then
      • Set VariableSet DAMAGE_TYPE_POISON = True
      • Custom script: elseif udg_DamageEventDamageT == DAMAGE_TYPE_DISEASE then
      • Set VariableSet DAMAGE_TYPE_DISEASE = True
      • Custom script: elseif udg_DamageEventDamageT == DAMAGE_TYPE_DIVINE then
      • Set VariableSet DAMAGE_TYPE_DIVINE = True
      • Custom script: elseif udg_DamageEventDamageT == DAMAGE_TYPE_MAGIC then
      • Set VariableSet DAMAGE_TYPE_MAGIC = True
      • Custom script: elseif udg_DamageEventDamageT == DAMAGE_TYPE_SONIC then
      • Set VariableSet DAMAGE_TYPE_SONIC = True
      • Custom script: elseif udg_DamageEventDamageT == DAMAGE_TYPE_ACID then
      • Set VariableSet DAMAGE_TYPE_ACID = True
      • Custom script: elseif udg_DamageEventDamageT == DAMAGE_TYPE_FORCE then
      • Set VariableSet DAMAGE_TYPE_FORCE = True
      • Custom script: elseif udg_DamageEventDamageT == DAMAGE_TYPE_DEATH then
      • Set VariableSet DAMAGE_TYPE_DEATH = True
      • Custom script: elseif udg_DamageEventDamageT == DAMAGE_TYPE_MIND then
      • Set VariableSet DAMAGE_TYPE_MIND = True
      • Custom script: elseif udg_DamageEventDamageT == DAMAGE_TYPE_PLANT then
      • Set VariableSet DAMAGE_TYPE_PLANT = True
      • Custom script: elseif udg_DamageEventDamageT == DAMAGE_TYPE_DEFENSIVE then
      • Set VariableSet DAMAGE_TYPE_DEFENSIVE = True
      • Custom script: elseif udg_DamageEventDamageT == DAMAGE_TYPE_DEMOLITION then
      • Set VariableSet DAMAGE_TYPE_DEMOLITION = True
      • Custom script: elseif udg_DamageEventDamageT == DAMAGE_TYPE_SLOW_POISON then
      • Set VariableSet DAMAGE_TYPE_SLOW_POISON = True
      • Custom script: elseif udg_DamageEventDamageT == DAMAGE_TYPE_SPIRIT_LINK then
      • Set VariableSet DAMAGE_TYPE_SPIRIT_LINK = True
      • Custom script: elseif udg_DamageEventDamageT == DAMAGE_TYPE_SHADOW_STRIKE then
      • Set VariableSet DAMAGE_TYPE_SHADOW_STRIKE = True
      • Custom script: elseif udg_DamageEventDamageT == DAMAGE_TYPE_UNIVERSAL then
      • Set VariableSet DAMAGE_TYPE_UNIVERSAL = True
      • Custom script: endif
      • -------- Detect Weapon Type --------
      • Custom script: if WeaponType == WEAPON_TYPE_METAL_LIGHT_CHOP then
      • Custom script: set WeaponTypeIndex = 1
      • Set VariableSet WEAPON_TYPE_ML_CHOP = True
      • Custom script: elseif WeaponType == WEAPON_TYPE_METAL_MEDIUM_CHOP then
      • Custom script: set WeaponTypeIndex = 2
      • Set VariableSet WEAPON_TYPE_MM_CHOP = True
      • Custom script: elseif WeaponType == WEAPON_TYPE_METAL_HEAVY_CHOP then
      • Custom script: set WeaponTypeIndex = 3
      • Set VariableSet WEAPON_TYPE_MH_CHOP = True
      • Custom script: elseif WeaponType == WEAPON_TYPE_METAL_LIGHT_SLICE then
      • Custom script: set WeaponTypeIndex = 4
      • Set VariableSet WEAPON_TYPE_ML_SLICE = True
      • Custom script: elseif WeaponType == WEAPON_TYPE_METAL_MEDIUM_SLICE then
      • Custom script: set WeaponTypeIndex = 5
      • Set VariableSet WEAPON_TYPE_MM_SLICE = True
      • Custom script: elseif WeaponType == WEAPON_TYPE_METAL_HEAVY_SLICE then
      • Custom script: set WeaponTypeIndex = 6
      • Set VariableSet WEAPON_TYPE_MH_SLICE = True
      • Custom script: elseif WeaponType == WEAPON_TYPE_METAL_MEDIUM_BASH then
      • Custom script: set WeaponTypeIndex = 7
      • Set VariableSet WEAPON_TYPE_MM_BASH = True
      • Custom script: elseif WeaponType == WEAPON_TYPE_METAL_HEAVY_BASH then
      • Custom script: set WeaponTypeIndex = 8
      • Set VariableSet WEAPON_TYPE_MH_BASH = True
      • Custom script: elseif WeaponType == WEAPON_TYPE_METAL_MEDIUM_STAB then
      • Custom script: set WeaponTypeIndex = 9
      • Set VariableSet WEAPON_TYPE_MM_STAB = True
      • Custom script: elseif WeaponType == WEAPON_TYPE_METAL_HEAVY_STAB then
      • Custom script: set WeaponTypeIndex = 10
      • Set VariableSet WEAPON_TYPE_MH_STAB = True
      • Custom script: elseif WeaponType == WEAPON_TYPE_WOOD_LIGHT_SLICE then
      • Custom script: set WeaponTypeIndex = 11
      • Set VariableSet WEAPON_TYPE_WL_SLICE = True
      • Custom script: elseif WeaponType == WEAPON_TYPE_WOOD_MEDIUM_SLICE then
      • Custom script: set WeaponTypeIndex = 12
      • Set VariableSet WEAPON_TYPE_WM_SLICE = True
      • Custom script: elseif WeaponType == WEAPON_TYPE_WOOD_HEAVY_SLICE then
      • Custom script: set WeaponTypeIndex = 13
      • Set VariableSet WEAPON_TYPE_WH_SLICE = True
      • Custom script: elseif WeaponType == WEAPON_TYPE_WOOD_LIGHT_BASH then
      • Custom script: set WeaponTypeIndex = 14
      • Set VariableSet WEAPON_TYPE_WL_BASH = True
      • Custom script: elseif WeaponType == WEAPON_TYPE_WOOD_MEDIUM_BASH then
      • Custom script: set WeaponTypeIndex = 15
      • Set VariableSet WEAPON_TYPE_WM_BASH = True
      • Custom script: elseif WeaponType == WEAPON_TYPE_WOOD_HEAVY_BASH then
      • Custom script: set WeaponTypeIndex = 16
      • Set VariableSet WEAPON_TYPE_WH_BASH = True
      • Custom script: elseif WeaponType == WEAPON_TYPE_WOOD_LIGHT_STAB then
      • Custom script: set WeaponTypeIndex = 17
      • Set VariableSet WEAPON_TYPE_WL_STAB = True
      • Custom script: elseif WeaponType == WEAPON_TYPE_WOOD_MEDIUM_STAB then
      • Custom script: set WeaponTypeIndex = 18
      • Set VariableSet WEAPON_TYPE_WM_STAB = True
      • Custom script: elseif WeaponType == WEAPON_TYPE_CLAW_LIGHT_SLICE then
      • Custom script: set WeaponTypeIndex = 19
      • Set VariableSet WEAPON_TYPE_CL_SLICE = True
      • Custom script: elseif WeaponType == WEAPON_TYPE_CLAW_MEDIUM_SLICE then
      • Custom script: set WeaponTypeIndex = 20
      • Set VariableSet WEAPON_TYPE_CM_SLICE = True
      • Custom script: elseif WeaponType == WEAPON_TYPE_CLAW_HEAVY_SLICE then
      • Custom script: set WeaponTypeIndex = 21
      • Set VariableSet WEAPON_TYPE_CH_SLICE = True
      • Custom script: elseif WeaponType == WEAPON_TYPE_AXE_MEDIUM_CHOP then
      • Custom script: set WeaponTypeIndex = 22
      • Set VariableSet WEAPON_TYPE_AM_CHOP = True
      • Custom script: elseif WeaponType == WEAPON_TYPE_ROCK_HEAVY_BASH then
      • Custom script: set WeaponTypeIndex = 23
      • Set VariableSet WEAPON_TYPE_RH_BASH = True
      • Custom script: else
      • Set VariableSet WEAPON_TYPE_NONE = True
      • Custom script: endif
      • -------- End Damage Type Detecting --------
      • -------- Detection IsNormal (Melee/Range) OR IsSpell --------
      • Custom script: if (AttackType != null and BlzGetEventIsAttack() == true) then
      • Set VariableSet IsDamageAttack = True
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (DamageEventSource is A melee attacker) Equal to True
        • Then - Actions
          • Set VariableSet IsDamageMelee = True
        • Else - Actions
          • Set VariableSet IsDamageRanged = True
      • Custom script: else
      • Set VariableSet IsDamageSpell = True
      • Custom script: endif
      • -------- If Lethal Dmg --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Life of DamageEventTarget) Less than or equal to DamageEventAmount
        • Then - Actions
          • Set VariableSet IsDamageLethal = True
          • Set VariableSet LethalDamageEvent = 1.00
          • Set VariableSet LethalDamageHP = (Life of DamageEventTarget)
        • Else - Actions
      • -------- Run Event --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • DamageEventAmount Greater than 0.00
        • Then - Actions
          • Set VariableSet DamageEvent = 1.00
        • Else - Actions
      • -------- Modify Params --------
      • -------- Detect Weapon Type --------
      • Custom script: if (udg_WEAPON_TYPE_ML_CHOP == true and WeaponTypeIndex != 1) then
      • Custom script: set WeaponTypeIndexMod = 1
      • Custom script: set WeaponType = WEAPON_TYPE_METAL_LIGHT_CHOP
      • Custom script: elseif (udg_WEAPON_TYPE_MM_CHOP == true and WeaponTypeIndex != 2) then
      • Custom script: set WeaponTypeIndexMod = 2
      • Custom script: set WeaponType = WEAPON_TYPE_METAL_MEDIUM_CHOP
      • Custom script: elseif (udg_WEAPON_TYPE_MH_CHOP == true and WeaponTypeIndex != 3) then
      • Custom script: set WeaponTypeIndexMod = 3
      • Custom script: set WeaponType = WEAPON_TYPE_METAL_HEAVY_CHOP
      • Custom script: elseif (udg_WEAPON_TYPE_ML_SLICE == true and WeaponTypeIndex != 4) then
      • Custom script: set WeaponTypeIndexMod = 4
      • Custom script: set WeaponType = WEAPON_TYPE_METAL_LIGHT_SLICE
      • Custom script: elseif (udg_WEAPON_TYPE_MM_SLICE == true and WeaponTypeIndex != 5) then
      • Custom script: set WeaponTypeIndexMod = 5
      • Custom script: set WeaponType = WEAPON_TYPE_METAL_MEDIUM_SLICE
      • Custom script: elseif (udg_WEAPON_TYPE_MH_SLICE == true and WeaponTypeIndex != 6) then
      • Custom script: set WeaponTypeIndexMod = 6
      • Custom script: set WeaponType = WEAPON_TYPE_METAL_HEAVY_SLICE
      • Custom script: elseif (udg_WEAPON_TYPE_MM_BASH == true and WeaponTypeIndex != 7) then
      • Custom script: set WeaponTypeIndexMod = 7
      • Custom script: set WeaponType = WEAPON_TYPE_METAL_MEDIUM_BASH
      • Custom script: elseif (udg_WEAPON_TYPE_MH_BASH == true and WeaponTypeIndex != 8) then
      • Custom script: set WeaponTypeIndexMod = 8
      • Custom script: set WeaponType = WEAPON_TYPE_METAL_HEAVY_BASH
      • Custom script: elseif (udg_WEAPON_TYPE_MM_STAB == true and WeaponTypeIndex != 9) then
      • Custom script: set WeaponTypeIndexMod = 9
      • Custom script: set WeaponType = WEAPON_TYPE_METAL_MEDIUM_STAB
      • Custom script: elseif (udg_WEAPON_TYPE_MH_STAB == true and WeaponTypeIndex != 10) then
      • Custom script: set WeaponTypeIndexMod = 10
      • Custom script: set WeaponType = WEAPON_TYPE_METAL_HEAVY_STAB
      • Custom script: elseif (udg_WEAPON_TYPE_WL_SLICE == true and WeaponTypeIndex != 11) then
      • Custom script: set WeaponTypeIndexMod = 11
      • Custom script: set WeaponType = WEAPON_TYPE_WOOD_LIGHT_SLICE
      • Custom script: elseif (udg_WEAPON_TYPE_WM_SLICE == true and WeaponTypeIndex != 12) then
      • Custom script: set WeaponTypeIndexMod = 12
      • Custom script: set WeaponType = WEAPON_TYPE_WOOD_MEDIUM_SLICE
      • Custom script: elseif (udg_WEAPON_TYPE_WH_SLICE == true and WeaponTypeIndex != 13) then
      • Custom script: set WeaponTypeIndexMod = 13
      • Custom script: set WeaponType = WEAPON_TYPE_WOOD_HEAVY_SLICE
      • Custom script: elseif (udg_WEAPON_TYPE_WL_BASH == true and WeaponTypeIndex != 14) then
      • Custom script: set WeaponTypeIndexMod = 14
      • Custom script: set WeaponType = WEAPON_TYPE_WOOD_LIGHT_BASH
      • Custom script: elseif (udg_WEAPON_TYPE_WM_BASH == true and WeaponTypeIndex != 15) then
      • Custom script: set WeaponTypeIndexMod = 15
      • Custom script: set WeaponType = WEAPON_TYPE_WOOD_MEDIUM_BASH
      • Custom script: elseif (udg_WEAPON_TYPE_WH_BASH == true and WeaponTypeIndex != 16) then
      • Custom script: set WeaponTypeIndexMod = 16
      • Custom script: set WeaponType = WEAPON_TYPE_WOOD_HEAVY_BASH
      • Custom script: elseif (udg_WEAPON_TYPE_WL_STAB == true and WeaponTypeIndex != 17) then
      • Custom script: set WeaponTypeIndexMod = 17
      • Custom script: set WeaponType = WEAPON_TYPE_WOOD_LIGHT_STAB
      • Custom script: elseif (udg_WEAPON_TYPE_WM_STAB == true and WeaponTypeIndex != 18) then
      • Custom script: set WeaponTypeIndexMod = 18
      • Custom script: set WeaponType = WEAPON_TYPE_WOOD_MEDIUM_STAB
      • Custom script: elseif (udg_WEAPON_TYPE_CL_SLICE == true and WeaponTypeIndex != 19) then
      • Custom script: set WeaponTypeIndexMod = 19
      • Custom script: set WeaponType = WEAPON_TYPE_CLAW_LIGHT_SLICE
      • Custom script: elseif (udg_WEAPON_TYPE_CM_SLICE == true and WeaponTypeIndex != 20) then
      • Custom script: set WeaponTypeIndexMod = 20
      • Custom script: set WeaponType = WEAPON_TYPE_CLAW_MEDIUM_SLICE
      • Custom script: elseif (udg_WEAPON_TYPE_CH_SLICE == true and WeaponTypeIndex != 21) then
      • Custom script: set WeaponTypeIndexMod = 21
      • Custom script: set WeaponType = WEAPON_TYPE_CLAW_HEAVY_SLICE
      • Custom script: elseif (udg_WEAPON_TYPE_AM_CHOP == true and WeaponTypeIndex != 22) then
      • Custom script: set WeaponTypeIndexMod = 22
      • Custom script: set WeaponType = WEAPON_TYPE_AXE_MEDIUM_CHOP
      • Custom script: elseif (udg_WEAPON_TYPE_RH_BASH == true and WeaponTypeIndex != 23) then
      • Custom script: set WeaponTypeIndexMod = 23
      • Custom script: set WeaponType = WEAPON_TYPE_ROCK_HEAVY_BASH
      • Custom script: endif
      • Custom script: if (WeaponTypeIndex != WeaponTypeIndexMod) then
      • Custom script: call BlzSetEventWeaponType(WeaponType)
      • Custom script: endif
      • -------- Attack Type Modify --------
      • Custom script: if (udg_DamageEventAttackT != AttackType) then
      • Event Response - Set Attack Type of Unit Damaged Event to DamageEventAttackT
      • Custom script: endif
      • -------- Damage Type Modify --------
      • Custom script: if (udg_DamageEventDamageT != DamageType) then
      • Event Response - Set Damage Type of Unit Damaged Event to DamageEventDamageT
      • Custom script: endif
      • -------- Apply damage modify --------
      • Custom script: if (udg_DamageEventAmount != DamageAmount) then
      • Set VariableSet DamageModifierEvent = 1.00
      • Event Response - Set Damage of Unit Damaged Event to DamageEventAmount
      • Set VariableSet AfterDamageEvent = 1.00
      • Set VariableSet DamageEvent = 2.00
      • Custom script: endif
      • -------- Clear --------
      • -------- Variables --------
      • Set VariableSet IsDamageAttack = False
      • Set VariableSet IsDamageSpell = False
      • Set VariableSet DamageModifierEvent = 0.00
      • Set VariableSet AfterDamageEvent = 0.00
      • Set VariableSet DamageEventSource = No unit
      • Set VariableSet DamageEventTarget = No unit
      • Set VariableSet DamageEventAmount = 0.00
      • Set VariableSet DamageEventDamageT = Unknown
      • Set VariableSet DamageKey = 0.00
      • Set VariableSet IsDamageLethal = False
      • Set VariableSet IsDamageRanged = False
      • Set VariableSet IsDamageMelee = False
      • Set VariableSet IsDamageLethal = False
      • Set VariableSet LethalDamageEvent = 0.00
      • Set VariableSet LethalDamageHP = 0.00
      • -------- ----- --------
      • Set VariableSet DEFENSE_TYPE_DIVINE = False
      • Set VariableSet DEFENSE_TYPE_FORTIFIED = False
      • Set VariableSet DEFENSE_TYPE_HEAVY = False
      • Set VariableSet DEFENSE_TYPE_HERO = False
      • Set VariableSet DEFENSE_TYPE_LIGHT = False
      • Set VariableSet DEFENSE_TYPE_MEDIUM = False
      • Set VariableSet DEFENSE_TYPE_NORMAL = False
      • Set VariableSet DEFENSE_TYPE_UNARMORED = False
      • -------- ----- --------
      • Set VariableSet ATTACK_TYPE_CHAOS = False
      • Set VariableSet ATTACK_TYPE_HERO = False
      • Set VariableSet ATTACK_TYPE_MAGIC = False
      • Set VariableSet ATTACK_TYPE_NORMAL = False
      • Set VariableSet ATTACK_TYPE_PIERCE = False
      • Set VariableSet ATTACK_TYPE_SIEGE = False
      • Set VariableSet ATTACK_TYPE_SPELLS = False
      • -------- ----- --------
      • Set VariableSet DAMAGE_TYPE_UNKNOWN = False
      • Set VariableSet DAMAGE_TYPE_NORMAL = False
      • Set VariableSet DAMAGE_TYPE_ENCHANCED = False
      • Set VariableSet DAMAGE_TYPE_FIRE = False
      • Set VariableSet DAMAGE_TYPE_COLD = False
      • Set VariableSet DAMAGE_TYPE_LIGHTNING = False
      • Set VariableSet DAMAGE_TYPE_POISON = False
      • Set VariableSet DAMAGE_TYPE_DISEASE = False
      • Set VariableSet DAMAGE_TYPE_DIVINE = False
      • Set VariableSet DAMAGE_TYPE_MAGIC = False
      • Set VariableSet DAMAGE_TYPE_SONIC = False
      • Set VariableSet DAMAGE_TYPE_ACID = False
      • Set VariableSet DAMAGE_TYPE_FORCE = False
      • Set VariableSet DAMAGE_TYPE_DEATH = False
      • Set VariableSet DAMAGE_TYPE_MIND = False
      • Set VariableSet DAMAGE_TYPE_PLANT = False
      • Set VariableSet DAMAGE_TYPE_DEFENSIVE = False
      • Set VariableSet DAMAGE_TYPE_DEMOLITION = False
      • Set VariableSet DAMAGE_TYPE_SLOW_POISON = False
      • Set VariableSet DAMAGE_TYPE_SPIRIT_LINK = False
      • Set VariableSet DAMAGE_TYPE_UNIVERSAL = False
      • -------- ----- --------
      • Set VariableSet ARMOR_TYPE_ETHEREAL = False
      • Set VariableSet ARMOR_TYPE_FLESH = False
      • Set VariableSet ARMOR_TYPE_METAL = False
      • Set VariableSet ARMOR_TYPE_NONE = False
      • Set VariableSet ARMOR_TYPE_STONE = False
      • Set VariableSet ARMOR_TYPE_WOOD = False
      • -------- -------------- --------
      • Set VariableSet WEAPON_TYPE_ML_CHOP = False
      • Set VariableSet WEAPON_TYPE_MM_CHOP = False
      • Set VariableSet WEAPON_TYPE_MH_CHOP = False
      • Set VariableSet WEAPON_TYPE_ML_SLICE = False
      • Set VariableSet WEAPON_TYPE_MM_SLICE = False
      • Set VariableSet WEAPON_TYPE_MH_SLICE = False
      • Set VariableSet WEAPON_TYPE_MM_BASH = False
      • Set VariableSet WEAPON_TYPE_MH_BASH = False
      • Set VariableSet WEAPON_TYPE_MM_STAB = False
      • Set VariableSet WEAPON_TYPE_MH_STAB = False
      • Set VariableSet WEAPON_TYPE_WL_SLICE = False
      • Set VariableSet WEAPON_TYPE_WM_SLICE = False
      • Set VariableSet WEAPON_TYPE_WH_SLICE = False
      • Set VariableSet WEAPON_TYPE_WL_BASH = False
      • Set VariableSet WEAPON_TYPE_WM_BASH = False
      • Set VariableSet WEAPON_TYPE_WH_BASH = False
      • Set VariableSet WEAPON_TYPE_WL_STAB = False
      • Set VariableSet WEAPON_TYPE_WM_STAB = False
      • Set VariableSet WEAPON_TYPE_CL_SLICE = False
      • Set VariableSet WEAPON_TYPE_CM_SLICE = False
      • Set VariableSet WEAPON_TYPE_CH_SLICE = False
      • Set VariableSet WEAPON_TYPE_AM_CHOP = False
      • Set VariableSet WEAPON_TYPE_RH_BASH = False
      • Set VariableSet WEAPON_TYPE_NONE = 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.6b - Fixed damage event fire.
v 0.6 Updated - Added Attack Type/Armor Type/Weapon Type modificator. And used same variables as Bribe's DDS
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. SpasMaster

    SpasMaster

    Joined:
    Jan 29, 2010
    Messages:
    1,881
    Resources:
    4
    Icons:
    2
    Maps:
    2
    Resources:
    4
    I've gone through the description and features and I can't seem to find what does this system provide that @Bribe 's Damage Engine doesn't?

    Even worse, it seems to include things directly based off of Bribe's Damage Engine.

    Keep in mind that it needs to have something unique otherwise it would contradict the Resource Submission Rules (Models, skins, icons, spells).
    upload_2020-2-29_13-49-5.png
    All and any resources (including spells and systems) should provide something that users don't already have in the site.

    If there is a such unique feature in the system, then I'd suggest focusing on it and building the system around it. Explain in the description what people can find in your system that they can't elsewhere. I may be wrong, but I haven't noticed one.
     
  2. Bribe

    Bribe

    Joined:
    Sep 26, 2009
    Messages:
    8,194
    Resources:
    25
    Maps:
    3
    Spells:
    10
    Tutorials:
    3
    JASS:
    9
    Resources:
    25
    @M4gz originally found this cool new native that led to me updating to Damage Engine 5.5, so I'm interested to see if he/she will cook up another new, undiscovered thing with this resource.
     
  3. M4gz

    M4gz

    Joined:
    Dec 30, 2019
    Messages:
    54
    Resources:
    0
    Resources:
    0
    Thanks for your anwers!
    Differences:
    1 - To detect Damage Type/Armor Type/Defense Type/Weapon Type/Attack Type BOOL variables are used. Instead of custom integer. for example - if (DEFENSE_TYPE_MEDIUM == true)
    2 - To change Damage Type/Attack Type new variables are used.
    for example - DamageEventDamageT == Spell)
    3 - To change Armor Type/Defense Type/Weapon Type used BOOL variables. Just set value to TRUE and engine will change the type.
    4 - It is made on triggers that allows you to simply understand and change according to needs.
    5 - New Event Response and Variables from Blizzard are used.
    6 - Its lighter and less coded - Just 1 trigger which makes all work.
    Only in 1 place i used same condition as in Bribe's DDS AttackType != null in isSpell detection method. I used it to compare with condition who used it already and prevent breaks.
     
  4. Bribe

    Bribe

    Joined:
    Sep 26, 2009
    Messages:
    8,194
    Resources:
    25
    Maps:
    3
    Spells:
    10
    Tutorials:
    3
    JASS:
    9
    Resources:
    25
    When setting the armor type or defense type, it doesn't make sense to use a boolean...

    as then you have to check in your resource which boolean is set.

    Which boolean do you choose, in case of multiple TRUE values?

    You then have to un-set all of the booleans at the end to ensure there are no misflags.

    I don't like the syntax of "DamageEventXT == DAMAGE_CONSTANT_VARIABLE" particularly much, and booleans clean up that a bit, but I don't think this is the answer.
     
  5. M4gz

    M4gz

    Joined:
    Dec 30, 2019
    Messages:
    54
    Resources:
    0
    Resources:
    0
    Thanks for Your answer
    As you see armor and defense type changing using common variables not boolean.
    Boolean used ONLY for Weapon type because that type of variable doesnt exists in GUI.
    1st Boolean will be used in list of variables i think its a logical. What case to use several same modifications at the same time?
    At the end of what? Bool is used only for weapon types and it compare previous value with new one (if it exists). They are nulled after event.
    Yes that syntax is not pretty looks buy if used these names i was need to use the same. But booleans make it clean and remove part of code and variables.
    Also that resource gives a good and easy explaination of DDS in GUI and a lot of ways to change/edit/modify without any JASS/LUA knowledges.
     
  6. Teo_omant

    Teo_omant

    Joined:
    Nov 4, 2019
    Messages:
    15
    Resources:
    0
    Resources:
    0
    If you deal damage inside the damage detection function, everything breaks and all damage is set to 0. How can I do additional damage (without increasing the current one) inside the function? I first need to deal damage to one target, and then additional damage to targets around it.
     
  7. Bribe

    Bribe

    Joined:
    Sep 26, 2009
    Messages:
    8,194
    Resources:
    25
    Maps:
    3
    Spells:
    10
    Tutorials:
    3
    JASS:
    9
    Resources:
    25
    The resource you are replying to is unapproved and - according to the author- still in beta testing. If you want a working damage system for all needs, you need look no further than Damage Engine 5.5.0.0
     
  8. Teo_omant

    Teo_omant

    Joined:
    Nov 4, 2019
    Messages:
    15
    Resources:
    0
    Resources:
    0
    Bribe Yes, I've seen your system. I found it too cumbersome, too many settings and not enough hints (for me personally). And then I opened it and immediately see what and where to install. In your system, I didn't fully understand how your trigger "Set damage" differs from "Damage tag". I didn't find any hints on how to use "on AOE" or what the "On Zero"trigger is. Etc. Need more hints for noobs like me.
     
  9. Bribe

    Bribe

    Joined:
    Sep 26, 2009
    Messages:
    8,194
    Resources:
    25
    Maps:
    3
    Spells:
    10
    Tutorials:
    3
    JASS:
    9
    Resources:
    25
    1) copy the damage engine category into your map

    2) it's installed

    The stuff you don't understand is not meant to be picked up on right away. Over the years I added a bunch of a features to satisfy requests. But the main usage is straightforward:

    DamageEvent becomes equal to 1.00 - detects when DamageEventSource damages DamageEventTarget for DamageEventAmount.

    If you instead use DamageModifierEvent becomes equal yo 1.00, you can change the damage before it's modified by armor or mana shield.

    If you instead use DamageModifierEvent 4.00, you can change it AFTER it has been modified by armor or mana shield.

    That's the core of the system. The rest is just meant for specialized stuff or exists just for demo purposes.
     
  10. M4gz

    M4gz

    Joined:
    Dec 30, 2019
    Messages:
    54
    Resources:
    0
    Resources:
    0
    Can you show a trigger or test map? If it breaks ill fix it ASAP. I was testing for dealing damage inside the event and all works ok. You can check test triggers.
     
  11. Chaosy

    Chaosy

    Joined:
    Jun 9, 2011
    Messages:
    10,813
    Resources:
    17
    Maps:
    1
    Spells:
    10
    Tutorials:
    6
    Resources:
    17
    I am all for using a system that only does what I need to.
    For example, I still recommend Weep's DDS: GUI-Friendly Damage Detection v1.2.1 to new users as it is not overwhelming with features like the more modern options.

    I'd even use it myself most of the time as I very rarely need the fancy features anyway.

    This seems to be somewhere in the middle, not quite as simple as Weeps, but not good enough to compete with Damage Engine (among others)
     
  12. Teo_omant

    Teo_omant

    Joined:
    Nov 4, 2019
    Messages:
    15
    Resources:
    0
    Resources:
    0
    M4gz, Yes, it's just that if I deal damage inside the function, the damage is set to 0. I'm checking this with debag. If you put "FaerieFire" on the enemy, which reduces the armor, the damage is also set to 0. I checked your code and saw that if the damage is not actual, then the next trigger "Event Modify" is triggered, but it does not save this damage, but sets it to 0 (why?). More precisely, it doesn't set it to 0, it only saves it if it is larger (as you have in the example of the mountain king, you increase the damage by 2 times), but I don't need it. I did everything by your example, checked it repeatedly. I like your system so much, but I just don't understand why I can't do damage inside the function. I have the ability to "reflect damage". When receiving damage-I deal part of the damage response and it does not work, the system does not "catch" "reflected damage", and the damage taked by the hero at this moment is set to 0. I believe that the error lies in the fact that applying new damage simply resets the variables "DamageEvent Target and Source". Because in this cases, debug returns null.
     

    Attached Files:

    • 321.png
      321.png
      File size:
      63.7 KB
      Views:
      15
  13. Teo_omant

    Teo_omant

    Joined:
    Nov 4, 2019
    Messages:
    15
    Resources:
    0
    Resources:
    0
    UPD
     

    Attached Files:

    • 333.png
      333.png
      File size:
      98.5 KB
      Views:
      16
  14. M4gz

    M4gz

    Joined:
    Dec 30, 2019
    Messages:
    54
    Resources:
    0
    Resources:
    0
    Remove these lines and all will works fine fine in your case
     

    Attached Files:

  15. Teo_omant

    Teo_omant

    Joined:
    Nov 4, 2019
    Messages:
    15
    Resources:
    0
    Resources:
    0
    M4gz, No, it doesn't help. I'm not a noob in GUI that I might have made some mistake. There is definitely a bug here.
     

    Attached Files:

    • 444.png
      444.png
      File size:
      1.4 MB
      Views:
      16
  16. Teo_omant

    Teo_omant

    Joined:
    Nov 4, 2019
    Messages:
    15
    Resources:
    0
    Resources:
    0
    On the test map
     

    Attached Files:

  17. M4gz

    M4gz

    Joined:
    Dec 30, 2019
    Messages:
    54
    Resources:
    0
    Resources:
    0
    The issue was with nulled damage event. I replaced it to the begining of the engine and everything works fine. Thanks ill fix it in the test map. Working example attached
     

    Attached Files:

    Last edited: Apr 10, 2020
  18. Teo_omant

    Teo_omant

    Joined:
    Nov 4, 2019
    Messages:
    15
    Resources:
    0
    Resources:
    0
    M4gz, thank you!
     
  19. MyPad

    MyPad

    Spell Reviewer

    Joined:
    May 9, 2014
    Messages:
    1,430
    Resources:
    8
    Models:
    1
    Icons:
    2
    Maps:
    1
    Spells:
    3
    JASS:
    1
    Resources:
    8
    • -------- Detect Targets Defense type --------
    • Custom script: set DefenseTypeTemp = BlzGetUnitIntegerField(udg_DamageEventTarget, UNIT_IF_DEFENSE_TYPE)
    • Custom script: if (DefenseTypeTemp == 0) then
    • Set VariableSet DEFENSE_TYPE_LIGHT = True
    • Custom script: elseif (DefenseTypeTemp == 1) then
    • Set VariableSet DEFENSE_TYPE_MEDIUM = True
    • Custom script: elseif (DefenseTypeTemp == 2) then
    • Set VariableSet DEFENSE_TYPE_HEAVY = True
    • Custom script: elseif (DefenseTypeTemp == 3) then
    • Set VariableSet DEFENSE_TYPE_FORTIFIED = True
    • Custom script: elseif (DefenseTypeTemp == 4) then
    • Set VariableSet DEFENSE_TYPE_NORMAL = True
    • Custom script: elseif (DefenseTypeTemp == 5) then
    • Set VariableSet DEFENSE_TYPE_HERO = True
    • Custom script: elseif (DefenseTypeTemp == 6) then
    • Set VariableSet DEFENSE_TYPE_DIVINE = True
    • Custom script: else
    • Set VariableSet DEFENSE_TYPE_UNARMORED = True
    • Custom script: endif
    • -------- Detect Targets Armor type --------
    • Custom script: set ArmorTypeTemp = BlzGetUnitIntegerField(udg_DamageEventTarget, UNIT_IF_ARMOR_TYPE)
    • Custom script: if (ArmorTypeTemp == 1) then
    • Set VariableSet ARMOR_TYPE_FLESH = True
    • Custom script: elseif (ArmorTypeTemp == 2) then
    • Set VariableSet ARMOR_TYPE_METAL = True
    • Custom script: elseif (ArmorTypeTemp == 3) then
    • Set VariableSet ARMOR_TYPE_WOOD = True
    • Custom script: elseif (ArmorTypeTemp == 4) then
    • Set VariableSet ARMOR_TYPE_ETHEREAL = True
    • Custom script: elseif (ArmorTypeTemp == 5) then
    • Set VariableSet ARMOR_TYPE_STONE = True
    • Custom script: else
    • Set VariableSet ARMOR_TYPE_NONE = True
    • Custom script: endif
    • -------- Detect Attack Type --------
    • Custom script: if udg_DamageEventAttackT == ATTACK_TYPE_NORMAL then
    • Set VariableSet ATTACK_TYPE_SPELLS = True
    • Custom script: elseif udg_DamageEventAttackT == ATTACK_TYPE_MELEE then
    • Set VariableSet ATTACK_TYPE_NORMAL = True
    • Custom script: elseif udg_DamageEventAttackT == ATTACK_TYPE_PIERCE then
    • Set VariableSet ATTACK_TYPE_PIERCE = True
    • Custom script: elseif udg_DamageEventAttackT == ATTACK_TYPE_SIEGE then
    • Set VariableSet ATTACK_TYPE_SIEGE = True
    • Custom script: elseif udg_DamageEventAttackT == ATTACK_TYPE_MAGIC then
    • Set VariableSet ATTACK_TYPE_MAGIC = True
    • Custom script: elseif udg_DamageEventAttackT == ATTACK_TYPE_CHAOS then
    • Set VariableSet ATTACK_TYPE_CHAOS = True
    • Custom script: elseif udg_DamageEventAttackT == ATTACK_TYPE_HERO then
    • Set VariableSet ATTACK_TYPE_HERO = True
    • Custom script: endif
    • -------- Detect Damage Type --------
    • Custom script: if udg_DamageEventDamageT == DAMAGE_TYPE_UNKNOWN then
    • Set VariableSet DAMAGE_TYPE_UNKNOWN = True
    • Custom script: elseif udg_DamageEventDamageT == DAMAGE_TYPE_NORMAL then
    • Set VariableSet DAMAGE_TYPE_NORMAL = True
    • Custom script: elseif udg_DamageEventDamageT == DAMAGE_TYPE_ENHANCED then
    • Set VariableSet DAMAGE_TYPE_ENCHANCED = True
    • Custom script: elseif udg_DamageEventDamageT == DAMAGE_TYPE_FIRE then
    • Set VariableSet DAMAGE_TYPE_FIRE = True
    • Custom script: elseif udg_DamageEventDamageT == DAMAGE_TYPE_COLD then
    • Set VariableSet DAMAGE_TYPE_COLD = True
    • Custom script: elseif udg_DamageEventDamageT == DAMAGE_TYPE_LIGHTNING then
    • Set VariableSet DAMAGE_TYPE_LIGHTNING = True
    • Custom script: elseif udg_DamageEventDamageT == DAMAGE_TYPE_POISON then
    • Set VariableSet DAMAGE_TYPE_POISON = True
    • Custom script: elseif udg_DamageEventDamageT == DAMAGE_TYPE_DISEASE then
    • Set VariableSet DAMAGE_TYPE_DISEASE = True
    • Custom script: elseif udg_DamageEventDamageT == DAMAGE_TYPE_DIVINE then
    • Set VariableSet DAMAGE_TYPE_DIVINE = True
    • Custom script: elseif udg_DamageEventDamageT == DAMAGE_TYPE_MAGIC then
    • Set VariableSet DAMAGE_TYPE_MAGIC = True
    • Custom script: elseif udg_DamageEventDamageT == DAMAGE_TYPE_SONIC then
    • Set VariableSet DAMAGE_TYPE_SONIC = True
    • Custom script: elseif udg_DamageEventDamageT == DAMAGE_TYPE_ACID then
    • Set VariableSet DAMAGE_TYPE_ACID = True
    • Custom script: elseif udg_DamageEventDamageT == DAMAGE_TYPE_FORCE then
    • Set VariableSet DAMAGE_TYPE_FORCE = True
    • Custom script: elseif udg_DamageEventDamageT == DAMAGE_TYPE_DEATH then
    • Set VariableSet DAMAGE_TYPE_DEATH = True
    • Custom script: elseif udg_DamageEventDamageT == DAMAGE_TYPE_MIND then
    • Set VariableSet DAMAGE_TYPE_MIND = True
    • Custom script: elseif udg_DamageEventDamageT == DAMAGE_TYPE_PLANT then
    • Set VariableSet DAMAGE_TYPE_PLANT = True
    • Custom script: elseif udg_DamageEventDamageT == DAMAGE_TYPE_DEFENSIVE then
    • Set VariableSet DAMAGE_TYPE_DEFENSIVE = True
    • Custom script: elseif udg_DamageEventDamageT == DAMAGE_TYPE_DEMOLITION then
    • Set VariableSet DAMAGE_TYPE_DEMOLITION = True
    • Custom script: elseif udg_DamageEventDamageT == DAMAGE_TYPE_SLOW_POISON then
    • Set VariableSet DAMAGE_TYPE_SLOW_POISON = True
    • Custom script: elseif udg_DamageEventDamageT == DAMAGE_TYPE_SPIRIT_LINK then
    • Set VariableSet DAMAGE_TYPE_SPIRIT_LINK = True
    • Custom script: elseif udg_DamageEventDamageT == DAMAGE_TYPE_SHADOW_STRIKE then
    • Set VariableSet DAMAGE_TYPE_SHADOW_STRIKE = True
    • Custom script: elseif udg_DamageEventDamageT == DAMAGE_TYPE_UNIVERSAL then
    • Set VariableSet DAMAGE_TYPE_UNIVERSAL = True
    • Custom script: endif
    • -------- Detect Weapon Type --------
    • Custom script: if WeaponType == WEAPON_TYPE_METAL_LIGHT_CHOP then
    • Custom script: set WeaponTypeIndex = 1
    • Set VariableSet WEAPON_TYPE_ML_CHOP = True
    • Custom script: elseif WeaponType == WEAPON_TYPE_METAL_MEDIUM_CHOP then
    • Custom script: set WeaponTypeIndex = 2
    • Set VariableSet WEAPON_TYPE_MM_CHOP = True
    • Custom script: elseif WeaponType == WEAPON_TYPE_METAL_HEAVY_CHOP then
    • Custom script: set WeaponTypeIndex = 3
    • Set VariableSet WEAPON_TYPE_MH_CHOP = True
    • Custom script: elseif WeaponType == WEAPON_TYPE_METAL_LIGHT_SLICE then
    • Custom script: set WeaponTypeIndex = 4
    • Set VariableSet WEAPON_TYPE_ML_SLICE = True
    • Custom script: elseif WeaponType == WEAPON_TYPE_METAL_MEDIUM_SLICE then
    • Custom script: set WeaponTypeIndex = 5
    • Set VariableSet WEAPON_TYPE_MM_SLICE = True
    • Custom script: elseif WeaponType == WEAPON_TYPE_METAL_HEAVY_SLICE then
    • Custom script: set WeaponTypeIndex = 6
    • Set VariableSet WEAPON_TYPE_MH_SLICE = True
    • Custom script: elseif WeaponType == WEAPON_TYPE_METAL_MEDIUM_BASH then
    • Custom script: set WeaponTypeIndex = 7
    • Set VariableSet WEAPON_TYPE_MM_BASH = True
    • Custom script: elseif WeaponType == WEAPON_TYPE_METAL_HEAVY_BASH then
    • Custom script: set WeaponTypeIndex = 8
    • Set VariableSet WEAPON_TYPE_MH_BASH = True
    • Custom script: elseif WeaponType == WEAPON_TYPE_METAL_MEDIUM_STAB then
    • Custom script: set WeaponTypeIndex = 9
    • Set VariableSet WEAPON_TYPE_MM_STAB = True
    • Custom script: elseif WeaponType == WEAPON_TYPE_METAL_HEAVY_STAB then
    • Custom script: set WeaponTypeIndex = 10
    • Set VariableSet WEAPON_TYPE_MH_STAB = True
    • Custom script: elseif WeaponType == WEAPON_TYPE_WOOD_LIGHT_SLICE then
    • Custom script: set WeaponTypeIndex = 11
    • Set VariableSet WEAPON_TYPE_WL_SLICE = True
    • Custom script: elseif WeaponType == WEAPON_TYPE_WOOD_MEDIUM_SLICE then
    • Custom script: set WeaponTypeIndex = 12
    • Set VariableSet WEAPON_TYPE_WM_SLICE = True
    • Custom script: elseif WeaponType == WEAPON_TYPE_WOOD_HEAVY_SLICE then
    • Custom script: set WeaponTypeIndex = 13
    • Set VariableSet WEAPON_TYPE_WH_SLICE = True
    • Custom script: elseif WeaponType == WEAPON_TYPE_WOOD_LIGHT_BASH then
    • Custom script: set WeaponTypeIndex = 14
    • Set VariableSet WEAPON_TYPE_WL_BASH = True
    • Custom script: elseif WeaponType == WEAPON_TYPE_WOOD_MEDIUM_BASH then
    • Custom script: set WeaponTypeIndex = 15
    • Set VariableSet WEAPON_TYPE_WM_BASH = True
    • Custom script: elseif WeaponType == WEAPON_TYPE_WOOD_HEAVY_BASH then
    • Custom script: set WeaponTypeIndex = 16
    • Set VariableSet WEAPON_TYPE_WH_BASH = True
    • Custom script: elseif WeaponType == WEAPON_TYPE_WOOD_LIGHT_STAB then
    • Custom script: set WeaponTypeIndex = 17
    • Set VariableSet WEAPON_TYPE_WL_STAB = True
    • Custom script: elseif WeaponType == WEAPON_TYPE_WOOD_MEDIUM_STAB then
    • Custom script: set WeaponTypeIndex = 18
    • Set VariableSet WEAPON_TYPE_WM_STAB = True
    • Custom script: elseif WeaponType == WEAPON_TYPE_CLAW_LIGHT_SLICE then
    • Custom script: set WeaponTypeIndex = 19
    • Set VariableSet WEAPON_TYPE_CL_SLICE = True
    • Custom script: elseif WeaponType == WEAPON_TYPE_CLAW_MEDIUM_SLICE then
    • Custom script: set WeaponTypeIndex = 20
    • Set VariableSet WEAPON_TYPE_CM_SLICE = True
    • Custom script: elseif WeaponType == WEAPON_TYPE_CLAW_HEAVY_SLICE then
    • Custom script: set WeaponTypeIndex = 21
    • Set VariableSet WEAPON_TYPE_CH_SLICE = True
    • Custom script: elseif WeaponType == WEAPON_TYPE_AXE_MEDIUM_CHOP then
    • Custom script: set WeaponTypeIndex = 22
    • Set VariableSet WEAPON_TYPE_AM_CHOP = True
    • Custom script: elseif WeaponType == WEAPON_TYPE_ROCK_HEAVY_BASH then
    • Custom script: set WeaponTypeIndex = 23
    • Set VariableSet WEAPON_TYPE_RH_BASH = True
    • Custom script: else
    • Set VariableSet WEAPON_TYPE_NONE = True
    • Custom script: endif
    • -------- End Damage Type Detecting --------


    The trigger reeks of if-then statements (There are too many of them). As far as code inspection goes, all of that
    set WeaponTypeIndex
    fiasco can be reduced to
    set WeaponTypeIndex = GetHandleId(WeaponType)


    Given the current setup, if a new damage type, attack type, or armor type would be introduced (unlikely, though), the system will have to be updated to accommodate for that. This would be tedious to maintain or update if any bug arises, in conjunction with using the system or due to the system itself.

    Considering the way weapon type is modified, it would appear that when changing the weapon type, the weapon type with the smallest index will be assigned to the damage instance, as opposed to the latest weapon type taking precedence. As shown below (this is assuming that there are at least 2 triggers modifying weapon type).

    • Set VariableSet WEAPON_TYPE_ML_CHOP = true
    • -------- Some other trigger running --------
    • Set VariableSet WEAPON_TYPE_MM_CHOP = true


    This would apply the first weapon type WEAPON_TYPE_ML_CHOP (index 1), as opposed to WEAPON_TYPE_MM_CHOP (index 2). In this case, the most recent assignment to the weapon type is not respected. Doing the same thing with Bribe's Damage Engine:

    • [B] [/B]Set VariableSet DamageEventWeaponT = WEAPON_TYPE_ML_CHOP
      • -------- Some other trigger running --------
      • Set VariableSet DamageEventWeaponT = WEAPON_TYPE_MM_CHOP


    The weapon type will be assigned as WEAPON_TYPE_MM_CHOP (index 2), the more recent assignment, as opposed to WEAPON_TYPE_ML_CHOP (index 1).
     
  20. M4gz

    M4gz

    Joined:
    Dec 30, 2019
    Messages:
    54
    Resources:
    0
    Resources:
    0
    Thanks ill fix it asap