| 05-18-2006, 07:31 AM | #1 |
Is there a way to detect (in the specific unit event "unit takes damage") which type of damage is received (physical, magic etc...)? I saw that there are variables for damage type, but no idea how to use them. Thanks. |
| 05-18-2006, 08:12 AM | #2 |
Sadly, no. |
| 05-25-2006, 04:38 PM | #3 |
Is there at least a way to detect if the attack was caused by an "attack" or by something else (spells and triggers, according to Vexorian)? I can use the specific unit events (my units are in the map), so the damage detection it's not a problem. Thanks. |
| 05-25-2006, 04:49 PM | #4 |
Sadly, not in a simple or absolutely foolproof way, at least spell damage. For triggered damage, you can always turn off damage detection triggers before you deal it. If you have only triggered spells, then you can easily isolate attack damage, since it's the only non-triggered source of damage left. |
| 05-25-2006, 05:25 PM | #5 | |
Quote:
EDIT: well, actually it's not enough. I was thinking about ranged units, if they change order while the projectile it's still flying, the event won't trigger, isn't it? |
| 05-25-2006, 08:06 PM | #6 |
Yes, you can detect if damage was caused by an attack or a spell. You take frost orb ability, and modify it so it leaves a dummy buff for 0.01 seconds. Then use a trigger which, upon damage, will check if the buff is on the damaged unit, if it is, remove the buff and do all actions on attack damage, if the unit doesnt have the buff then the damage was caused by a spell. You can also make elements for spells, by adding a decimal to the damage. For example, if you want to detect fire damage, add 0.02 to the damage the spell causes, if fireball in your map deals 50 damage, set damage to 50.02, then you can find if its fire damage like this: JASS:if (GetEventDamage() - R2I(GetEventDamage()))==0.02 then // <do actions on fire damage> endif |
| 05-25-2006, 09:31 PM | #7 | |
Quote:
Thank you, I already had a similar idea (putting a buff on hero attacks) but I'll follow your advices (very very nice the decimal idea, REP ADDED of course). Actually I can use slow poison ability (so it stacks on melee. Do you know a buff ability that stacks on ranged units ?) or, better, I had an idea: what about enabling/disabling this dummy ability (hiding it with a SB) using the event "a unit is under attack"? So I can add this ability only when I need detect damage, should it work? Thanks. |
| 05-25-2006, 09:53 PM | #8 |
I used frost orb ability (Alft), it causes a chill slow, for both melee and ranged. |
