So like, omit the [LJASS]if Damage_IsAttack() then[/LJASS] and that's pretty much what you're asking.JASS:scope OnAttackDamage initializer OnInit private function OnDamage takes nothing returns boolean if Damage_IsAttack() then // here. use GetTriggerUnit() for damaged unit, GetEventDamageSource() for damager, GetEventDamage() for damage amount. endif return false endfunction private function OnInit takes nothing returns nothing local trigger t=CreateTrigger() call TriggerAddCondition(t,Filter(function OnDamage)) // you can use a trigger action instead if you wish. call Damage_RegisterEvent(t) endfunction endscope
JASS:unit_type_ranged_attacker unit_type_melee_attacker
......... God damn this Jass tag, try those regardless.
Keep in mind orbs making heros attacks ranged, etc.
Did you not see that a unit can have both ranged and melee attacks? =/maybe a manual function which we can register our units...
Detecting 0 damage events should be permitted on at least invulnerable units, since although they can fire damage events, they cannot take damage greater than 0 (have not tested negative spell damage). This is necessary for detecting WC3 projectile hits on invulnerable units.Well, detecting 0 damage is only needed on projectile spells, and isn't a guarantee of which spell actually hit the unit. I'm willing to revert this if I'm denying people functionality, though. It's just there's no way to stop faerie fire from counting as a physical attack dealing 0 damage...
If you are using, I assume, a dummy invulnerable unit to get hit with a projectile... pray tell, why do you need a detect any-unit-damaged system to detect when it is hit? If you know what unit you are looking for, why not just use a dynamic trigger to detect when it is hit? Better yet, you could even recycle the unit, so the trigger is no longer dynamic... Just a thought.I also still maintain that this defeats part of the purpose of any damage detection system: to detect WC3 projectile hits for 0 damage dummy abilities.
I am not. I'm hoping, for example, to account for when a unit might activate Divine Shield while a projectile is already on its way, for my own convenience and because it would look silly for it to do nothing in this case.If you are using, I assume, a dummy invulnerable unit to get hit with a projectile... pray tell, why do you need a detect any-unit-damaged system to detect when it is hit?
Granted.Can haz nao?