HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

A way to detect attacks...

11-05-2005, 03:31 AM#1
Psyny
Hello,

Since i was making a whole new model, i decied to give it some Dodge and Block animations, like WOW. But, here i got a problem...

1 - I was reading the forum, and know thats is not possible, but i will ask anyway. Its possible to detect when Dodge or Hardned Skin ( thats actually have a chance to block damage ) occurs ?

2 - The jass way, its possible to detect the moment between the unit attacks, ant another receive damage ?

Lets me explain the option 2 better. I need when the unit A attacks the unit B its have a chance of 10% to miss. If the unit A misses, the unit B will play the "dodge" animation.

Finally, I only need a way to make a certain unit do not receive the damage of an attack, but i need a script way to do that.

Bye.
11-05-2005, 08:41 AM#2
Anitarf
You can not detect when passive abilities fire, but you can trigger them yourself. For evasion, you could dynamically cast a curse-based spells on attackers when they attack your unit. The spell would give a 100% miss chance, but you wouldn't cast it on every attack, but only on a certain percentage. That way, you would know precisely which attacks were dodged.
11-05-2005, 01:01 PM#3
Psyny
Quote:
Originally Posted by Anitarf
You can not detect when passive abilities fire, but you can trigger them yourself. For evasion, you could dynamically cast a curse-based spells on attackers when they attack your unit. The spell would give a 100% miss chance, but you wouldn't cast it on every attack, but only on a certain percentage. That way, you would know precisely which attacks were dodged.

Hum... i not understood, it can be done in the moment that the Attacker attacks and before the Attacked unit takes damage ?
11-05-2005, 08:01 PM#4
Anitarf
Quote:
Originally Posted by Psyny
Hum... i not understood, it can be done in the moment that the Attacker attacks and before the Attacked unit takes damage ?
Correct, "a unit is attacked" event happens when the attacking unit starts the attack (begins playing the attack animation), while the "unit takes damage" event happens when damage is actually dealt.
11-06-2005, 05:22 AM#5
Psyny
Thanks its worked ^_^

And i actally found a way to do it without other spells...
There is:

Code:
Dodge
    Events
        Unit - A unit Is attacked
    Conditions
    Actions
        Set test = (Random integer number between 0 and 100)
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                test Less than 25
            Then - Actions
                Unit - Order (Attacking unit) to Stop
                Animation - Play (Attacking unit)'s attack animation
                Floating Text - Create floating text that reads ((Name of (Attacked unit)) +  Dodges) above (Attacked unit) with Z offset 0.00, using font size 10.00, color (100.00%, 0.00%, 0.00%), and 10.00% transparency
                Floating Text - Change (Last created floating text): Disable permanence
                Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
                Floating Text - Change the fading age of (Last created floating text) to 0.00 seconds
                Floating Text - Change the lifespan of (Last created floating text) to 1.00 seconds
                Wait 0.01 seconds
                Unit - Order (Attacking unit) to Attack (Attacked unit)
            Else - Actions

The animation and floating text are only visual effects... To display tge "miss" floating text and such...

Its a good way to do it i think... And someone can translate it to jass i will be glady :)

Bye.