• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[General] count time ?

Level 2
Joined
Apr 25, 2023
Messages
14
Is there a simple trigger for counting time? to 60 seconds is 1:00:00 then count +1 next ? because i looked it up but i don't understand the timer filter
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,558
There's nothing really simple if you want it to look nice. What exactly is a Timer filter? I don't think that's a thing in Warcraft 3. There's Timer variables, which are basically just stopwatches that execute triggers when they expire. Want something to happen every 2.50 seconds? Use a Timer variable. Then there's Timer Window variables, which are what I'm sure you've seen before in the top right corner of the screen. These can be attached to a Timer variable in order to display it's current time as well as a title like "Enemies spawn in X seconds".

Here's some tutorials:
They're a bit dated but the methods haven't really changed over the years.

If you're on the latest version of Warcraft 3 I would be willing to help you some more.

Edit: I was bored and already made something like this before. See the attached map for a custom game timer which replaces the Upkeep text. The triggers and code are all setup to run automatically without you needing to do anything. However, you do need to Export the three files in the Asset Manager and import them into your map for the system to work. Make sure their file names stay exactly the same! Also, the system doesn't NEED to replace the Upkeep text, you can disable that part of the code as well as move/adjust the clock icon and time text to wherever you'd like.
 

Attachments

  • Game Time Frame 1.w3m
    20.5 KB · Views: 10
Last edited:
Level 18
Joined
Mar 16, 2008
Messages
721
Is there a simple trigger for counting time? to 60 seconds is 1:00:00 then count +1 next ? because i looked it up but i don't understand the timer filter
I'm confused what you want. Why can't you just count down from 60 instead of up from 60? who cares what the game time is anyway.

If i'm understanding you correctly, you want something like this:
  • init
    • Events
      • Time - Elapsed game time is 0.00 seconds
    • Conditions
    • Actions
      • Countdown Timer - Start timer_variable as a One-shot timer that will expire in 60.00 seconds
  • timer expires count minutes
    • Events
      • Time - timer_variable expires
    • Conditions
    • Actions
      • Set VariableSet minutes_variable = (minutes_variable + 1)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • minutes_variable Equal to 60
        • Then - Actions
          • Set VariableSet minutes_variable = (minutes_variable + 1)
          • Set VariableSet hours_variable = (hours_variable + 1)
        • Else - Actions
      • Game - Display to (All players) for 30.00 seconds the text: (Game Time: + ((String(hours_variable)) + ( hours + ((String(minutes_variable)) + minutes))))
      • Countdown Timer - Start timer_variable as a One-shot timer that will expire in 60.00 seconds
 
Level 2
Joined
Apr 25, 2023
Messages
14
thanks for the reply , but i am not using the latest version , i cannot open your file
There's nothing really simple if you want it to look nice. What exactly is a Timer filter? I don't think that's a thing in Warcraft 3. There's Timer variables, which are basically just stopwatches that execute triggers when they expire. Want something to happen every 2.50 seconds? Use a Timer variable. Then there's Timer Window variables, which are what I'm sure you've seen before in the top right corner of the screen. These can be attached to a Timer variable in order to display it's current time as well as a title like "Enemies spawn in X seconds".

Here's some tutorials:
They're a bit dated but the methods haven't really changed over the years.

If you're on the latest version of Warcraft 3 I would be willing to help you some more.

Edit: I was bored and already made something like this before. See the attached map for a custom game timer which replaces the Upkeep text. The triggers and code are all setup to run automatically without you needing to do anything. However, you do need to Export the three files in the Asset Manager and import them into your map for the system to work. Make sure their file names stay exactly the same! Also, the system doesn't NEED to replace the Upkeep text, you can disable that part of the code as well as move/adjust the clock icon and time text to wherever you'd like.
 
Level 2
Joined
Apr 25, 2023
Messages
14
I'm confused what you want. Why can't you just count down from 60 instead of up from 60? who cares what the game time is anyway.

If i'm understanding you correctly, you want something like this:
  • init
    • Events
      • Time - Elapsed game time is 0.00 seconds
    • Conditions
    • Actions
      • Countdown Timer - Start timer_variable as a One-shot timer that will expire in 60.00 seconds
  • timer expires count minutes
    • Events
      • Time - timer_variable expires
    • Conditions
    • Actions
      • Set VariableSet minutes_variable = (minutes_variable + 1)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • minutes_variable Equal to 60
        • Then - Actions
          • Set VariableSet minutes_variable = (minutes_variable + 1)
          • Set VariableSet hours_variable = (hours_variable + 1)
        • Else - Actions
      • Game - Display to (All players) for 30.00 seconds the text: (Game Time: + ((String(hours_variable)) + ( hours + ((String(minutes_variable)) + minutes))))
      • Countdown Timer - Start timer_variable as a One-shot timer that will expire in 60.00 seconds
could create it by multi board ?
1682852517205.png

look like this , but it has timer
 
Last edited:
Level 18
Joined
Mar 16, 2008
Messages
721
yes let me try to explain how to set up the triggers outlined by Uncle above:

1) make three integer variables for seconds, minutes, hours

2) make a custom script (ctrl+U) and copy this code into it
JASS:
library GameTimeFrame initializer InitGTF

globals
    framehandle gameTimeText = null
    framehandle gameTimeIcon = null
    string min = "0"
    string sec = "0"
    string time = "0"
endglobals

function UpdateGameTimeFrame takes nothing returns nothing
    set sec = "0"
    set min = "0"

    if udg_Game_Time_Seconds >= 10 then
        set sec = ""
    endif
    if udg_Game_Time_Minutes >= 10 then
        set min = ""
    endif

    set time = I2S(udg_Game_Time_Hours) + ":" + min + I2S(udg_Game_Time_Minutes) + ":" + sec + I2S(udg_Game_Time_Seconds)
    call BlzFrameSetText(gameTimeText, time)
endfunction

function CreateGameTimeFrame takes nothing returns nothing
    local framehandle fh = BlzGetFrameByName("ResourceBarUpkeepText", 0)

    // Hides the "Upkeep" info in the resource bar
    call BlzFrameClearAllPoints(fh)
    call BlzFrameSetAbsPoint(fh, FRAMEPOINT_CENTER, 3, 3)
    call BlzFrameSetScale(fh, 0.001)

    set gameTimeIcon = BlzCreateSimpleFrame("GTFTexture", BlzGetOriginFrame(ORIGIN_FRAME_GAME_UI, 0), 0)
    call BlzFrameSetTexture(BlzGetFrameByName("GTFTextureValue", 0), "GTFIcon.dds", 0, true)
    call BlzFrameSetAbsPoint(gameTimeIcon, FRAMEPOINT_CENTER, 0.73, 0.589)
    call BlzFrameSetSize(gameTimeIcon, 0.018, 0.018)
    call BlzFrameSetLevel(gameTimeIcon, 1)

    set gameTimeText = BlzCreateFrame("GTFText", BlzGetOriginFrame(ORIGIN_FRAME_GAME_UI, 0), 0, 0)
    call BlzFrameSetAbsPoint(gameTimeText, FRAMEPOINT_CENTER, 0.775, 0.589)
    call BlzFrameSetText(gameTimeText, "0:00:00")
    call BlzFrameSetLevel(gameTimeText, 1)

    set fh = null
endfunction

function InitGTF takes nothing returns nothing
    call BlzLoadTOCFile("war3mapimported\\GTF.toc")
    call CreateGameTimeFrame()
endfunction

endlibrary

3) create this trigger:
  • Game Time Frame
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • -------- Increase the amount of time that has passed: --------
      • Set VariableSet Game_Time_Seconds = (Game_Time_Seconds + 1)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Game_Time_Seconds Equal to 60
        • Then - Actions
          • Set VariableSet Game_Time_Seconds = 0
          • Set VariableSet Game_Time_Minutes = (Game_Time_Minutes + 1)
          • -------- --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Game_Time_Minutes Equal to 60
            • Then - Actions
              • Set VariableSet Game_Time_Minutes = 0
              • Set VariableSet Game_Time_Hours = (Game_Time_Hours + 1)
            • Else - Actions
        • Else - Actions
      • -------- --------
      • -------- Run the code that updates the custom game time frame in the top right corner of the screen: --------
      • Custom script: call UpdateGameTimeFrame()

4) import these files to the import manager (f12):

i can try to explain in more detail later i'm a bit sleepy now.

i can't attach the .fdf and .toc file, not sure those are needed actually?

let me know if this works or not and we can get it working :thumbs_up:

edit: sorry maybe this isn't a great explanation but i'm a bit sleepy, i can clarify after i get some sleep but figured might as well leave you with this for now and maybe it will help?
 

Attachments

  • GTFIcon.dds
    4.1 KB · Views: 3
Level 2
Joined
Apr 25, 2023
Messages
14
1683372863814.png


i don't understand jass fix , i did exactly what you said it comes up with this error and also jass , can you have that map ?
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,558
I can open your map if you attach it. You just can't open newer maps since you're not up to date.

That looks correct. Make sure your Jass trigger is at the very top of the trigger editor, it needs to be above whatever is using it.
Also, make sure you have JassHelper enabled (check the menu at the top of the Trigger Editor).

Also, posting your trigger can help as well.
 
Last edited:
Level 2
Joined
Apr 25, 2023
Messages
14
most of the new versions can open the map in the old version, right?
 

Attachments

  • Time.w3x
    17 KB · Views: 2
Top