I am trying to make a loop with 5 players, each with their own set of units.
This trigger is supposed to create a boat, loop the creation action and the load ability on the created unit, and when all units has been loaded it should leave the shore and the next player would have his boat created and so on...
I have modified the event, it should be every 120 seconds, so the problem is not that the waits makes it doubleexecute.
Every time i make a little change i get one of 3 outcomes:
1. The boat waiting a few seconds, then moving on. With waits.
2. The boat loading the first time, then moving on(that far flawlessly), but when running the second time it does not load the unit, it also refuses to load unit groups with more than one unit. I don't know what i did this time.
3. The boat is created, tries to load the unit, but is interrupted by the move action coming after. This is with no waits in.
I tried with game messages to detect what went wrong, and it turned out that the last set of triggers (the ones moving the ship and cleaning) would not run if a wait is placed there.
Any solutions?
EDIT: I detected a tiny mistake, fixed it, but still running wrong.
This trigger is supposed to create a boat, loop the creation action and the load ability on the created unit, and when all units has been loaded it should leave the shore and the next player would have his boat created and so on...
I have modified the event, it should be every 120 seconds, so the problem is not that the waits makes it doubleexecute.
Every time i make a little change i get one of 3 outcomes:
1. The boat waiting a few seconds, then moving on. With waits.
2. The boat loading the first time, then moving on(that far flawlessly), but when running the second time it does not load the unit, it also refuses to load unit groups with more than one unit. I don't know what i did this time.
3. The boat is created, tries to load the unit, but is interrupted by the move action coming after. This is with no waits in.
I tried with game messages to detect what went wrong, and it turned out that the last set of triggers (the ones moving the ship and cleaning) would not run if a wait is placed there.
Any solutions?
EDIT: I detected a tiny mistake, fixed it, but still running wrong.
Code:
Heaven Naval
Events
Time - Every 10.00 seconds of game time
Conditions
Actions
For each (Integer A) from 1 to 5, do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Number of units in NavalForces[(Integer A)]) Equal to 0
Then - Actions
Else - Actions
Set NavalRunning[(Integer A)] = True
Unit - Create 1 Human Light Transport Ship for (Player((Integer A))) at HeavenNavalPoint facing 180.00 degrees
Set Temp_Unit = (Last created unit)
Unit - Set level of Cargo Hold (Ship) for (Last created unit) to ((Current research level of Improved Cargo for (Owner of (Last created unit))) + 1)
Unit - Change ownership of (Last created unit) to Player 6 (Orange) and Retain color
Set Temp_Group = NavalForces[(Integer A)]
For each (Integer B) from 1 to (Number of units in Temp_Group), do (Actions)
Loop - Actions
Wait 0.50 seconds
Set Temp_Unit2 = (Random unit from Temp_Group)
Unit - Create 1 (Unit-type of Temp_Unit2) for (Player((Integer A))) at HeavenNavalPoint facing Default building facing degrees
Unit Group - Remove Temp_Unit2 from Temp_Group
Unit - Order Temp_Unit to Load (Last created unit)
Set X = (X + 1)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
X Equal to (Number of units in NavalForces[(Integer A)])
Then - Actions
Set X = 0
Custom script: call DestroyGroup (udg_Temp_Group)
Wait 1.00 seconds
Unit - Order Temp_Unit to Move To HellNavalTarget
Set NavalRunning[(Integer A)] = False
Else - Actions
Wait 1.00 seconds