System Damage

Viikuna

No Marlo no game.
Reaction score
265
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.
 

BlackRose

Forum User
Reaction score
239
[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.
 

kingkingyyk3

Visitor (Welcome to the Jungle, Baby!)
Reaction score
216
hmm.. is it possible for you to make something to check if the damage is ranged or melee?
Or store the value manually.
 

SineCosine

I'm still looking for my Tangent
Reaction score
77
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
 

Jesus4Lyf

Good Idea™
Reaction score
397
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:
 

13lade619

is now a game developer :)
Reaction score
398
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.
 

Laiev

Hey Listen!!
Reaction score
188
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
 

Jesus4Lyf

Good Idea™
Reaction score
397
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.
 

Weep

Godspeed to the sound of the pounding
Reaction score
400
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:
 

Jesus4Lyf

Good Idea™
Reaction score
397
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
 

Weep

Godspeed to the sound of the pounding
Reaction score
400
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*
 

Weep

Godspeed to the sound of the pounding
Reaction score
400
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.
 

hgkjfhfdsj

Active Member
Reaction score
55
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.
  • Ghan Ghan:
    Still lurking
    +3
  • 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