turok255
New Member
- Reaction score
- 30
So im making a king of the hill map. If you go into the region (The Hill) The timer starts... First person to get their timer to X amount of seconds wins the game. The only problem with this trigger is.. If you have 20 units in the middle all yours and 1 leaves the timer stops. The timer active for the person with the most units in the middle. Heres the trigger.
Im not exactly sure if theres an easy way to fix this so it still works. I can post all the triggers for the timer if needed but this is the main problem probabaly.
Code:
activateTimer
Events
Unit - A unit enters Hill <gen>
Unit - A unit leaves Hill <gen>
Conditions
Actions
Leaderboard - Sort leaderBoardTimerKeeper by Value in Descending order
Set ownerOfMostUnits = (Player in position 1 of leaderBoardTimerKeeper)
Unit Group - Pick every unit in (Units owned by ownerOfMostUnits) and do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Entering unit) is in (Units owned by ownerOfMostUnits)) Equal to True
Then - Actions
Trigger - Turn on timer <gen>
Else - Actions
Trigger - Turn off timer <gen>
Unit Group - Pick every unit in (Units owned by ownerOfMostUnits) and do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Leaving unit) is in (Units owned by ownerOfMostUnits)) Equal to True
Then - Actions
Trigger - Turn off timer <gen>
Else - Actions
Code:
timer
Events
Time - Every 0.01 seconds of game time
Conditions
Actions
Set timeMilisecs[(Player number of ownerOfMostUnits)] = (timeMilisecs[(Player number of ownerOfMostUnits)] + 1)
Set timeMilisecsString[(Player number of ownerOfMostUnits)] = (String(timeMilisecs[(Player number of ownerOfMostUnits)]))
Set timeSecondsString[(Player number of ownerOfMostUnits)] = (String(timeSeconds[(Player number of ownerOfMostUnits)]))
Set timeMinutesString[(Player number of ownerOfMostUnits)] = (String(timeMinutes[(Player number of ownerOfMostUnits)]))
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
timeMilisecs[(Player number of ownerOfMostUnits)] Equal to 100
Then - Actions
Set timeMilisecs[(Player number of ownerOfMostUnits)] = 0
Set timeMilisecsString[(Player number of ownerOfMostUnits)] = (String(timeMilisecs[(Player number of ownerOfMostUnits)]))
Set timeSeconds[(Player number of ownerOfMostUnits)] = (timeSeconds[(Player number of ownerOfMostUnits)] + 1)
Set timeSecondsString[(Player number of ownerOfMostUnits)] = (String(timeSeconds[(Player number of ownerOfMostUnits)]))
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
timeSeconds[(Player number of ownerOfMostUnits)] Equal to 60
Then - Actions
Set timeSeconds[(Player number of ownerOfMostUnits)] = 0
Set timeSecondsString[(Player number of ownerOfMostUnits)] = (String(timeSeconds[(Player number of ownerOfMostUnits)]))
Set timeMinutes[(Player number of ownerOfMostUnits)] = (timeMinutes[(Player number of ownerOfMostUnits)] + 1)
Set timeMinutesString[(Player number of ownerOfMostUnits)] = (String(timeMinutes[(Player number of ownerOfMostUnits)]))
Else - Actions
If ((Integer(timeMilisecsString[(Player number of ownerOfMostUnits)])) Less than 10) then do (Set timeMilisecsString[(Player number of ownerOfMostUnits)] = (0 + (String(timeMilisecs[(Player number of ownerOfMostUnits)])))) else do (Do nothing)
If ((Integer(timeSecondsString[(Player number of ownerOfMostUnits)])) Less than 10) then do (Set timeSecondsString[(Player number of ownerOfMostUnits)] = (0 + (String(timeSeconds[(Player number of ownerOfMostUnits)])))) else do (Do nothing)
If ((Integer(timeMinutesString[(Player number of ownerOfMostUnits)])) Less than 10) then do (Set timeMinutesString[(Player number of ownerOfMostUnits)] = (0 + (String(timeMinutes[(Player number of ownerOfMostUnits)])))) else do (Do nothing)
Multiboard - Set the text for Multiboard item in column 4, row ((Player number of ownerOfMostUnits) + 1) to ((timeMinutesString[(Player number of ownerOfMostUnits)] + :) + (timeSecondsString[(Player number of ownerOfMostUnits)] + (: + timeMilisecsString[(Player number of ownerOfMostUnits)])))
Im not exactly sure if theres an easy way to fix this so it still works. I can post all the triggers for the timer if needed but this is the main problem probabaly.