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

A unit is attacked with buff

Status
Not open for further replies.
Level 4
Joined
Jul 25, 2005
Messages
48
I am trying to make an ability that if a unit is attacked and they have a specific buff then 50% of the time the unit with the buff takes no damage and the attacking unit damages himsekf with the damage that was going to hurt the unit with the buff, her eis what I have and it isn't working.

Code:
Untitled Trigger 001
    Events
        Advanced - Any unit takes damage
    Conditions
        ((Triggering unit) has buff Countering ) Equal to True
    Actions
        Set ROBUNE = (Damage source)
        Unit - Set life of ROBUNE to ((Life of ROBUNE) - (Damage taken))
        Special Effect - Create a special effect attached to the overhead of ROBUNE using Abilities\Spells\Other\Stampede\StampedeMissileDeath.mdl
        Unit - Set life of (Triggering unit) to ((Life of (Triggering unit)) + (Damage taken))
        Special Effect - Destroy (Last created special effect)

I took out the % chance for testing purposes.
 
Level 4
Joined
Jul 25, 2005
Messages
48
Is it possible to do it without any unit takes damage?
I tried to use a unit is attacked but I don't think damage taken works with a unit is attacked, so I guess this skill isn't possible?
 
Level 11
Joined
Jul 20, 2004
Messages
2,760
It is, but you will probably need JASS, for the local triggers purpose. When an unit is attacked, you activate the trigger which checks if that unit is damaged by the unit with your skill. And then, the actions are the ones you mention... But unfortunately this works good only with JASS...

~Daelin
 
Status
Not open for further replies.
Top