• 🏆 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!

[JASS] Detecting if attack landed

Status
Not open for further replies.
Level 12
Joined
Aug 20, 2007
Messages
866
I suppose you could do it

But that would be extremely complicated

I think the way I'd do it, is track the trajectory path of the unit's attack, and then check right before it takes the hit (like .000001 of a second) set a variable to the targets life, and then check right after the hit (again, extremely accurately) if the life is lower than before

This kind of code would require extensive knowledge of JASS coding, and probably physics, I have no idea how I'd go about doing it myself
 
Level 12
Joined
Aug 20, 2007
Messages
866
Hmmm

Oh wow, I completely forgot about that

You could just set the takes damage event (a little tricky but easy enough), and then make a condition for the event that the damager (triggering unit, I think?) is the unit that the spell works for

Heh, shouldn't be as overwhelming as I thought, all this JASS is going to my head ><
 
Level 11
Joined
Feb 18, 2004
Messages
394
Then just trigger your evasion? Give it 0% Chance in the editor, and on damage events get the abilitylevel, use a random int for the chance and set the life to life + damage taken. If you want you could add the 'miss' tag to the attacker, no problem :)

Damage is dealt after triggers registered to fire on damage events are executed. You would need to:
  • Ensure damage < life
    • If damage > life, increase life above damage
  • Start a timer with a 0 timeout
  • In the callback, reset life to the original values.
As for detecting when an actual attack lands, that one is a bitch. Its possible to detect when an attack starts, and when any damage is taken. Anything in between is not easy at all.
 
Btw when we are talking about a triggered evasion:

You need to seperate spells from normal attacks, but if you just check for damage, spells would be included (and don't say I have to test for all spells, in the end this would be around 150 in my map x.x )

Err, Justify, Did you just try to hijack my thread? That last comment there sounded ALOT like it.

[ontopic]
I couldn't use the buff on attack idea, because that will stop working as soon as there are multiple units attacking the unit.
 
Level 12
Joined
Aug 20, 2007
Messages
866
Uhhh

I think you could go and do what I was talking about earlier, damage event, the damager must be the one w/ the spell. Shouldn't be too difficult to trigger it that way (using a global unit or maybe a group? not sure how you would do it using JASS)
 
Level 40
Joined
Dec 14, 2005
Messages
10,532
Err, Justify, Did you just try to hijack my thread? That last comment there sounded ALOT like it.

[ontopic]
I couldn't use the buff on attack idea, because that will stop working as soon as there are multiple units attacking the unit.
Unless two units hit at the same time (which is impossible), not at all true. Just remove the buff when they are dealt the damage (which is instant anyways)

Make sure the buff icon is textures\black32.blp, or else sometimes you will see the buff icon flash for a fraction of a second (looks a little weird ingame).
 
Level 12
Joined
Aug 20, 2007
Messages
866
Buff flashes

A bit offtopic, but I have seen those buff flashes in DotA (and other AoS maps) numerous times, so all I need to do is set the icons for the buff/effects to textures\black32.blp??
 
Status
Not open for further replies.
Top