game_text timer

Discussion in 'Mapping Questions & Discussion' started by mat_phong 0, Aug 20, 2017.

  1. mat_phong 0

    mat_phong 0 L1: Registered

    Messages:
    24
    Positive Ratings:
    9
    How do I make a timer in TF2 that displays time left with game_text rather than the round timer?
     
  2. Lampenpam

    aa Lampenpam

    Messages:
    1,019
    Positive Ratings:
    337
    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
     
    • Thanks Thanks x 1
    • Like Like x 1
  3. mat_phong 0

    mat_phong 0 L1: Registered

    Messages:
    24
    Positive Ratings:
    9
    It'll be hard to set the timer up but thanks.
     
  4. Yabayabayaba

    Yabayabayaba L5: Dapper Member

    Messages:
    247
    Positive Ratings:
    73
    I think there is a simpler way, I will post a prefab when I get it working
     
  5. Yabayabayaba

    Yabayabayaba L5: Dapper Member

    Messages:
    247
    Positive Ratings:
    73
    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)
     
  6. Lampenpam

    aa Lampenpam

    Messages:
    1,019
    Positive Ratings:
    337
    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.
     
    • Agree Agree x 1
  7. Idolon

    aa Idolon the worst admin

    Messages:
    1,557
    Positive Ratings:
    4,479
    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.
     
  8. Yabayabayaba

    Yabayabayaba L5: Dapper Member

    Messages:
    247
    Positive Ratings:
    73
    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
     
  9. mat_phong 0

    mat_phong 0 L1: Registered

    Messages:
    24
    Positive Ratings:
    9
    Didn't expect this load of comments, but still what everyone said cold help, especially Idolon's post
     
  10. Yabayabayaba

    Yabayabayaba L5: Dapper Member

    Messages:
    247
    Positive Ratings:
    73
    it might be helpful to know what you will use it for? what game mode will the map be? etc.
     
  11. Egan

    aa Egan

    Messages:
    1,318
    Positive Ratings:
    1,512
    Another option too - if it works for the map - is to use PlayerDestruction's HUD timer thing:

    [​IMG]

    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.
     
  12. mat_phong 0

    mat_phong 0 L1: Registered

    Messages:
    24
    Positive Ratings:
    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? ;)
     
    • Thanks Thanks x 1