Hmmm from what he's talked about, you all seem to be simplifying the matter far too much for what it needs. For one thing, no one has utilized the fact that you should detect based on when a unit takes damage rather then when they are attacked, because that also takes care of missing and units dying before contact is made.
Also, there's sort of a bug related with searing arrows that causes units to mess up in attacks.
However that's minor and you can still get a decent effect going
For .GUI you'll need a few triggers, 1 dummy unit, and a dummy flamestrike ability as well as a bunch of other variables and variable types because there are a lot of conditions you'll need to check.
Now I'll use an old spell of mine which is based off of searing arrows, and grants a chance effect on a unit.
I'll just show them as I have them in my editor:
The first one is for single casts because they still count as well, so you'll need to check just casting it once on a unit.
-
Single Cast
-
Events
-
Unit - A unit Starts the effect of an ability
-
Conditions
-
And - All (Conditions) are true
-
Conditions
-
(Ability being cast) Equal to Demoralizing Blow
-
(Casting unit) Equal to DwarfBeserker
-
((Target unit of ability being cast) belongs to an enemy of (Owner of DwarfBeserker)) Equal to True
-
(Mana of DwarfBeserker) Greater than or equal to 9.00
-
(Random real number between 0.00 and 100.00) Less than or equal to (5.00 + (10.00 x (Real((Level of Demoralizing Blow for DwarfBeserker)))))
-
Actions
-
Set FSStunPoint = (Position of Target unit of ability being cast)
-
Unit - Create 1 Universal Dummy Unit for (Owner of DwarfBeserker) at FSStunPoint facing Default building facing degrees
-
Custom script: call RemoveLocation(udg_FSStunPoint)
-
Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
-
Unit - Add Demoralized to (Last created unit)
-
Unit - Set level of Demoralized for (Last created unit) to ((5 x ((Level of Demoralizing Blow for DwarfBeserker) - 1)) + CastCount)
-
Unit - Order (Last created unit) to Neutral Pandaren Brewmaster - Drunken Haze Target unit of ability being cast
This is for one cast
Next is for detecting turning it on/off
-
Activate or Deactivate
-
Events
-
Unit - A unit Is issued an order with no target
-
Conditions
-
(Ordered unit) Equal to DwarfBeserker
-
Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Issued order) Equal to (Order(flamingarrows))
-
Then - Actions
-
Set FlurryStrikeOn = True
-
Unit - Add Fury Hands to DwarfBeserker
-
Else - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Issued order) Equal to (Order(unflamingarrows))
-
Then - Actions
-
Set FlurryStrikeOn = False
-
Unit - Remove Fury Hands from (Triggering unit)
-
Else - Actions
OK NOW IS THE IMPORTANT PART: these next 2 triggers will be what determines a unit taking damage on an incoming attack.
first just detecting unit being attacked....
-
Stun Attempt While active
-
Events
-
Unit - A unit Is attacked
-
Conditions
-
And - All (Conditions) are true
-
Conditions
-
(Attacking unit) Equal to DwarfBeserker
-
((Attacked unit) is A structure) Equal to False
-
FlurryStrikeOn Equal to True
-
((Attacked unit) belongs to an enemy of (Owner of DwarfBeserker)) Equal to True
-
(Mana of DwarfBeserker) Greater than or equal to 9.00
-
Actions
-
Trigger - Turn off Stun While Activated <gen>
-
Set FSChanceStunnedUnit = (Attacked unit)
-
Trigger - Add to Stun While Activated <gen> the event (Unit - FSChanceStunnedUnit Takes damage)
-
Trigger - Turn on Stun While Activated <gen>
and this part deal's the damage...
-
Stun While Activated
-
Events
-
Conditions
-
(Damage source) Equal to DwarfBeserker
-
Actions Set FSStunPoint = (Position of FSChanceStunnedUnit)
-
Unit - Create 1 Universal Dummy Unit for (Owner of DwarfBeserker) at FSStunPoint facing Default building facing degrees
-
Custom script: call RemoveLocation(udg_FSStunPoint)
-
Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
-
Unit - Add Demoralized to (Last created unit)
-
Unit - Set level of Demoralized for (Last created unit) to ((5 x ((Level of Demoralizing Blow for DwarfBeserker) - 1)) + CastCount)
-
Unit - Order (Last created unit) to Neutral Pandaren Brewmaster - Drunken Haze FSChanceStunnedUnit
-
Trigger - Turn off (This trigger)
Now what you'll get is a fully fucntional activatable orb effect that deals a buff on every attack. You can modifiy that by adding an "if/then/else" function upon dealing damage to setup a chance to deal the effect in a similar fashion as others have already described.
The reason I do it this way is that it detects from only attacking a hero, so you're damaging them when you're supposed to. If you're worried about spells getting in the way, just make sure all triggered damage is from another alternate dummy unit, not your hero, otherwise the other effects could feed the damage trigger instead of damaging from an attack.
check out the spider hero in this map, he's got an ability which is based off of flame arrows and is 100% triggered in terms of effect and similar to the example one I posted (it's older so some stuff might be different, in which case use the newer code).
http://www.freewebs.com/drain_pipe/My war3 files/Newer DPMAOS.w3x