System Physical damage detection

Flare

Stops copies me!
Reaction score
662
This is a system I put together for my own use a while ago to allow me to differentiate between physical attack damage and spell damage. Currently, the demo map only uses a custom Critical Strike (random amount of extra damage between 0% and 100% more damage). It requires an orb effect ability[del], but I will be adding a replacement for every orb effect ability I can think of (and replace in some way).[/del]

Since this uses an orb effect ability, do -NOT- add any ability such as Slow Poison, Orb of Frost, Orb of Fire, Mask of Death and so on. These abilities (and others) will conflict with the used orb effect and render this pretty much useless.

One of the only flaws (other than use of orb effects, but that can be overcome :p) is the fact that it can't detect physical ability damage (such as Kaboom).

If you have any requests for additions, please let me know.

Importing this:
Code:
Copy the DD detector 2 ability, both the DD detect 2 buffs, and the Damage detector spellbook abilities/buffs into your map.

In File -> Preferences, make sure that "Automatically create unknown variables when pasting trigger data" is checked

Copy the All damage, Spell damage and Physical damage triggers into your map

Copy the Damage detection init 1 and 2 triggers into your map

Now, add your own set of actions to All damage, Spell damage and Physical damage (if necessary)

Screenshot of the custom Critical Strike (SFX was just to show that the effect occured :p)
-NOTICE: Very large image
ae8y83.png


Code involved
Code:
Damage detection init 1
    Events
        Map initialization
    Conditions
    Actions
        Set TempGroupA = (Units in (Playable map area))
        Unit Group - Pick every unit in TempGroupA and do (Actions)
            Loop - Actions
                Unit - Add Damage detection spellbook  to (Picked unit)
                Trigger - Add to All damage <gen> the event (Unit - (Picked unit) Takes damage)
                Trigger - Add to Physical damage <gen> the event (Unit - (Picked unit) Takes damage)
                Trigger - Add to Spell damage <gen> the event (Unit - (Picked unit) Takes damage)


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

Damage detection init 2
    Events
        Unit - A unit enters (Playable map area)
    Conditions
    Actions
        Unit Group - Add (Triggering unit) to TempGroupB
        Unit Group - Remove all units of TempGroupA from TempGroupB
        Unit Group - Pick every unit in TempGroupB and do (Actions)
            Loop - Actions
                Unit - Add Damage detection spellbook  to (Picked unit)
                Trigger - Add to All damage <gen> the event (Unit - (Picked unit) Takes damage)
                Trigger - Add to Physical damage <gen> the event (Unit - (Picked unit) Takes damage)
                Trigger - Add to Spell damage <gen> the event (Unit - (Picked unit) Takes damage)
                Unit Group - Add (Picked unit) to TempGroupA
                Unit Group - Remove (Picked unit) from TempGroupB


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

Physical damage
    Events
    Conditions
        (Damage taken) Greater than 0.00
        Or - Any (Conditions) are true
            Conditions
                ((Triggering unit) has buff DD detect 2 non-stacking (Non-stacking)) Equal to True
                ((Triggering unit) has buff DD detect 2 stacking (Stacking)) Equal to True
    Actions
        -------- This will be used for custom attack modifiers, physical damage block etc --------
        -------- ALL damage actions go between these 2 actions (Turn Off and Turn On trigger) --------
        Trigger - Turn off All damage <gen>
        Trigger - Turn off (This trigger)
        -------- Random Critical Strike --------
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Level of Critical Strike for (Damage source)) Greater than 0
                (Random real number between 0.00 and 100.00) Less than or equal to 100.00
            Then - Actions
                Set Multiplier = (Random real number between 0.00 and 1.00)
                Unit - Cause (Damage source) to damage (Triggering unit), dealing (Multiplier x (Damage taken)) damage of attack type Hero and damage type Normal
                Special Effect - Create a special effect attached to the origin of (Triggering unit) using Abilities\Spells\Other\Incinerate\FireLordDeathExplode.mdl
                -------- Multiplier value --------
                Floating Text - Create floating text that reads ((Substring((String((1.00 + Multiplier))), 1, ((Length of (String((1.00 + Multiplier)))) - 1))) + x) above (Damage source) with Z offset 0.00, using font size 11.00, color (60.00%, 60.00%, 60.00%), and 0.00% transparency
                Floating Text - Change (Last created floating text): Disable permanence
                Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
                Floating Text - Change the lifespan of (Last created floating text) to 3.00 seconds
                Floating Text - Change the fading age of (Last created floating text) to 1.00 seconds
                -------- Total damage dealt. --------
                Floating Text - Create floating text that reads ((String((Integer(((1.00 + Multiplier) x (Damage taken)))))) + !) above (Triggering unit) with Z offset 0.00, using font size 11.00, color (100.00%, 0.00%, 0.00%), and 0.00% transparency
                Floating Text - Change (Last created floating text): Disable permanence
                Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
                Floating Text - Change the lifespan of (Last created floating text) to 3.00 seconds
                Floating Text - Change the fading age of (Last created floating text) to 1.00 seconds
            Else - Actions
        Trigger - Turn on (This trigger)
        Trigger - Turn on All damage <gen>
        Unit - Remove DD detect 2 non-stacking (Non-stacking) buff from (Triggering unit)
        Unit - Remove DD detect 2 stacking (Stacking) buff from (Triggering unit)


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

Spell damage
    Events
    Conditions
        (Damage taken) Greater than 0.00
        And - All (Conditions) are true
            Conditions
                ((Triggering unit) has buff DD detect 2 non-stacking (Non-stacking)) Equal to False
                ((Triggering unit) has buff DD detect 2 stacking (Stacking)) Equal to False
    Actions
        -------- This will be used for custom spell modifiers, spell damage block etc --------
        -------- ALL damage actions go between these 2 actions (Turn Off and Turn On trigger) --------
        Trigger - Turn off All damage <gen>
        Trigger - Turn off (This trigger)
        Trigger - Turn on (This trigger)
        Trigger - Turn on All damage <gen>


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

All damage
    Events
    Conditions
    Actions
        -------- This will be used for recording any damage taken by units, universal damage block etc --------
        -------- ALL damage actions go between these 2 actions (Turn Off and Turn On trigger) --------
        Trigger - Turn off (This trigger)
        Trigger - Turn on (This trigger)

Planned additions (will get some done over the weekend)
Code:
Slow Poison replacement using Slow and some DPS ability, more customizable than your average Slow Poison
Lifesteal orb effect, more customizable though
Orb of Frost orb effect, more customizable again
(Possibly) Orb of Lightning orb effect
Evasion
Magic damage reduction
Magic damage amplification
 

Attachments

  • dd system v1.w3x
    42.3 KB · Views: 358

Flare

Stops copies me!
Reaction score
662
what exactly do you mean? it should work for every spell (obviously, itd be hard to test EVERY possible spell). if the spell doesnt apply the slow poison buff(s), its counted as spell damage. otherwise, itll be counted as physical damage.

basically: dont add the DD detect 2 buffs to any spells and it should be fine (my previous tests definitely showed that spells were triggering the spell damage trigger, and that physical attacks were triggering the physical damage trigger so it has to be working properly)
 

PurgeandFire

zxcvmkgdfg
Reaction score
508
Oh ok... Sorry, it just wasn't clear to me. :)

Anyway, good code. I thought of doing a system like this before, but I never thought of how to differentiate the regular vs. spells.
 

Flare

Stops copies me!
Reaction score
662
its a fairly simple method if you dont count the fact that you've limited yourself to either (a) no orb effects or (b) trigger all orb effects.

also, let me know if you think the init trigger 2 doesnt look like it should do what its supposed to (prevent double-addition of events primarily). im fairly sure my method of avoiding that works, id just like to guarantee it though
 

Flare

Stops copies me!
Reaction score
662
Might test it soon! :p

6(?) months late :p I'm planning on remaking this in JASS anyway (because it's pretty restricting using 3 very specific detection triggers, and bulky as regards importing), and adding in all those intended things though (i.e. orb effects, damage block/evade, and reduction/amplifications)
 

Bloodcount

Starcraft II Moderator
Reaction score
297
Hm.. doesn't work for me.The only dmg sholn is from the critical strice.bash Nor chainlightning work....any ideas?
 

Tukki

is Skeleton Pirate.
Reaction score
29
Well, this is neat.

The only problem is that it leaks, events. That's why people like Rising_Dusk made a whole library for damage detection.

Just to explain;
When you register a unit with the system you add 1 event to X number of triggers. Then when the unit dies the trigger is still there, to no use and still consuming some space.
 

Flare

Stops copies me!
Reaction score
662
Hm.. doesn't work for me.The only dmg sholn is from the critical strice.bash Nor chainlightning work....any ideas?
That Critical Strike was just an example (I could've made an example of a triggered Bash that uses is, but I didn't :p)
Well, this is neat.

The only problem is that it leaks, events. That's why people like Rising_Dusk made a whole library for damage detection.

Just to explain;
When you register a unit with the system you add 1 event to X number of triggers. Then when the unit dies the trigger is still there, to no use and still consuming some space.
Well, there's not much you can do to avoid wasted events, unless you want to create/destroy triggers for each unit that enters/leaves the map, so it's a case of which is the greater evil (since a trigger per unit is probably gonna be far more memory-consuming than an event, and you have issues with dynamic triggers causing bugs, AFAIK)
 

Flare

Stops copies me!
Reaction score
662
You don't even see the impact when a trigger has 10000 event or 1 event in game.

For more possibilities (block/evasion/all blabla) you can use http://www.thehelper.net/forums/showthread.php?t=40355

I had planned on adding all that stuff, but I just got lazy and didn't bother and, to be honest, you can do all the orb effects with 2 WC3 skills (multi-levelled Acid Bomb, each level caters for a separate orb, and Frost Nova), a dummy caster, and you can trigger Lifesteal/Orb of Lightning(Slow)
 

Flare

Stops copies me!
Reaction score
662
So... I have to trigger evrything in order to show the spell dmg?

You could just do (in Spell Damage, if you only want spell damage to be displayed)
Code:
Create floating text above (Triggering Unit) with the message ((Integer 2 String (Real 2 Integer (Event Response - Damage Taken))) ...
Set last created floating text permanence: Disable
Set lifespan...
Set fade point...
Set velocity...
And you'd have a fairly simple damage display
 

Tom_Kazansky

--- wraith it ! ---
Reaction score
157
Flare, I think you should change the name of this system to "Attack Detection"

Because spell damage could be physical, and attack could deal magical damage, too. For example: Searing Arrow, do you think the added damage is magical ?

And with the "Planned additions", what does "on struck" abilitie sound ? that's a chance to cast some spells when the unit got hit by an attack.
 

Chocobo

White-Flower
Reaction score
409
Flare, I think you should change the name of this system to "Attack Detection"

Because spell damage could be physical, and attack could deal magical damage, too. For example: Searing Arrow, do you think the added damage is magical ?

>Since this uses an orb effect ability, do -NOT- add any ability such as Slow Poison, Orb of Frost, Orb of Fire, Mask of Death and so on. These abilities (and others) will conflict with the used orb effect and render this pretty much useless.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top