• 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.

Detect damage coming from attack

Status
Not open for further replies.
Level 20
Joined
Jul 14, 2011
Messages
3,213
Hi!

I know Wc3 allows detecting attack, but it can be abuseable. I also know there are Damage Detection Systems to detect when damage is dealt, but it may not come from an attack... So how can we detect when the damage came from an attack?

I've tough about keeping track of the order, but with right click order is not "attack" but "smart" and if the attacker is ranged, it could change the order before the missile strikes the target...
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
But how? I mean... If I add inmolation, it will damage everyone, but I don't want to do triggered bash to those units just because they received damage from inmolation or any otherskill.
 
Level 37
Joined
Mar 6, 2006
Messages
9,243
JASS:
library SpellDamage

    private function setSpellDamage takes unit whichUnit, widget target, real amount, boolean attack, boolean ranged, attacktype aType, damagetype dType, weapontype wType returns nothing
        // Save a boolean into hashtable for example
    endfunction
    
    hook UnitDamageTarget setSpellDamage

endlibrary

So you can use UnitDamageTarget for your spells. The hook thingy then automatically makes setSpellDamage to be called when UnitDamageTarget is called. You can set a boolean for example to tell to the damage detection system that the damage dealt came from a spell.
 
Status
Not open for further replies.
Top