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

hey guys problem with spell...

Status
Not open for further replies.
Level 5
Joined
Jun 22, 2004
Messages
109
hey guys ive been having problems with this specific spell i made...its a passive ability but in a certain area of my map...even though nothing is attacking the unit, the ability will trigger...i want to fix this and make it so that the ability only triggers when the unit is hit...here is my code....

Counter Blade
Events
Unit - A unit Is attacked
Conditions
(Level of Counter Blade for (Attacked unit)) Greater than or equal to 1
Actions
If (((Attacked unit) is an illusion) Equal to True) then do (Skip remaining actions) else do (Do nothing)
If ((Percentage life of (Attacked unit)) Greater than or equal to 100.00) then do (Skip remaining actions) else do (Do nothing)
If ((Unit-type of (Attacked unit)) Equal to Blade master Dummy) then do (Skip remaining actions) else do (Do nothing)
If ((Attacking unit) Equal to (Summoned unit)) then do (Skip remaining actions) else do (Do nothing)
If (((Attacking unit) is A ranged attacker) Equal to True) then do (Skip remaining actions) else do (Do nothing)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Random integer number between 1 and 100) Less than or equal to 5
Then - Actions
Unit - Create 1 Blade master Dummy for (Owner of (Attacked unit)) at (Position of (Attacked unit)) facing Default building facing degrees
Animation - Change (Last created unit)'s vertex coloring to (0.00%, 100.00%, 100.00%) with 50.00% transparency
Unit - Add a 7.00 second Generic expiration timer to (Last created unit)
Unit - Order (Last created unit) to Orc Blademaster - Bladestorm
Else - Actions
Do nothing
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,258
Its simple you must use unit is attacked and unit is damaged. When the unit attacks something it will have a delay untill it hits the target culculate a formular for the delay and then create the unit is damaged event 0.05 secs before the culculated impact and make sure it only triggers if it takes damage form that piticular unit.
After 0.05 secs from the culculated time of impact destroy the unit is damaged trigger to prevent leakage.

This is the ONLY way to culculate if a unit is hit and is not 100% accurate.

This is actualy quite simple with jass
 
Level 4
Joined
Feb 12, 2006
Messages
99
If what you mean is that the actions are only applied if the unit is in a certain area, then just add the condition that looks something like this: Unit - Triggering unit is in region (name of your region).
 
Status
Not open for further replies.
Top