• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Questions about damage detection

Status
Not open for further replies.
Level 7
Joined
Apr 5, 2011
Messages
245
Since I have no PC but want to take a thought before, there are:
1. Does unit takes damage event detect negative damage?
2. Are there normal ways to identify spell damage upon unit takes damage event?
3. If (1) is YES and (2) is NO, is it adequate if I make all spell damage negative to detect it and inverse sign upon unit takes damage event with my damage engine?
 
Level 17
Joined
Feb 11, 2011
Messages
1,860
Are you talking about the normal Warcraft 3 damage detection or about systems that people have made?
1. I would imagine it does.
2. No, only with the use of an advanced damage detection system. It will most likely require ALL spell damage to be triggered.
3. Not sure, sorry.
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
There are several methods, but all of them have flaws. I believe the most common method is with an orb ability. This ability applies a 0.01-second buff on the target when hit, thus if the target has that buff, it is probably a physical attack.
The flaw is that, I believe, those buffs collide with others (maybe poison arrow will work, but I cannot say for sure)

3) My brain says no, but I don't know what Warcraft's going to say :p
The reason is that, say the unit has 100% HP, the detected damage will be 0. It cannot receive any negative damage anymore. (-2 * 0) = 0, so spells won't do any damage at all.
Even if the unit has, say, 800/1000 HP. If you use a spell with 300 damage (-300), it will only do 200 because of that max HP limit.


Triggering all spells is actually the easiest method to differentiate between physical and magical damage with 100% accuracy.
 
Level 7
Joined
Apr 5, 2011
Messages
245
I tested it.) I made Chain Lightning with negative damage = no detection. Heal but not detected.) Only >= 0. But then I reset it and make magic reduction of Elune's Grace = -1 and give it to Robe of the Magi. And yeah, odd number of Robe = heal, even = damage. Both damage is detected, with correct numbers. The single wrong is the sign.)

Screenshot of Bladestorm with my damage engine.

What do you think, guys? Should I use it for spell damage detection?

Offtopic: what ability is better to use for magic resistance item? (Planewalker's Cloak)
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
Hm, I tested it myself and came across 1 flaw in that system (aside from that, it's actually pretty sweet as far as I've seen).
My unit had 1000 HP left and I cast a spell that did 500 damage (-500 in the object editor).
Since the unit heals every spell, I need to do double damage (1000 damage), so the outcome would be correct.
The problem is that it deals damage first, and then heals the target. So a 500 damage-spell would kill a 1000 HP-unit.

A very simple workaround would be to use 1/100th of the actual damage (like -5.00 instead of -500) and then multiplying the damage by -101. (This still has that flaw, but it's less obvious).
Another workaround can be achieved by adding a DOT on the target, one that ends in 0.01 seconds.
Maybe you know of something else? :)


For magic resistance, I'd use the "Spell Damage Reduction"-ability.
 
Level 7
Joined
Apr 5, 2011
Messages
245
You can add "survival ability" before damage is dealt and remove after. "Unit takes damage" event is before, timer expired 0.0 - right after that. "Survival ability" is just a huge hp boost to prevent death. You just remember hp before and set (old_hp - damage) for hp after.
If you don't want to use damage engine, it's hard to do. There may be several damage sources at one moment and if you left 1 hp from one, second may kill him. So, that ^ manipulations aren't safe.
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
You're right about the 1/100th of the actual spell damage, but I already knew that (I just said it was a very simple solution).
But adding/removing HP after a short time span is pretty much the same solution as dealing damage after a short time span (it's actually exactly the same idea).

I think my option of the DOT would be as safe as your option to increase HP.
The reason being that you do not deal damage until after the unit received the heal (negative damage). If the unit dies right after that (due to the DOT), then it is rightly so.
 
1. I would imagine it does.
2. No, only with the use of an advanced damage detection system. It will most likely require ALL spell damage to be triggered.
3. Not sure, sorry.
2. Hmm, this or using Orb Effects. Every unit as a basic orb effect which does nothing except applying a buff. Now in your Damage Detection trigger, you check if the unit has this buff, if yes, the damages were done by an attack and you remove the buff, if no, the damages were done by a spell.
You can also put an orb effect for unit and another one for heroes to do a difference between them.
The only problem of that, is that every "orb effect" abilities will need to be triggered.
 
Level 7
Joined
Apr 5, 2011
Messages
245
^That is a bad way. At first, it is inefficient. At second, it does not give sharp information if damage source is multiple: one buff - many sources.
My solution is better. This:
1. Index every unit and give him spellbook with Elune's Grace (-1 magic resistance koef).
2. Disable spellbook for all players.
3. Check negative damage and inverse sign.
Easy.
 
^That is a bad way. At first, it is inefficient. At second, it does not give sharp information if damage source is multiple: one buff - many sources.
My solution is better. This:
1. Index every unit and give him spellbook with Elune's Grace (-1 magic resistance koef).
2. Disable spellbook for all players.
3. Check negative damage and inverse sign.
Easy.
You should avoid negative damages. Use instead real heals (so, you set the current life of unit to current life of unit + amount of hp healed)

One specific buff = Comes from a normal attack.
 
Level 7
Joined
Apr 5, 2011
Messages
245
You should avoid negative damages.
No, I should not. It's a part of the system, it's a solution.
Use instead real heals (so, you set the current life of unit to current life of unit + amount of hp healed)
Heal does not fire damage event.
One specific buff = Comes from a normal attack.
No, it does not. Buff is single, but source is multiple. (ex.: Rifleman (physical) and Gryphon (magic) damages the same time) Buff => normal attack by your logics, but some of them may be magic => gryphon's damage was determined as physical.
 
Status
Not open for further replies.
Top