- Joined
- Dec 6, 2007
- Messages
- 233
So i've got these two triggers to spawn a dummy rocket. They use a hashtable timer so that the rockets spawn in salvo of 5 (btw other trigger make the rockets move, but those work for sure). The unit this is triggered for has a cooldown of 7, so it goes like this:
unit attacks
5 rockets spawn in a salvo of 1 per half second
cooldown for 4.5 sec
But, it doesn't appear the timer is working, because when the unit attacks another unit, the rockets start firing, but never stop firing. What is wrong with my triggers? triggers below.
EDIT: and yell if there are any leaks, i've been having problems with lag
unit attacks
5 rockets spawn in a salvo of 1 per half second
cooldown for 4.5 sec
But, it doesn't appear the timer is working, because when the unit attacks another unit, the rockets start firing, but never stop firing. What is wrong with my triggers? triggers below.
-
hash
-
Events
-
Map initialization
-
-
Conditions
-
Actions
-
Hashtable - Create a hashtable
-
Set Rocket_Salvo_Hash = (Last created hashtable)
-
Hashtable - Create a hashtable
-
Set Attack_Target_Hash = (Last created hashtable)
-
-
-
rocket salvo hash
-
Events
-
Unit - A unit Is attacked
-
-
Conditions
-
(Unit-type of (Attacking unit)) Equal to Carrier
-
-
Actions
-
Unit Group - Add (Attacking unit) to Rocket_Salvo_Hash_Group
-
Hashtable - Save 5 as Rocket_Salvo_Key_Timer of (Key (Attacking unit)) in Rocket_Salvo_Hash
-
Hashtable - Save Handle Of(Attacked unit) as Attack_Target_Unit of (Key (Attacking unit)) in Attack_Target_Hash
-
Trigger - Turn on rocket salvo hashtimer <gen>
-
-
-
rocket salvo hashtimer
-
Events
-
Time - Every 0.50 seconds of game time
-
-
Conditions
-
Actions
-
Unit Group - Pick every unit in Rocket_Salvo_Hash_Group and do (Actions)
-
Loop - Actions
-
Set Rocket_Salvo_Trigger_Unit = (Key (Picked unit))
-
Set Rocket_Salvo_Int = (Load Rocket_Salvo_Key_Timer of Rocket_Salvo_Trigger_Unit from Rocket_Salvo_Hash)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
Rocket_Salvo_Int Greater than 0
-
((Picked unit) is alive) Equal to True
-
-
Then - Actions
-
Hashtable - Save (Rocket_Salvo_Int - 1) as Rocket_Salvo_Int of Rocket_Salvo_Trigger_Unit in Rocket_Salvo_Hash
-
Set Attack_Target_Loc = (Position of (Load Attack_Target_Unit of (Key (Picked unit)) in Attack_Target_Hash))
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Owner of (Picked unit)) Equal to Player 1 (Red)
-
-
Then - Actions
-
Set Shooter_Owner = Player 11 (Dark Green)
-
-
Else - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Owner of (Picked unit)) Equal to Player 2 (Blue)
-
-
Then - Actions
-
Set Shooter_Owner = Player 12 (Brown)
-
-
Else - Actions
-
-
-
-
Set Rocket_Point1 = (Position of (Picked unit))
-
Set Rocket_Point3 = Attack_Target_Loc
-
Set Rocket_Point2 = (Rocket_Point1 offset by 0.00 towards ((Facing of (Picked unit)) + 90.00) degrees)
-
Unit - Create 1 Dummy Rocket for Shooter_Owner at Rocket_Point2 facing Rocket_Point3
-
Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
-
Unit Group - Add (Last created unit) to Rocket_Shell
-
Custom script: call RemoveLocation(udg_Rocket_Point2)
-
Custom script: call RemoveLocation(udg_Rocket_Point1)
-
Custom script: call RemoveLocation(udg_Rocket_Point3)
-
Trigger - Turn on rocket launcher shell <gen>
-
-
Else - Actions
-
Hashtable - Clear all child hashtables of child Rocket_Salvo_Trigger_Unit in Rocket_Salvo_Hash
-
Unit Group - Remove (Picked unit) from Rocket_Salvo_Hash_Group
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Rocket_Salvo_Hash_Group is empty) Equal to True
-
-
Then - Actions
-
Trigger - Turn off (This trigger)
-
-
Else - Actions
-
-
-
-
-
-
-
EDIT: and yell if there are any leaks, i've been having problems with lag