System Damage

You just gotta know that the damage was made by unit and then check whether the unit is ranged or not.


Just have some UnitProperties like struct for unit data, so you can check units attack range and ranged/melee status from there.
 
[del]
JASS:
unit_type_ranged_attacker
unit_type_melee_attacker


......... God damn this Jass tag, try those regardless.[/del]

EDIT: Attack Indice 2 makes this destroy itself.
 
hmm.. is it possible for you to make something to check if the damage is ranged or melee?
Or store the value manually.
 
Err..
I understand the Damage_RegisterEvent(trigger) part..
But how would I work from there?

Like, how would I know who the attacker and 'attack-ee' was? o.0
I didn't manage to find a part that mentioned it in the documentation =x
 
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
So like, omit the [LJASS]if Damage_IsAttack() then[/LJASS] and that's pretty much what you're asking.

Sorry, those 3 natives should be listed in the doc, if they're not. I need to update that some time. :p

Anywho, hope that helps. :thup:
 
JASS:
unit_type_ranged_attacker
unit_type_melee_attacker


......... God damn this Jass tag, try those regardless.

Furby, it can be solved via IsUnitType().

I asked the question a few posts back.

EDIT:

On second thought not really.
what if you want a ranged physical damage from an originally melee attacker?

Jesus, you have to add it please. :D.
 
maybe a manual function which we can register our units... same like Is_Attack, Is_Spell... but Is_Ranged and Is_Melee... then some some boolean to check if that unit is what or what :p
 
Keep in mind orbs making heros attacks ranged, etc. :)
maybe a manual function which we can register our units...
Did you not see that a unit can have both ranged and melee attacks? =/

It will not work, and if you have to do it manually, it does not need to be done through this system. :)

Also, if it is simply attached to the unit/unit type, you can just write a IsRanged function yourself which takes a unit and returns a boolean.
 
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...
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.

(Ran into this in my tower contest idea.)

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. You could even enforce buff-detection by making a separate [ljass]Damage_RegisterAllEvents takes trigger t, buff identifier[/ljass] so you can keep excluding Faerie Fire. :rolleyes:
 
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.
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 would be using AIDS for this sort of stuff, not Damage. :p
 
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?
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. :p

My thoroughness will be the death of me...

And in a more general sense, people might want to make missile spells that are invulnerable-targetable. *shrug*
 
Thanks! :D Works fine from what I can tell. (Also famous last words...)

[edit] Interesting, it seems as if Crit Strike causes a zero-damage event when it procs.
[edit 2] But, alas, not all my troubles are solved; a unit can still evade a "never misses" homing projectile by blinking or wind-walking. Still, I'm glad this was added. :)
[edit 3] And a 0 damage attack may still deal non-0 damage if the target has Hardened Skin. The Crit 0 remains 0, though.
 
Damage_IsAttack & Damage_BlockAll
is it possible to use it together
eg. simulating 'miss'
- ie not register the attack as an attack
- Status> or can/should i add 'alway miss' before it attacks so the attack misses?
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top