Detecting Spell Damage

Sil3nt

SUP?
Reaction score
134
Part of my spell involves blocking damage taken from both attacks and spells. The only way i could think of doing this is by adding the spell damage taken back to the units hp. What condition would i use? I tried Damage Taken but i think that only works for normal attacks. Im basically adding the damage taken into a integer variable and then using a periodic trigger to detect the damage taken.

Also is there any other way to completely block out spell/physical damage other than what im doing? Thx for reading.

edit - For those who play DotA it has a similar effect to Lord of Avernus' shield.
If i was to use a modified spell reduction/defend/magic resist/etc is the damage taken considered as 0?
 

darkRae

Ueki Fan (Ueki is watching you)
Reaction score
173
> I tried Damage Taken but i think that only works for normal attacks.

No, it works for spells too.
Any damage counts.

You can just detect the Taken Damage while your ability is active, then store it to a Real variable and add it to your unit's HP.
 

Tom Jones

N/A
Reaction score
437
My guess is that they used attack detection and then damage detection in dota, it goes something like this:
Code:
Attack Detection
    Events
        Unit - A unit Is attacked
    Conditions
        //I would check if the unit attacked has the ability here.
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                ((Triggering unit) is in Detected_Units) Equal to False
            Then - Actions
            Else - Actions
                Unit Group - Add (Triggering unit) to Detected_Units
                Trigger - Add to Damage Detection <gen> the event (Unit - (Triggering unit) Takes damage)
Code:
Damage Detection
    Events
    Conditions
        //You should check for the abilities buff here.
    Actions
        Unit - Set life of (Triggering unit) to ((Life of (Triggering unit)) + (Damage taken))
 

vypur85

Hibernate
Reaction score
803
Hmm.. There is a weakness in damage taken event I think. If the unit's hp is 500 and the spell deals more than 500 damage, the unit will still die. I've tested it before once (not too sure though). But if you use magic reduction spell like Elune's Grace (forgot the name) or physical damage reduction spell like Defend and Berserk, the killing damage can be avoided (as if the unit is not damaged at all). So I presume LOA's ability has Elune's Grace added when the ability is activated?

Edit: Damn it. What I've suggested is for LOA's ultimate.... Not Shield =.=... Sorry for the misunderstanding.
 

Sil3nt

SUP?
Reaction score
134
> I tried Damage Taken but i think that only works for normal attacks.

No, it works for spells too.
Any damage counts.

You can just detect the Taken Damage while your ability is active, then store it to a Real variable and add it to your unit's HP.
Thx but what would the event for spells be? Does Unit is attacked work for both spells and physical?

I also just tried this trigger
Code:
Frozen Wall Dmg
    Events
        Unit - A unit Is attacked
    Conditions
        (Attacked unit) Equal to FWTarget
    Actions
        Unit - Set life of FWTarget to ((Life of FWTarget) + (Damage taken))
        Set FWDmgTaken = (FWDmgTaken + (Integer((Damage taken))))
        Game - Display to (All players) the text: (String(FWDmgTaken))
The event must be working since it does show messages but it keeps repeating 0 so im assumnig the damage taken condition isnt working for some reason. And yes i checked all variables
My guess is that they used attack detection and then damage detection in dota, it goes something like this:
Code:
Attack Detection
    Events
        Unit - A unit Is attacked
    Conditions
        //I would check if the unit attacked has the ability here.
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                ((Triggering unit) is in Detected_Units) Equal to False
            Then - Actions
            Else - Actions
                Unit Group - Add (Triggering unit) to Detected_Units
                Trigger - Add to Damage Detection <gen> the event (Unit - (Triggering unit) Takes damage)
Code:
Damage Detection
    Events
    Conditions
        //You should check for the abilities buff here.
    Actions
        Unit - Set life of (Triggering unit) to ((Life of (Triggering unit)) + (Damage taken))
Wow after looking for a few minutes i just learnt that theres an event like that. So whats the point of all those damage detection systems then? lol edit[omg too specific ...]
Hmm.. There is a weakness in damage taken event I think. If the unit's hp is 500 and the spell deals more than 500 damage, the unit will still die. I've tested it before once (not too sure though). But if you use magic reduction spell like Elune's Grace (forgot the name) or physical damage reduction spell like Defend and Berserk, the killing damage can be avoided (as if the unit is not damaged at all). So I presume LOA's ability has Elune's Grace added when the ability is activated?

Edit: Damn it. What I've suggested is for LOA's ultimate.... Not Shield =.=... Sorry for the misunderstanding.
Actually i forgot about his ulti. That wouldve made a much more better example because the should prevent the damage. Im just doing it this way because it was the first thing that came in mind.
 

Drunken_God

Hopes to get back into Mapmaking with SC2 :)
Reaction score
106
did you ever make the shield + the ult at the same time as LoA ? (its healing you)
 

Cohadar

master of fugue
Reaction score
209
There is a passive manashield ability in Pyramidal Defence that does not "leak" damage.

You can request for code here
 

Tom_Kazansky

--- wraith it ! ---
Reaction score
157
>did you ever make the shield + the ult at the same time as LoA ? (its healing you)
because they use Set Life, and when the shield+ulti, the LoA's life will be set twice and he get healing.

>If the unit's hp is 500 and the spell deals more than 500 damage, the unit will still die

yeah,but remember, when the Unit Damaged event occurs, the unit doesn't lose life yet you can add a life bonus ability for this unit and set life, it will not die (as long as the damage deal is less than the life bonus+max life of this unit, I refer it to the Culling Blade (ulti of Axe in DotA) I think the damage is 99999999, lol)

I have attached the Energy Shield spell of the_Immortal below.
If you set the cooldown of this spell to 0 and cast it twice, the Paladin will get healing, but if the maximum life of the Paladin is 1 he will die (because the_Immortal didn't add life bonus ability)
 

Attachments

  • Energy Shield.w3x
    21.9 KB · Views: 130

darkRae

Ueki Fan (Ueki is watching you)
Reaction score
173
> when the Unit Damaged event occurs, the unit doesn't lose life yet

Wrong.
Because it takes damage, so it has lost its HP.

> but what would the event for spells be?

'Unit Takes Damage'
 

Tom_Kazansky

--- wraith it ! ---
Reaction score
157
>Wrong. Because it takes damage, so it has lost its HP.
have you tested it, that unit's life doesn't lose life until the next 0.0s timer (when this event occurs, display life of this unit and start a 0.0s timer, when the timer expired, check life of this unit again - or you can use TriggerSleepAction(0.0) )
EDIT: oh, Cohadar correct it for me, :D
 

Sil3nt

SUP?
Reaction score
134
> when the Unit Damaged event occurs, the unit doesn't lose life yet

Wrong.
Because it takes damage, so it has lost its HP.

> but what would the event for spells be?

'Unit Takes Damage'

When i use the specific event it doesnt work, it asks for a specific unit thats already on the map. Variables also cant be chosen
Ive also found out how to block damage completely (Hardened Skin//unit ability and Spell damage redution//item ability) and add those to disabled spellbook

So all i need is a trigger that adds up the damage taken so that it can remove the spellbook once it reaches a certain limit
 

Cohadar

master of fugue
Reaction score
209
It is not as simple as it sounds, you will have to use jass.
And also use some attachment system.
 

Chjoodge

New Member
Reaction score
14
When i use the specific event it doesnt work, it asks for a specific unit thats already on the map. Variables also cant be chosen
That is why Tom Jones gave you this:
Code:
Trigger - Add to Damage Detection <gen> the event (Unit - (Triggering unit) Takes damage)
 

Sil3nt

SUP?
Reaction score
134
Ahh i got it now, except the damage taken is now 0 .. stupid spellbook.. dw ill think of something thanks to those who helped
 

darkRae

Ueki Fan (Ueki is watching you)
Reaction score
173
You can add the Casting Unit / Triggering Unit to the event for another trigger with the event 'Casting Unit (Triggering Unit) Takes Damage'

@my stupid mistake
Aw damn.
Strange logic >_>
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    New recipe is another summer dessert Berry and Peach Cheesecake - https://www.thehelper.net/threads/recipe-berry-and-peach-cheesecake.194169/

      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