You need 2 triggers - a loop trigger that regenerates health and another trigger that switches the first one on.
-
Heal Start
-
Events
-
Unit - YourUnit's life becomes Less than or equal to (0.25 x (Max life of YourUnit))
-
Conditions
-
Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Loop <gen> is on) Equal to False
-
Then - Actions
-
Trigger - Turn on Loop <gen>
-
Else - Actions
This is the trigger that switches loop trigger on.
The Event is "Unit - Life"
And as the value it uses the function "Arithmetic" and is set as "A x B" where A is 0.25 and B is "Unit - Property".
So whenever YourUnit's life is less than 25%, this trigger will fire the action.
Action only checks if loop trigger is already on; if not, it switches Loop trigger on.
The conditon here is from Boolean => Trigger - Trigger is on
The loop trigger is this:
-
Loop
-
Events
-
Time - Every 1.00 seconds of game time
-
Conditions
-
Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
Or - Any (Conditions) are true
-
Conditions
-
(Percentage life of (Picked unit)) Greater than 25.00
-
((Picked unit) is dead) Equal to True
-
Then - Actions
-
Trigger - Turn off (This trigger)
-
Else - Actions
-
Set HealAmount = (((Real((Level of Acid Bomb for (Picked unit)))) x 5.00) + 5.00)
-
Unit - Set life of (Picked unit) to ((Life of (Picked unit)) + HealAmount)
This fires every 1 second and it first checks through the If/Then/Else if your unit has either more than 25% health or if that hero is dead; It uses the "Or" in conditions, meaning that if any of those conditions are true, then it will pass. If it pass, trigger will turn off.
Those conditions are:
Real => "Unit - Percentage Life"
and
Boolean => "Unit - Unit is dead"
I add the conditon Unit is dead so this trigger won't loop every second for no reason.
If no conditon is true, then it will first set HealAmount - this is REAL variable.
The calculation used here is set as arithmetic
[ (A + B ] where A is another Arithmetic (Y x Z).
Y is "Conversion - Convert Integer to Real" because ability level is integer number. It is the "Unit - Level of Ability for Unit"
Z is 5
so A = Y x Z
and B is 5
Once calculation is done, I simply use the action Unit - Set life (to value) as Arithmetic (A + B)
where A is "Unit - Property of Unit" and B is HealAmount
---------
In case that hero of yours is not pre-placed in game, you won't be able to add him into the first trigger's event.
To solve this, you will need another trigger:
-
Untitled Trigger 001
-
Events
-
Unit - A unit enters (Playable map area)
-
Conditions
-
(Unit-type of (Triggering unit)) Equal to YourUnit
-
Actions
-
Trigger - Add to Heal Start <gen> the event (Unit - (Triggering unit)'s life becomes Less than or equal to (0.25 x (Max life of (Triggering unit))))
This will fire when a unit is created (summoned by spell or trained/bought). Condition checks if that unit-type is equal to your desired unit/hero.
As an action it uses "Trigger - Add new event" - this action adds new event to selected trigger - in this case it adds to "Heal Start" trigger this created unit as the triggering unit whose life will be checked.
If you do it this way, then in your "Heal Start" trigger you don't need any event, as those events will be add through this trigger.