• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Trigger] Displaying remaining time for timer on multiboard.

Status
Not open for further replies.
Level 5
Joined
Jun 24, 2012
Messages
112
I'm trying to display the time remaining for a timer on a multiboard.
I'd like the time to be sorted by minutes and seconds.

For example:

05:03
00:30

For some reason it's not working and it's not updating and I'm tired :(

  • GM Hold the Flag
    • Events
    • Conditions
      • Hero - Create Shiny Flag and give it to (Random unit from GM_RndHero)
      • Countdown Timer - Start GM_HoldFlagTimer[(Player number of (Owner of (Random unit from GM_RndHero)))] as a One-shot timer that will expire in GM_HoldFlagTime[(Player number of (Owner of (Triggering unit)))] seconds
      • -------- Creating Multiboard Base --------
      • Multiboard - Create a multiboard with 2 columns and ((Number of players in HH_Players) + 1) rows, titled Scoreboard
      • Multiboard - Hide (Last created multiboard)
      • Multiboard - Minimize (Last created multiboard)
      • Multiboard - Set the text for (Last created multiboard) item in column 1, row 1 to Player Name
      • Multiboard - Set the text for (Last created multiboard) item in column 2, row 1 to Lives
      • Player Group - Pick every player in HH_Players and do (Actions)
        • Loop - Actions
          • Set Time_Integer[(Player number of (Picked player))] = (Integer((Remaining time for GM_HoldFlagTimer[(Player number of (Picked player))])))
          • Set Time_String[(Player number of (Picked player))] = (String((Time_Integer[(Player number of (Picked player))] mod 60)))
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Length of Time_String[(Player number of (Picked player))]) Less than 2
            • Then - Actions
              • Set Time_String[(Player number of (Picked player))] = (0 + Time_String[(Player number of (Picked player))])
            • Else - Actions
          • Set Multiboard_Row_Number = (Multiboard_Row_Number + 1)
          • Set Multiboard_Player_Row[(Player number of (Picked player))] = Multiboard_Row_Number
          • Multiboard - Set the text for (Last created multiboard) item in column 1, row Multiboard_Row_Number to (Player_Color[(Player number of (Picked player))] + ((Name of (Picked player)) + |r))
          • Multiboard - Set the text for (Last created multiboard) item in column 2, row Multiboard_Row_Number to ((String(Time_Integer[(Player number of (Picked player))])) + (: + Time_String[(Player number of (Picked player))]))
      • -------- Setting Widths --------
      • Multiboard - Set the width for (Last created multiboard) item in column 1, row 0 to 9.75% of the total screen width
      • Multiboard - Set the width for (Last created multiboard) item in column 2, row 0 to 2.00% of the total screen width
      • -------- Finishing Multiboard --------
      • Multiboard - Set the display style for (Last created multiboard) item in column 0, row 0 to Show text and Hide icons
      • Multiboard - Maximize (Last created multiboard)
      • Multiboard - Show (Last created multiboard)
      • Trigger - Turn on MB Update <gen>
      • Custom script: call DestroyGroup(udg_GM_HeroGroup)
      • Custom script: call DestroyGroup(udg_GM_RndHero)
      • Custom script: call DestroyTrigger(GetTriggeringTrigger())

  • MB Update
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Player Group - Pick every player in HH_Players and do (Actions)
        • Loop - Actions
          • Set Time_Integer[(Player number of (Picked player))] = (Integer((Remaining time for GM_HoldFlagTimer[(Player number of (Picked player))])))
          • Set Time_String[(Player number of (Picked player))] = (String((Time_Integer[(Player number of (Picked player))] mod 60)))
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Length of Time_String[(Player number of (Picked player))]) Less than 2
            • Then - Actions
              • Set Time_String[(Player number of (Picked player))] = (0 + Time_String[(Player number of (Picked player))])
            • Else - Actions
          • Set Multiboard_Row_Number = (Multiboard_Row_Number + 1)
          • Set Multiboard_Player_Row[(Player number of (Picked player))] = Multiboard_Row_Number
          • Multiboard - Set the text for (Last created multiboard) item in column 1, row Multiboard_Row_Number to (Player_Color[(Player number of (Picked player))] + ((Name of (Picked player)) + |r))
          • Multiboard - Set the text for (Last created multiboard) item in column 2, row Multiboard_Row_Number to ((String(Time_Integer[(Player number of (Picked player))])) + (: + Time_String[(Player number of (Picked player))]))
 

Deleted member 177737

D

Deleted member 177737

I've never seen anyone forget an event heh, it looks like it should work if you add an event to the first trigger =/
 
Level 5
Joined
Jun 24, 2012
Messages
112
I've never seen anyone forget an event heh, it looks like it should work if you add an event to the first trigger =/

Oh my bad the trigger is ran through another trigger via the action "Run Trigger (Ignoring Conditions)".

The multiboard is displaying, the problem is the time is displaying incorrectly.
 
Level 11
Joined
Aug 6, 2009
Messages
697
This is probably how I would do anything involving calculating time in a game.

  • Untitled Trigger 001
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Seconds Not equal to 60
        • Then - Actions
          • Set Seconds = (Seconds + 1)
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Seconds Equal to 60
            • Then - Actions
              • Set Minutes = (Minutes + 1)
              • Set Seconds = 0
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Minutes Equal to 60
                • Then - Actions
                  • Set Hours = (Hours + 1)
                  • Set Minutes = 0
                • Else - Actions
  • Untitled Trigger 002
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Multiboard - Set the text for (Last created multiboard) item in column 1, row 5 to (String(Hours))
      • Multiboard - Set the text for (Last created multiboard) item in column 2, row 5 to (String(Minutes))
      • Multiboard - Set the text for (Last created multiboard) item in column 3, row 5 to (String(Seconds))
 
Level 5
Joined
Jun 24, 2012
Messages
112
This is probably how I would do anything involving calculating time in a game.

  • Untitled Trigger 001
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Seconds Not equal to 60
        • Then - Actions
          • Set Seconds = (Seconds + 1)
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Seconds Equal to 60
            • Then - Actions
              • Set Minutes = (Minutes + 1)
              • Set Seconds = 0
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Minutes Equal to 60
                • Then - Actions
                  • Set Hours = (Hours + 1)
                  • Set Minutes = 0
                • Else - Actions
  • Untitled Trigger 002
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Multiboard - Set the text for (Last created multiboard) item in column 1, row 5 to (String(Hours))
      • Multiboard - Set the text for (Last created multiboard) item in column 2, row 5 to (String(Minutes))
      • Multiboard - Set the text for (Last created multiboard) item in column 3, row 5 to (String(Seconds))

HMm... not as accurate as using the timer and not as efficient but works well. Don't know why the other one didn't work since it's the same trigger I use in another map (except other map uses elapses time and not remaining time).

Will be using a modified version of this for the time being. Thanks.
 
Last edited:
Status
Not open for further replies.
Top