Hi, I have an Control Point Based income system, a player gains gold based on how many Control Points he has. There are 3 different types, 15g, 25g and 35g.
However when this trigger runs every 1 minute it causes the map to lag and I'n not sure why?
The trigger detects every Control Point within a unit group (CPGroup), CPs are added to this group at map startup and whenever one is captured. It used to be that the trigger calculated how many CP in the whole map every minute, I though this was what was causing the lag so changed it to a unit group but it is still causing lag :/
However when this trigger runs every 1 minute it causes the map to lag and I'n not sure why?
The trigger detects every Control Point within a unit group (CPGroup), CPs are added to this group at map startup and whenever one is captured. It used to be that the trigger calculated how many CP in the whole map every minute, I though this was what was causing the lag so changed it to a unit group but it is still causing lag :/
-
ActualIncome
-
Events
- Time - Elapsed game time is 1.00 seconds
- Time - Income expires
- Conditions
-
Actions
- Custom script: set bj_wantDestroyGroup = true
-
Unit Group - Pick every unit in CPGroup and do (Actions)
-
Loop - Actions
-
Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Unit-type of (Picked unit)) Equal to (==) Control Point 15g
-
Then - Actions
- Set PlayerIncome[(Player number of (Owner of (Picked unit)))] = (PlayerIncome[(Player number of (Owner of (Picked unit)))] + 15)
-
Else - Actions
-
Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Unit-type of (Picked unit)) Equal to (==) Control Point 25g
-
Then - Actions
- Set PlayerIncome[(Player number of (Owner of (Picked unit)))] = (PlayerIncome[(Player number of (Owner of (Picked unit)))] + 25)
-
Else - Actions
-
Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Unit-type of (Picked unit)) Equal to (==) Control Point 35g
-
Then - Actions
- Set PlayerIncome[(Player number of (Owner of (Picked unit)))] = (PlayerIncome[(Player number of (Owner of (Picked unit)))] + 35)
- Else - Actions
-
If - Conditions
-
Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
- Do ActionFor each (Integer A) from 1 to 12, do (Player - Add PlayerIncome[(Integer A)] to (Player((Integer A))) Current gold)
- Do ActionFor each (Integer A) from 1 to 12, do (Set PlayerIncome[(Integer A)] = 0)
-
Loop - Actions
-
Events