[GUIDE] Using zz_red/blue_koth_timers in KoTH Maps Through I/O

collacot

L1: Registered
May 28, 2023
6
0
For a more permanent place for this info, I've updated the Valve Developer Community page on tf_logic_koth.

Introduction

The zz_red_koth_timer and zz_blue_koth_timer entities are team_round_timer entities auto-generated by the tf_logic_koth entity on map load.

These timers control the separate red and blue timers on KoTH maps.

From what I can tell (especially with I/O), these auto-generated entities are fundamentally the same as regular team_round_timer entities that can be placed in-editor, with some internal changes to make them work on KoTH maps (correct me if I'm wrong on that). So therefore, they can be used exactly the same!

This is extremely useful, as it helps in general with being able to trigger things at key times (1 minute remaining) or pausing a timer that might otherwise require complex systems of math_counters and logic_timers or VScript to accomplish.

Detecting when a team goes into overtime can also be tricky, as with my testing, logic_eventlisteners do not fire on team_overtime_begin and team_overtime_end events in KoTH maps. Using I/O on these entities can also make detecting overtime easier as well. I'll explain how I do this at another time. I'll link it here when I get that done.
VScript is honestly probably a better option. But, since I am Squirrel illiterate, using sticks and rocks (hammer logic) and banging them together is easier for me to use. I might as well share it with you.

Let's look at some stuff you might be able to do with these entities and I/O!



I/O Examples

This section is basically just a copy-paste of the same section I wrote on the tf_logic_koth page on the Developer wiki.


General Information

Since these entities don't exist in editor, any I/O that interacts with them will be shown as broken. But as long as the I/O is proper, it will work.

Here is a list of all of the inputs these entities have:
  • AddContext
  • AddOutput (this is a helpful tool we'll use later in our adventure!)
  • AddTeamTime
  • AddTime
  • Alpha
  • AlternativeSorting
  • AutoCountdown
  • CallScriptFunction
  • ClearContext
  • ClearParent
  • You can also check this in the console with this command.
  • Color
    333.PNG
  • Disable
  • DisableDamageForces
  • DisableShadow
  • DispatchEffect
  • DispatchResponse
  • Enable
  • EnableDamageForces
  • EnableShadow
  • FireUser1
  • FireUser2
  • FireUser3
  • FireUser4
  • Kill
  • KillHierarchy
  • Pause
  • RemoveContext
  • Restart
  • Resume
  • RoundSpawn
  • RunScriptCode
  • RunScriptFile
  • SetDamageFilter
  • SetMaxTime
  • SetParent
  • SetParentAttachment
  • SetParentAttachmentMaintainOffset
  • SetSetupTime
  • SetTeam
  • SetTime
  • ShowInHUD
  • TerminateScriptScope
  • Use

Outputs Into the Timers

koth_timer_logic_relay_example.PNG

You can have outputs from other entities going into the timers.

For example:
Having a logic_relay (or similar entity) pause the red team's timer.

You could set this up like so:
Code:
OnTrigger -> zz_red_koth_timer -> Pause



Triggering that relay will then pause the red team's timer. Blue's time will remain unaffected.



Outputs From the Timers
22222.PNG

You can also get outputs from the timers by using AddOutput in-editor with the timers.

For example:
A logic_relay when triggered adds the output On1SecRemain on the zz_blue_koth_timer entity that displays a message from a game_text entity.

This can be setup like this:
Code:
OnTrigger -> zz_blue_koth_timer -> AddOutput -> On1SecRemain game_message:Display::0:1

This will make it so whenever our first logic_relay is triggered, a message will be displayed on screen when zz_blue_koth_timer reaches 1 second remaining.

This will ONLY happen with blue's timer. Nothing will happen if red's timer reaches 1 second remaining, unless you set the same thing up for the red team.



Outro Words

I hope I covered all the basic stuff in this! If you found any useful information out of this, I'm glad to have helped!
I'll most likely come back through all of this over time and change things. I do plan to get the overtime detection working properly, it's mostly done at this point, I just am going to add some fail-safes in and such. I'll link that here in the future, as that will probably need a separate thread.

Either way, I think that's enough blabbling for now. It's 4 AM.

Also, if I got anything wrong in this, please correct me!

Thanks for reading!
-
collacot