Detecting Attack

Tawnttoo

New Member
Reaction score
36
I have imported Weep's GDD and I'm currently trying to trigger all my spell damages in order to have a way of detecting attacks. I tried it with these triggers:
Trigger:
  • Iron Grip
    • Events
      • Game - GDD_Event becomes Equal to 0.00
    • Conditions
      • (GDD_DamagedUnit has buff Damage Dealing (Backhand)) Equal to True
      • (Unit-type of GDD_DamageSource) Not equal to Dummy unit (Invisible)
    • Actions
      • Set TempReal = ((25.00 + (25.00 x (Real((Level of Iron Grip for GDD_DamageSource))))) + ((0.40 + (0.10 x (Real((Level of Iron Grip for GDD_DamageSource))))) x (Real(AbiPwrBonusTotal[(Player number of (Owner of GDD_DamageSource))]))))
      • Trigger - Turn off (This trigger)
      • Unit - Create 1 Dummy unit (Invisible) for (Owner of GDD_DamageSource) at TempPoint facing Default building facing degrees
      • Unit - Add Stun (Dummy) to (Last created unit)
      • Unit - Add a 3.00 second Generic expiration timer to (Last created unit)
      • Unit - Set level of Stun (Dummy) for (Last created unit) to (Level of Iron Grip for GDD_DamageSource)
      • Unit - Order (Last created unit) to Human Mountain King - Storm Bolt GDD_DamagedUnit
      • Trigger - Turn on (This trigger)


Where the buff "Damage Dealing (Backhand)" lasts for 0.01 seconds and is there only to detect the spell hit. My attack detection trigger is this:

Trigger:
  • On Attack
    • Events
      • Game - GDD_Event becomes Equal to 0.00
    • Conditions
      • (Unit-type of GDD_DamageSource) Not equal to Dummy unit (Invisible)
      • Or - Any (Conditions) are true
        • Conditions
          • (GDD_DamagedUnit has buff Damage Dealing (Backhand)) Not equal to True
    • Actions
      • Game - Display to (Player group((Owner of GDD_DamageSource))) the text: This is an attack


However, it displays the message "This is an attack" on the spell cast as well. How can I fix this?
 

Weep

Godspeed to the sound of the pounding
Reaction score
400
Is your hero's spell also based on Storm Bolt? Storm Bolt (and, I presume, its clones Firebolt and Ice Bolt and Hurl Bolder) actually causes 3 damage events: 0 damage without the buff immediately followed by the spell damage with the buff, then another 0 damage without the buff when the stun wears off. :confused:

I'd suggest using another ability like Acid Bomb or Shadow Strike for dummy missile spells, or filtering out 0 damage events (though beware that a unit can deal 0 damage on attack eg. if the target has gone invulnerable, or if the target has a strong enough Hardened Skin ability.)

If that's not the problem, some more info about your ability would be useful.

(By the way, I don't see you setting TempPoint anywhere in the first trigger, which should be causing the dummy unit creation to bug...)
 

Tawnttoo

New Member
Reaction score
36
Sorry for the slow reply.

The ability was indeed based on Storm Bolt. I changed it to Acid Bomb and it showed the debug message "This is an attack" twice. I tried to turn off the "On Attack" trigger at the start of the first one and turning it on again in the end. No effect, still 2 messages.

TempPoint was originally set to point of GDD_DamagedUnit, where I also created floating text to display the damage dealt. I excluded the text from the trigger, but it was left there.
 

Weep

Godspeed to the sound of the pounding
Reaction score
400
My apologies for giving you some incorrect information...Acid Bomb and Shadow Strike also issue the buffless 0 damage event upon impact. Heck, Shadow Strike's main spell damage is also dealt before the buff is present. I'd just forgotten (in the case of Shadow Strike) or never noticed (for Acid Bomb, since I've mostly ever checked for damage in the presence of a specific buff).

In general, it is probably safe to assume that attacks will deal non-0 damage, because the few instances where they would deal 0 damage would also likely be cases where ignoring the happenstance of an attack is OK (eg. a missile hitting a unit that turns invulnerable before the missile impacts). To support that, J4L's vJass system Damage has separate events for 0 and non-0 damage (and previously ignored 0 damage events, until I pestered him about it. :p)

Such a condition also works well with triggered spell damage, since the actual units' "fake" spell impacts will therefore always be set to deal 0 damage and will be ignored by the attack detection triggers.
 

Tawnttoo

New Member
Reaction score
36
If I understood you correctly, I'm to add a condition to check if the damage dealt is 0? Or, I'm to get J4F's system for this?
 

Weep

Godspeed to the sound of the pounding
Reaction score
400
I mean that the On Attack trigger ought to have a condition that GDD_Damage is greater than 0. I only mentioned J4L's system to lend support to that idea.
 

Bogrim

y hello thar
Reaction score
154
There's an easier solution to detecting attacks rather than triggering all your spell damage, which is to sacrifice the buff type "Poison" in favor of detecting attack effects such as Poison Arrows and Crippling Poison. These abilities create a buff on the attack's damage event, where you can remove the buff to make the event unique. By using custom buffs, you can create a limitless amount of triggers with the same ability.

For example, here's a simple auto-cast ability I made called "Double Strike" using Weep's GDD with Poison Arrows:
Trigger:
  • Ability Double Strike
    • Events
      • Game - GDD_Event becomes Equal to 0.00
    • Conditions
      • ((Triggering unit) has buff Dummy (Double Strike)) Equal to True
    • Actions
      • Unit - Remove Dummy (Double Strike) buff from (Triggering unit)
      • Unit - Cause GDD_DamageSource to damage (Triggering unit), dealing GDD_Damage damage of attack type Chaos and damage type Universal

(Too simple really, but all my cool triggers are way too long to be worth posting for example. ;-P)
 

Tawnttoo

New Member
Reaction score
36
Setting the GDD_Damage to greater than 0 did the trick. Thank you very much for the help, I appreciate it.

Thanks to Bogrim as well, but I'd rather not sacrifice anything that could be easily triggered.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      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