game_text timer

  • If you're asking a question make sure to set the thread type to be a question!

mat_phong 0

L1: Registered
Jul 10, 2017
24
9
How do I make a timer in TF2 that displays time left with game_text rather than the round timer?
 
Mar 23, 2013
1,013
347
If you really need to use a game_text then it would require a ton of outputs.
a logic_relay gives the input to start the timer and gives the game.text a new message every second.

OnTrigger - game_text - AddOutput - message 1:00 - no dalay.

OnTrigger - game_text - AddOutput - message 0:59 - 1 second delay.

OnTrigger - game_text - AddOutput - message 0:58 - 2 second delay.

And so on, for every second. It needs a new display input too every second too.
So its not very convinient and a pain if you need to change the timer when it counts downwards.

I wish a math_counter's OutValue output would work with parameters that already say something so you could add a number after the message which would make this very useful for tätimer made with game_text
 

Yabayabayaba

L5: Dapper Member
Jun 2, 2016
243
77
I think there is a simpler way, I will post a prefab when I get it working
 

Yabayabayaba

L5: Dapper Member
Jun 2, 2016
243
77
I thought I could use a math_counter to reduce the number by 1 per second, and then set it as the message of a game_test, but if the ongetvalue uses the given value as an override parameter, i need to add the rest of the addoutput stuff (message (value)) if anyone knows how to add strings I would be grateful (i also need this counter)
 
Mar 23, 2013
1,013
347
I thought I could use a math_counter to reduce the number by 1 per second, and then set it as the message of a game_test, but if the ongetvalue uses the given value as an override parameter, i need to add the rest of the addoutput stuff (message (value)) if anyone knows how to add strings I would be grateful (i also need this counter)

that's exactly what I said before and I wish it would work that way. Sadly it appears there is no way to make it work.
 

Idolon

they/them
aa
Feb 7, 2008
2,105
6,106
I remember trying to make some game_text counters to count laps in a cart racing map, but I never found a solution beyond only displaying the text every 10 laps and using pre-set messages. Eventually I decided to use the Engineer Counter prefab as a more robust counter. However, I do have an untested idea on how you can maybe make this work:

1) Create 10 game_text entities, each displaying one digit from 0-9.
2) Create a math_counter/logic_case setup that displays whatever digit the math_counter is at.
3) Repeat the above steps for every digit in your counter. Each grouping of these entities should display on a different channel and have a different X position such that they all align as you would expect.

From there you should probably be able to figure out how to hook a 1-second logic_timer up to the system and have a system that counts up or down, using the math_counters' maximum/minimum values to modify the next/previous digit in series.
 

Yabayabayaba

L5: Dapper Member
Jun 2, 2016
243
77
I managed to make a timer using team_round_timer (which just does the timer, no round wins or anything else) set to count up to what ever number you want+1, but has an output On1SecRemain_!self_Restart . This resets the timer 1 sec before it ends, but as it is set to end 1 sec after you want it to, they cancel. I have yet to test confliction with gamemode timers, so this may interfere with non-custom gamemodes
 

mat_phong 0

L1: Registered
Jul 10, 2017
24
9
Didn't expect this load of comments, but still what everyone said cold help, especially Idolon's post
 

Yabayabayaba

L5: Dapper Member
Jun 2, 2016
243
77
it might be helpful to know what you will use it for? what game mode will the map be? etc.
 

Egan

aa
Feb 14, 2010
1,375
1,720
Another option too - if it works for the map - is to use PlayerDestruction's HUD timer thing:

XEmQ9ZV.png


IO like:
SetCountdownTimer <integer> Set the countdown time and start the timer.
SetCountdownImage <string> Set the countdown image.
OnCountdownTimerExpired Sent when the countdown timer expires.

And then can logic_auto send:
SetPointsOnPlayerDeath <integer> Set number of points per flag dropped upon player death.
a 0, if you don't want flags dropping from players.

Can also, too, hide the rest of the PD hud using a custom version of it, outlined here, so that only the timer shows up / any other change.
 

mat_phong 0

L1: Registered
Jul 10, 2017
24
9
I could've used Lampenpam's method but shorter

OnTrigger - game_text - AddOutput - message 1 minute remaining - no delay.
OnTrigger - game_text - AddOutput - message 45 seconds remaining - 15s delay.
OnTrigger - game_text - AddOutput - message 30 seconds remaining - 30s delay.
OnTrigger - game_text - AddOutput - message 15 seconds remaining -45s delay.

...and from this point, it starts actually counting...

OnTrigger - game_text - AddOutput - message 5 seconds remaining - 55s delay.
OnTrigger - game_text - AddOutput - message 4 seconds remaining - 56s delay.
OnTrigger - game_text - AddOutput - message 3 seconds remaining - 57s delay.
OnTrigger - game_text - AddOutput - message 2 seconds remaining - 58s delay.
OnTrigger - game_text - AddOutput - message 1 second remaining - 59s delay.
OnTrigger - game_text - AddOutput - message [end message] - 60s delay.

I should leave all of everyone's comments because it might help people looking for things like this. They might want it, they might not, but who knows? ;)