• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[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