- Joined
- Dec 9, 2014
- Messages
- 89
Hi,
I want to make it so my towers only regenerate when they have not attacked for 5 seconds.
I am using this damage system: GUI-Friendly Damage Detection v1.2.1
I am new to hashtables but I figured this would be the way to do it. So I removed the base regen of the towers and using hashtables/damage system I created a trigger that should set the timer to 5 everytime they attack, with a separate trigger counting down by 1 every second and regenerating the unit if the timer reaches zero.
But this doesn't seem to work, and I can't figure out where I have gone wrong. How do I achieve my goal?
Here are the triggers:
I want to make it so my towers only regenerate when they have not attacked for 5 seconds.
I am using this damage system: GUI-Friendly Damage Detection v1.2.1
I am new to hashtables but I figured this would be the way to do it. So I removed the base regen of the towers and using hashtables/damage system I created a trigger that should set the timer to 5 everytime they attack, with a separate trigger counting down by 1 every second and regenerating the unit if the timer reaches zero.
But this doesn't seem to work, and I can't figure out where I have gone wrong. How do I achieve my goal?
Here are the triggers:
-
regen
-
Events
- Game - GDD_Event becomes Equal to 0.00
- Conditions
-
Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (GDD_DamageSource is in RegenTimeGroup) Equal to True
-
Then - Actions
- Unit Group - Add GDD_DamageSource to TempGroup
-
Unit Group - Pick every unit in TempGroup and do (Actions)
-
Loop - Actions
- Hashtable - Save 5.00 as 0 of (Key (Picked unit)) in RegenTimer
-
Loop - Actions
- Custom script: call DestroyGroup(udg_TempGroup)
- Else - Actions
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
Events
-
start regen
-
Events
- Time - Every 1.00 seconds of game time
- Conditions
-
Actions
-
Unit Group - Pick every unit in RegenTimeGroup and do (Actions)
-
Loop - Actions
- Set RegenTime = (Load 0 of (Key (Picked unit)) from RegenTimer)
- Game - Display to (All players) the text: (String(RegenTime))
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- RegenTime Greater than 0.00
-
Then - Actions
- Hashtable - Save (RegenTime - 1.00) as 0 of (Key (Picked unit)) in RegenTimer
-
Else - Actions
- Unit - Set life of (Picked unit) to ((Life of (Picked unit)) + ((Max life of (Picked unit)) / 300.00))
-
If - Conditions
-
Loop - Actions
-
Unit Group - Pick every unit in RegenTimeGroup and do (Actions)
-
Events
Last edited: