Heal Configuration

Events


Map initialization

Conditions

Actions


-------- Configurable --------


Set HEAL_THRESHOLD = 5.00


Set HEAL_CHECK_INTERVAL = 0.05


-------- With these current values, a unit with 100 HP regen/sec. could constantly fire off the heal event. --------


-------- --------


Countdown Timer - Start heal_timer as a Repeating timer that will expire in HEAL_CHECK_INTERVAL seconds


-------- --------


Set REGEN_STRENGTH_VALUE = 0.05


Set REGEN_THRESHOLD = 5.00


Set REGEN_EVENT_INTERVAL = 1.00
Heal Unit

Events

Conditions

Actions


Custom script: local integer id = udg_heal_integer


Custom script: local real amount = udg_heal_amount


Custom script: local unit source


Set heal_target = NextHealTarget


Set heal_integer = (Custom value of heal_target)


Set heal_life = (Life of heal_target)


If (All Conditions are True) then do (Then Actions) else do (Else Actions)



If - Conditions




heal_check Equal to True



Then - Actions




Set heal_check = False




Set heal_amount = ((heal_life - ((heal_regen[heal_integer] x (Elapsed time for heal_timer)) / HEAL_CHECK_INTERVAL)) - heal_lastLife[heal_integer])




-------- A potential heal still has to exceed HEAL_THRESHOLD --------




Set heal_diff = HEAL_THRESHOLD



Else - Actions




Unit - Set life of heal_target to ((Life of heal_target) + NextHealAmount)




Set heal_amount = ((Life of heal_target) - heal_life)




-------- If the heal ended up being less than 1.00, ignore the event --------




Set heal_diff = 1.00


-------- Don't run the event if there was little to nothing to heal --------


If (All Conditions are True) then do (Then Actions) else do (Else Actions)



If - Conditions




heal_amount Greater than or equal to heal_diff



Then - Actions




-------- Don't let the event for this heal run more than once --------




Set heal_lastLife[heal_integer] = (heal_lastLife[heal_integer] + heal_amount)




-------- Set the source, if one was assigned --------




Custom script: set source = udg_heal_source




Set heal_source = NextHealSource




-------- Fire the event --------




Set HealEvent = 0.00




Set HealEvent = 1.00




Set HealEvent = 0.00




-------- Reset the source, if a previous one was assigned --------




Custom script: set udg_heal_source = source




Custom script: set source = null



Else - Actions


-------- Reset variables to their previous states --------


Custom script: set udg_heal_amount = amount


Custom script: set udg_heal_integer = id


Set heal_target = UDexUnits[heal_integer]


Set NextHealAmount = 0.00


Set NextHealSource = No unit


Set NextHealTarget = No unit
Heal Check Loop

Events


Time - heal_timer expires

Conditions

Actions


Set heal_exitwhen = (heal_count - 1)


For each (Integer heal_integer) from 0 to heal_exitwhen, do (Actions)



Loop - Actions




Set heal_integer = heal_indices[heal_integer]




-------- --------




Set heal_target = UDexUnits[heal_integer]




Set heal_life = (Life of heal_target)




Set heal_diff = (heal_life - heal_lastLife[heal_integer])




Set heal_lastLife[heal_integer] = heal_life




-------- --------




Set heal_amount = (heal_diff - (Max(0.00, heal_regen[heal_integer])))




If (All Conditions are True) then do (Then Actions) else do (Else Actions)





If - Conditions






heal_amount Greater than or equal to HEAL_THRESHOLD





Then - Actions






Set HealEvent = 1.00






Set HealEvent = 0.00





Else - Actions






Set heal_regen[heal_integer] = ((heal_regen[heal_integer] + heal_diff) x 0.50)






-------- The next section was added in version 1.1.0.0 to introduce regeneration events. --------






Set regen_buildup[heal_integer] = (regen_buildup[heal_integer] + heal_diff)






Set regen_timeleft[heal_integer] = (regen_timeleft[heal_integer] - HEAL_CHECK_INTERVAL)






If (All Conditions are True) then do (Then Actions) else do (Else Actions)







If - Conditions








regen_timeleft[heal_integer] Less than or equal to 0.00







Then - Actions








-------- Reset the regen event clock --------








Set regen_timeleft[heal_integer] = REGEN_EVENT_INTERVAL








-------- Analyze the amount regenerated in the past REGEN_CHECK_INTERVAL --------








Set heal_amount = regen_buildup[heal_integer]








Set regen_buildup[heal_integer] = 0.00








If (All Conditions are True) then do (Then Actions) else do (Else Actions)









If - Conditions










(heal_target is A Hero) Equal to True









Then - Actions










-------- Don't spam the event due to regeneration caused by hero attributes --------










Set heal_diff = (heal_amount - ((Real((Strength of heal_target (Include bonuses)))) x REGEN_STRENGTH_VALUE))









Else - Actions










Set heal_diff = heal_amount








If (All Conditions are True) then do (Then Actions) else do (Else Actions)









If - Conditions










heal_diff Greater than or equal to REGEN_THRESHOLD









Then - Actions










Set HealEvent = 0.50










Set HealEvent = 0.00









Else - Actions







Else - Actions




-------- --------




Set heal_integer = heal_indexRef[heal_integer]
Heal Adjust On Damage

Events


Game - DamageEvent becomes Equal to 1.00

Conditions

Actions


Set NextHealTarget = DamageEventTarget


Set heal_check = True


Trigger - Run Heal Unit <gen> (ignoring conditions)
Heal Adjust After Damage

Events


Game - AfterDamageEvent becomes Equal to 1.00

Conditions

Actions


If (All Conditions are True) then do (Then Actions) else do (Else Actions)



If - Conditions




DamageEventAmount Greater than 0.00



Then - Actions




Set TempInteger = (Custom value of DamageEventTarget)




Set heal_lastLife[TempInteger] = ((Life of DamageEventTarget) - (heal_regen[TempInteger] x ((Elapsed time for heal_timer) / HEAL_CHECK_INTERVAL)))



Else - Actions




Set NextHealTarget = DamageEventTarget




Set heal_check = True




Trigger - Run Heal Unit <gen> (ignoring conditions)
Heal Add Unit

Events


Game - UnitIndexEvent becomes Equal to 1.00


Game - DeathEvent becomes Equal to 2.00

Conditions


heal_inSys[UDex] Equal to False


(UDexUnits[UDex] is Mechanical) Equal to False


(Default movement speed of UDexUnits[UDex]) Not equal to 0.00

Actions


Custom script: if GetUnitAbilityLevel(udg_UDexUnits[udg_UDex], 'Aloc') > 0 then


Skip remaining actions


Custom script: endif


Set heal_inSys[UDex] = True


Set heal_indices[heal_count] = UDex


Set heal_indexRef[UDex] = heal_count


Set heal_lastLife[UDex] = (Life of UDexUnits[UDex])


Set regen_timeleft[UDex] = REGEN_EVENT_INTERVAL


Set regen_buildup[UDex] = 0.00


Set heal_count = (heal_count + 1)


If (All Conditions are True) then do (Then Actions) else do (Else Actions)



If - Conditions




heal_count Equal to 1



Then - Actions




Trigger - Turn on Heal Check Loop <gen>



Else - Actions
Heal Remove Unit

Events


Game - DeathEvent becomes Equal to 0.50


Game - DeathEvent becomes Equal to 1.00


Game - DeathEvent becomes Equal to 3.00


Game - UnitIndexEvent becomes Equal to 2.00

Conditions


heal_inSys[UDex] Equal to True

Actions


Set heal_inSys[UDex] = False


Set heal_count = (heal_count - 1)


Set heal_indices[heal_indexRef[UDex]] = heal_indices[heal_count]


Set heal_indexRef[heal_indices[heal_count]] = heal_indexRef[UDex]


If (All Conditions are True) then do (Then Actions) else do (Else Actions)



If - Conditions




heal_count Equal to 0



Then - Actions




Trigger - Turn off Heal Check Loop <gen>



Else - Actions