[GUI] Damage Modification System 1.02

Damage Modification System

Description
A simple system that makes modifying damage (Critical Strike, Block, Evasion) easy and provides events for when any of those occur.

Requires Bribe's Unit Indexer and Damage Engine (modified)

Note: All spell damage in your map must be triggered. Two temporary variables must be set for the system every time you deal spell damage.

  • Attack/spell damage is detected separately
  • Critical Strike - chance/percent bonus/flat bonus
  • Evasion - chance
  • Block - reduce damage by flat or a percentage
  • Any of these can work for attacks/spells, e.g. you can make an aura that offers evasion against spell damage.
  • Damage display system - floating texts, configurable colours for attack/spell damage, "!" for critical strikes, size can be based on current/max health
  • Configure SFX to be displayed on criticals
  • Events fired on Evasion/Block/Critical for other code usage
  • Conditions are all specified in empty triggers provided by the map, in these triggers you use DamageEventSource/DamageEventTarget/DamageEventAmount to perform any checks you need, e.g. does a unit have a buff, or does a unit have an item, or what is the level of an ability for a unit.

Usage
----------- SPELLS -----------
All spell damage must be triggered, as in the Holy Light Damage example.

The following actions are required:

Set DamageEventType = 1
Set DMGS_Ability = (Ability being cast)
Unit - Cause (Triggering unit) to damage (Target unit of ability being cast), dealing 100.00 damage of attack type Spells and damage type Universal

The first line sets the damage type to SPELL, you can use 0 if you want the spell to be considered an "attack".
The second line sets the ability for usage in other checks, e.g. critical strike.
Then deal the damage.

----------- PASSIVE EFFECTS -----------
In the DMGS Get Critical trigger.
Make an if then else where you check for the ability's conditions, using
DamageEventSource - the unit dealing the damage
DamageEventTarget - the unit taking damage
DamageEventType - if damage is attack (0) or spell (1)
DamageEventAmount - amount of damage being dealt

----------- CRITICAL STRIKE -----------
Modify the damage:
Set DMGS_CriticalChance - the chance of critical strike
Set DMGS_CriticalPercent - the damage as a percent of current damage (1.00 = normal damage, 1.5 = 50% bonus damage)
Set DMGS_CriticalBonus - a flat bonus to be applied

Note: you must use CriticalPercent, otherwise no damage will be dealt. if you just want a flat bonus, set CriticalPercent = 1.00
----------- EVASION -----------
Modify evasion chance. After performing conditions;
Set DMGS_Evasion - the % chance of evading

----------- BLOCK -----------
Modify damage reduction
Set DMGS_Block - flat amount to be deducted from damage
Set DMGS_Reduction - percent of damage lost

----------- ORDER -----------
1. Evasion
2. Damage Reduction - %
3. Damage Block - flat (cannot go below zero)
4. Critical Bonus - flat
5. Critical Percent - %

----------- EVENTS -----------
You can trigger other code when critical/evasion/block happens like this:

Evasion Event Example
Events
Game - DMGS_EvasionEvent becomes Equal to 1.00
Conditions
Actions
Game - Display to (All players) the text: A unit is evading!

Use
DMGS_EvasionEvent becomes Equal to 1.00 - before damage is reduced to 0
DMGS_EvasionEvent becomes Equal to 2.00 - after damage is reduced

Similarly for crit and block:
DMGS_CriticalEvent becomes Equal to 1.00 - before damage increase
DMGS_CriticalEvent becomes Equal to 2.00 - after damage increase

DMGS_BlocklEvent becomes Equal to 1.00 - before damage reduction
DMGS_BlockEvent becomes Equal to 2.00 - after damage reduction

Note that for these events you can still use:

DamageEventSource
DamageEventTarget
DamageEventAmount



Example: Spell damage
  • Holy Light Damage
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Holy Light
    • Actions
      • Set DamageEventType = 1
      • Set DMGS_Ability = (Ability being cast)
      • Unit - Cause (Triggering unit) to damage (Target unit of ability being cast), dealing 100.00 damage of attack type Spells and damage type Universal
Example: Spell critical
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • DamageEventType Equal to 1
      • DMGS_Ability Equal to Holy Light
    • Then - Actions
      • Set DMGS_CriticalChance = 25.00
      • Set DMGS_CriticalPercent = 1.00
      • Set DMGS_CriticalBonus = 50.00
    • Else - Actions
Example: Spell evasion aura
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • DamageEventType Equal to 1
      • (DamageEventTarget has buff Trueshot Aura) Equal to True
    • Then - Actions
      • Set DMGS_Evasion = 50.00
    • Else - Actions
There are more examples in the map.


Triggers

  • DMGS Config
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- -------------------------------------------------------- --------
      • -------- Damage Modification --------
      • -------- -------------------------------------------------------- --------
      • -------- Set the system triggers --------
      • Set DMGS_CalculateBlock = DMGS Get Block <gen>
      • Set DMGS_CalculateCrit = DMGS Get Critical <gen>
      • Set DMGS_CalculateEvasion = DMGS Get Evasion <gen>
      • -------- Set the "reset" ability - this can be anything, but mustnt be something being used in the map --------
      • Set DMGS_ResetAbility = Watery Minion (item)
      • -------- -------------------------------------------------------- --------
      • -------- Display --------
      • -------- -------------------------------------------------------- --------
      • -------- Attack damage colour --------
      • Set DMGS_Colour[0] = |cffff0000
      • -------- Spell damage colour --------
      • Set DMGS_Colour[1] = |cff8000aa
      • -------- Text size change --------
      • Set DMGS_TextSizeIncrease = 1.25
      • Set DMGS_TextSizeDecreaseBase = 0.25
      • -------- Size start min/max --------
      • Set DMGS_SizeMax = 14.00
      • Set DMGS_SizeMin = 3.00
      • -------- How much the CURRENT/MAX health ratio affects the size of the text --------
      • Set DMGS_SizeHealthFactor = 100.00
      • -------- Default text size. If set to zero, size is based on current/max health as above --------
      • -------- If not set to 0, all texts will be this size (excluding critical strike) --------
      • Set DMGS_SizeDefault = 0.00
      • -------- Crit SFX and attach point --------
      • Set DMGS_CritSFX = Objects\Spawnmodels\Critters\Albatross\CritterBloodAlbatross.mdl
      • Set DMGS_CritAttach = chest

  • DMGS CritEvadeBlock
    • Events
      • Game - DamageModifierEvent becomes Equal to 1.00
    • Conditions
    • Actions
      • -------- Get Data --------
      • Trigger - Run DMGS_CalculateEvasion (ignoring conditions)
      • -------- Evasion --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Random percentage) Greater than DMGS_Evasion
        • Then - Actions
          • -------- Critical --------
          • Trigger - Run DMGS_CalculateCrit (ignoring conditions)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Random percentage) Less than or equal to DMGS_CriticalChance
            • Then - Actions
              • Set DMGS_CriticalEvent = 0.00
              • Set DMGS_CriticalEvent = 1.00
              • Set DamageEventAmount = (DamageEventAmount + DMGS_CriticalBonus)
              • Set DamageEventAmount = (DamageEventAmount x DMGS_CriticalPercent)
              • Set DamageEventCritical = True
              • Set DMGS_CriticalEvent = 2.00
            • Else - Actions
          • -------- Block --------
          • Trigger - Run DMGS_CalculateBlock (ignoring conditions)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • DMGS_Block Not equal to 0.00
            • Then - Actions
              • Set DMGS_BlockEvent = 0.00
              • Set DMGS_BlockEvent = 1.00
              • -------- Reduction --------
              • Set DamageEventAmount = (DamageEventAmount - (DamageEventAmount x DMGS_Reduction))
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • DMGS_Block Less than DamageEventAmount
                • Then - Actions
                  • Set DamageEventAmount = (DamageEventAmount - DMGS_Block)
                • Else - Actions
                  • Set DamageEventAmount = 0.00
              • Set DMGS_BlockEvent = 2.00
            • Else - Actions
        • Else - Actions
          • Set DMGS_EvasionEvent = 0.00
          • Set DMGS_EvasionEvent = 1.00
          • -------- Evaded --------
          • Set DamageEventAmount = 0.00
          • Set DMGS_EvasionEvent = 2.00
      • Set DMGS_Evasion = 0.00
      • Set DMGS_Block = 0.00
      • Set DMGS_Reduction = 0.00
      • Set DMGS_CriticalBonus = 0.00
      • Set DMGS_CriticalPercent = 0.00
      • Set DMGS_CriticalChance = 0.00
      • Set DamageEventCriticalOverride = False
      • Set DMGS_Ability = DMGS_ResetAbility

  • DMGS Display
    • Events
      • Game - DamageEvent becomes Equal to 1.00
    • Conditions
      • DamageEventAmount Not equal to 0.00
    • Actions
      • Set DMGS_TextIndex = (DMGS_TextIndex + 1)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • DMGS_SizeDefault Equal to 0.00
        • Then - Actions
          • Set DMGS_Size[DMGS_TextIndex] = (DamageEventAmount / (Life of DamageEventTarget))
          • Set DMGS_Size[DMGS_TextIndex] = (DMGS_Size[DMGS_TextIndex] x DMGS_SizeHealthFactor)
        • Else - Actions
          • Set DMGS_Size[DMGS_TextIndex] = DMGS_SizeDefault
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • DMGS_Size[DMGS_TextIndex] Less than DMGS_SizeMin
        • Then - Actions
          • Set DMGS_Size[DMGS_TextIndex] = DMGS_SizeMin
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • DMGS_Size[DMGS_TextIndex] Greater than DMGS_SizeMax
            • Then - Actions
              • Set DMGS_Size[DMGS_TextIndex] = DMGS_SizeMax
            • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • DamageEventCritical Equal to True
        • Then - Actions
          • Set DMGS_Text[DMGS_TextIndex] = (DMGS_Colour[DamageEventType] + ((String((Integer(DamageEventAmount)))) + !))
          • Set DMGS_Size[DMGS_TextIndex] = (DMGS_Size[DMGS_TextIndex] x 1.25)
          • Special Effect - Create a special effect attached to the DMGS_CritAttach of DamageEventTarget using DMGS_CritSFX
          • Special Effect - Destroy (Last created special effect)
        • Else - Actions
          • Set DMGS_Text[DMGS_TextIndex] = (DMGS_Colour[DamageEventType] + ((String((Integer(DamageEventAmount)))) + <Empty String>))
      • Floating Text - Create floating text that reads DMGS_Text[DMGS_TextIndex] above DamageEventTarget with Z offset 0.00, using font size DMGS_Size[DMGS_TextIndex], color (100.00%, 100.00%, 100.00%), and 0.00% transparency
      • Set DMGS_Floater[DMGS_TextIndex] = (Last created floating text)
      • Set DMGS_Phase[DMGS_TextIndex] = 40
      • Set DMGS_TextSizeDecrease[DMGS_TextIndex] = DMGS_TextSizeDecreaseBase
      • Floating Text - Set the velocity of (Last created floating text) to 64.00 towards (Random real number between 75.00 and 105.00) degrees
      • Set DamageEventCritical = False
      • Set DamageEventType = 0
  • DMGS Evasion Text
    • Events
      • Game - DMGS_EvasionEvent becomes Equal to 1.00
    • Conditions
    • Actions
      • Set DMGS_TextIndex = (DMGS_TextIndex + 1)
      • Set DMGS_Size[DMGS_TextIndex] = 6.00
      • Set DMGS_Text[DMGS_TextIndex] = dodged!
      • Floating Text - Create floating text that reads DMGS_Text[DMGS_TextIndex] above DamageEventTarget with Z offset 0.00, using font size DMGS_Size[DMGS_TextIndex], color (100.00%, 100.00%, 100.00%), and 0.00% transparency
      • Set DMGS_Floater[DMGS_TextIndex] = (Last created floating text)
      • Set DMGS_Phase[DMGS_TextIndex] = 40
      • Set DMGS_TextSizeDecrease[DMGS_TextIndex] = DMGS_TextSizeDecreaseBase
      • Floating Text - Set the velocity of (Last created floating text) to 64.00 towards (Random real number between 75.00 and 105.00) degrees
  • DMGS Loop
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • For each (Integer LoopA) from 1 to DMGS_TextIndex, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • DMGS_Phase[LoopA] Greater than or equal to 35
            • Then - Actions
              • -------- Phase 1: text size increases --------
              • Set DMGS_Size[LoopA] = (DMGS_Size[LoopA] + DMGS_TextSizeIncrease)
            • Else - Actions
              • -------- Phase 2: text size decreases --------
              • Set DMGS_Size[LoopA] = (DMGS_Size[LoopA] - DMGS_TextSizeDecrease[LoopA])
              • Set DMGS_TextSizeDecrease[LoopA] = (DMGS_TextSizeDecrease[LoopA] + 0.05)
          • Floating Text - Change text of DMGS_Floater[LoopA] to DMGS_Text[LoopA] using font size DMGS_Size[LoopA]
          • Set DMGS_Phase[LoopA] = (DMGS_Phase[LoopA] - 1)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • DMGS_Size[LoopA] Less than or equal to 0.00
            • Then - Actions
              • Floating Text - Destroy DMGS_Floater[LoopA]
              • -------- destroy: re-sort all float texts --------
              • For each (Integer LoopB) from LoopA to DMGS_TextIndex, do (Actions)
                • Loop - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • LoopB Not equal to DMGS_TextIndex
                    • Then - Actions
                      • Set DMGS_Floater[LoopB] = DMGS_Floater[(LoopB + 1)]
                      • Set DMGS_Phase[LoopB] = DMGS_Phase[(LoopB + 1)]
                      • Set DMGS_Size[LoopB] = DMGS_Size[(LoopB + 1)]
                      • Set DMGS_Text[LoopB] = DMGS_Text[(LoopB + 1)]
                      • Set DMGS_TextSizeDecrease[LoopB] = DMGS_TextSizeDecrease[(LoopB + 1)]
                    • Else - Actions
              • Set DMGS_TextIndex = (DMGS_TextIndex - 1)
            • Else - Actions


Credits
Bribe - Unit Indexer and Damage Engine

Changelog
1.02
  • Fixed block reduction only being applied if flat block is non-zero
1.01
  • Re-ordered critical strike to be calculated before block.

Keywords:
damage, damage event, critical strike, evasion, critical, dodge, block, reduce, damage block, block, damage system, damage display, show damage
Contents

Damage Modification System 1.02 (Map)

Reviews
Reviewed by Maker APPROVED I can see how this could be useful. The floating texts should be only visible for players that can see the unit.

Moderator

M

Moderator

Damage Modification System 1.01, 13th Feb 2012

Reviewed by Maker

APPROVED

I can see how this could be useful. The floating texts should be only visible for
players that can see the unit.
 
Level 14
Joined
Aug 8, 2010
Messages
1,022
Here is what happened :
I downloaded the system without seeing who made it. The way how floating text bounces made my day. I closed the system. Then i scrolled up (from the download button) and saw the dope description. Then i said to myself - this must be defskull or rulerofiron... there was no "Simple" in the name of the system, so i knew it was rulerofiron.
AND I WAS RIGHT. :grin:
Dope system, bro! I don't even need to look at the code because i know it's right (and because of laziness).

+rep (after i spread some)
 
Level 25
Joined
Jul 10, 2006
Messages
3,315
Here is what happened :
I downloaded the system without seeing who made it. The way how floating text bounces made my day. I closed the system. Then i scrolled up (from the download button) and saw the dope description. Then i said to myself - this must be defskull or rulerofiron... there was no "Simple" in the name of the system, so i knew it was rulerofiron.
AND I WAS RIGHT. :grin:
Dope system, bro! I don't even need to look at the code because i know it's right (and because of laziness).

+rep (after i spread some)

Glad you like it :D

I actually started the system for another project just for the floating text, then I realised I'd need a better damage modification system, and here we are.
 
Level 23
Joined
Apr 16, 2012
Messages
4,041
I love how the floating text jump off the units :D
also the system is quite good but the biggest minus of this system is that you have to trigger even the most basic spells
nevertheless its great system, seems like leakless but I didnt check all of it :D 4/5 for me (the golden reserve must be there :D)
 
Level 3
Joined
Jun 13, 2010
Messages
43
Great work one after another system made in gui but i would say this is one of the useful ones for map makers to improve their visual game play.

I think you might want to add evasion sfx since u did for critical. And last hit kills damage text fade in different variation.
 
Level 25
Joined
Jul 10, 2006
Messages
3,315
Yes, the ghosts of Hope'thalas cryed once more for me.This system is potentially (didn't test it yet) for my map.More rep coming after spreading.

edit:perfect system.I just hope there are no errors/leaks.I have no idea how to know that.+rep

Thanks :)

Bribe's Damage engine does most of the work, though. This system is just an easy "management" interface.
 
Level 8
Joined
Apr 23, 2011
Messages
323
Hmmmm...There is no % for block?I am currently using
  • (Random integer number between 1 and 100) Less than or equal to 30
(30% for block if I am right?)
There is a problem using this since if I make multiple "random integer number" with different %, sometimes more than 1 block will trigger, which I don't want to happen.
  • Test
    • Events
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • DamageEventType Equal to 0
          • (Unit-type of DamageEventTarget) Equal to Footman
          • (Random integer number between 1 and 100) Less than or equal to 3
        • Then - Actions
          • Set DMGS_Block = 3.00
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • DamageEventType Equal to 0
          • (Unit-type of DamageEventTarget) Equal to Footman
          • (Random integer number between 1 and 100) Less than or equal to 16
        • Then - Actions
          • Set DMGS_Block = 7.00
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • DamageEventType Equal to 0
          • (Unit-type of DamageEventTarget) Equal to Footman
          • (Random integer number between 1 and 100) Less than or equal to 7
        • Then - Actions
          • Set DMGS_Block = 4.00
        • Else - Actions
How to prevent them from activating at the same time?Random number is 2=all 3 blocks activate
 
Level 24
Joined
Feb 9, 2009
Messages
1,786
Another would be adding two different blocks:
Xblockspell = 100 damage block
Yblockspell = 50 damage block

Incoming damage 75

Damage will be 25

I did this by changing the paladin's flat reduction from ten to one hundred (as well as the damage type to spell) and the priest's inner fire spell block to fifty.

----------------------------------------------------------------------------------

Also how would I go about detecting zero damage?
I Tried making a two part spell by using acid bomb with no damage and a 0.16 second buff. Then the trigger could just detect the buff and remove it and cause a dummy to cast another spell, but so far no results.
 
Last edited:
Level 25
Joined
Jul 10, 2006
Messages
3,315
Also how would I go about detecting zero damage?
I Tried making a two part spell by using acid bomb with no damage and a 0.16 second buff. Then the trigger could just detect the buff and remove it and cause a dummy to cast another spell, but so far no results.

That's brilliant.

You can detect the value of DamageEventAmount using the DamageModifyEvent, and then check for buffs.

Acid Bomb is especially neat because you can set the damage to only be dealt after a small delay, to be sure that the buff is applied before the damage.
 
Level 24
Joined
Feb 9, 2009
Messages
1,786
did you fix the block problem I mention before?
Another would be adding two different blocks:
Xblockspell = 100 damage block
Yblockspell = 50 damage block

Incoming damage 75

Damage will be 25

I did this by changing the paladin's flat reduction from ten to one hundred (as well as the damage type to spell) and the priest's inner fire spell block to fifty.
---------------------------------------------------------------------------------------------
That's brilliant.

You can detect the value of DamageEventAmount using the DamageModifyEvent, and then check for buffs.

Acid Bomb is especially neat because you can set the damage to only be dealt after a small delay, to be sure that the buff is applied before the damage.

Scratch that, twas a buff mistake on the object editor; but, I found a knot, when trying to detect zero damage through the DamageEvent equal to 2.00, if the target is currently taking damage it will be ignored whether or not you have the DamageEventoveride set to true.
 
Last edited:
Level 25
Joined
Jul 10, 2006
Messages
3,315
did you fix the block problem I mention before?

---------------------------------------------------------------------------------------------


Scratch that, twas a buff mistake on the object editor; but, I found a knot, when trying to detect zero damage through the DamageEvent equal to 2.00, if the target is currently taking damage it will be ignored whether or not you have the DamageEventoveride set to true.

Err, I'll have to take a look at the blocking again.

Thanks for mentioning the override, I'll take a look at that as well.
 
Level 12
Joined
Jul 2, 2008
Messages
1,183
I want to use this system to create an ability similar to Hardened Skin. Is there a way to set a minimum damage value? For example my unit deals 27 damage, the reduction will be flat 25 but the minimum value is 10 so the units still deals 10 damage to the unit with the hardened skin ability.

EDIT: I figured it out sry for disturbing you
 
Last edited:
Level 6
Joined
Jan 2, 2015
Messages
171
The reduction only working when:
1. Must be in -------- Paladin passive spell reduction -------- section. ( Other than that it wont work!)
2. Damage type must be 0 but it also reduce damage taken from spell (both physical damage and spell reduced) while Damage taken from Damage type 1 is not reduced.
 

Attachments

  • DamageModificationSystem102Test.w3x
    38.8 KB · Views: 70
Level 25
Joined
Jul 10, 2006
Messages
3,315
Working fine on my end.

Note the way you initially had the example trigger setup:
Both the Devotion Aura and the Paladin Passive sections adjusted the DMGS_Reduction variable, so even if the first one checks (Devotion Aura), if the second one (Paladin) also checks then the value for DMGS_Reduction is overwritten.

I noticed that you added Frost Nova; but you haven't configured it for the system.
The big drawback of this system is that you must trigger all spell damage in your map, as you can see I've done in the Holy Light Damage trigger.
 
Level 4
Joined
Nov 25, 2013
Messages
132
This system looks really usefull but can you stack crit rate and crit damage by using this system? For example a hero has item1(5% crit chance) and item2(15% crit chance) then CritChance will be 20%?
 
Level 1
Joined
Mar 20, 2020
Messages
4
umm... sorry? Why does not working damage text show to netral hostile?..
 

Attachments

  • DamageModificationSystemYYYYYY.w3x
    39.6 KB · Views: 72
Level 1
Joined
Mar 20, 2020
Messages
4
wow thx!! but Where to manage floating text?? i cant find

It's such a complete system, but I just want to change the text color depending on the player.

I am Korean and I am always getting a lot of help here. Always thank you.
 
Top