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

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