I'm not sure about this, never done something like this... but I guess this should work.
1- Detect the damage dealt with some DDS (Damage Detection System). Most times It's better than using "A unit is attacked" event. I use Weep's GDD.
2- Why the item has 30 levels if the cap is 10? And what's the difference between the four levels of the Hero skill?
I guess that Hero skill with higher level would last more time after the cap is reached, and will reach a higher cap. I'll call your skill "Frenzy".
Trigger 1
E - Damage is dealt
C - Level of Frenzy for DamageSource is Greater than 0.
-> Custom script: set udg_i = GetHandleId(udg_GDD_DamageSource)
(This will allow you to handle your unit in the hashtable)
-> Set Hits = ((Load 0 of i from FrenzyHash) + 1)
"0" is where we're going to store the hits dealt, "i" is the handle of the unit, meaning that we're storing the hits dealt in this unit data, FrenzyHash is the Hashtable name. (Hits +1) will allow you to increase the amount of hits. The first time Hits will be 0, and will turn to 1... The second time you hit, "Hit" will be 1, and will turn to 2, and so on
-> If/Then/Else. If Hits is Greater than (Level of Frenzy for GDD_DamageSource x 2,5) Then set Hits = Level of Frenzy for GDD_DamageSource x 2,5. Else -> Leave it empty
This will set the max amount of "Hits" in the count to Level of Ability x 2,5. The caps will be 2, 5, 7, and 10 respectively.
-> Hashtable - Save Hits as 0 of i in FrenzyHash
-> Set Remaining Time = Level of Frenzy for GDD_DamageSource x 2,5.
This means that the effect will last 2,5 seconds for each level. In level 4 the skill will last 10 seconds, since 2,5 x 4 = 10.
-> Hashtable - Save Remaining Time as 1 of i in FrenzyHash
Now we're storing the time the effect will last on that unit
-> Set Level of FrenzySpeed to Hits
This means that, if the unit has dealt two hits, Hits will be "2", and will turn your bonus speed ability to 2. You'll set the bonus speed per level in the object editor
-> Add GDD_DamageSource to FrenzyGroup
^This goes all inside one trigger^
Trigger2 - FrenzyLoop
E - Every 0.5 secs of gametime
C - None
-> Pick every unit in FrenzyGroup and do Multiple Actions (Loop):
-> Set udg_i = GetHandleId(GetEnumUnit())
-> Set Remaining Time = ((Load 1 of i from FrenzyHash) - 0.5)
-> Hashtable - Save Remaining Time as 1 of i in FrenzyHash
-> If/Then/Else. If Remaining Time is Less than or equal to 0 then -->
--> Set level of FrenzySpeed for (Picked Unit) to 0
--> Clear all child of i from Hashtable.
--> Remove (Picked Unit) from FrenzyGroup
That should do... or so