Raised This Month: $32 Target: $400
 8% 

[TF2]Editing Round Timer


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Halt
Senior Member
Join Date: Jan 2015
Location: Black Mesa
Old 08-21-2019 , 13:48   [TF2]Editing Round Timer
Reply With Quote #1

Not entirely sure if this has been shared yet, but in my latest zombie mod we moved to an entity based timer created through the zombie mod itself. But for some reason it didn't work no matter what method we tried. Other entities worked just fine. But team_round_timer acted differently. And yes, I removed all other timers OnMapStart.

Thought I'd share my discoveries. So simply put, if you wish to have a plugin control teamplay_round_timer you must create the entity AFTER teamplay_round_start event. It removes/resets any timer entity when it fires. Now I'll share my script.

PHP Code:
#include <sourcemod>
#include <tf2>

int g_iGameTimer;

public 
void OnPluginStart()
{
  
HookEvent("teamplay_round_start"TeamPlay_Round_Start);
}

public 
TeamPlay_Round_Start(Handle eventm const char[] namebool dontBroadcast)
{
  
g_iGameTimer CreateEntityByName("team_round_timer");
  
//Dispatch Key Value/Inputs/Spawn Here
}

//Also you may want to remove this entity at end of round, or make it repeatable and re-use it.
//Note this allows you to completely control tf2 gameplay through the mod. You can add/remove time at any given point etc. 
As far as I know this is the only entity that acts this way. Also consider deleting all other team_round_timers that might be included in the map to prevent interference between the two.

Hope this helped anyone.
Halt is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 09-11-2019 , 17:15   Re: [TF2]Editing Round Timer
Reply With Quote #2

For TF2 Prop Hunt, I actually hooked my team_round_timer spawning to the SDKHook_SpawnPost of the team_control_point_master entity. As a failsafe, I check in teamplay_round_start to see if a TCPM entity exists on the map and spawn one if it doesn't. (Side note: Don't do this in CTF maps)

Granted, this was on the arena game mode, so in OnClientPutInServer, I used SendConVarValue to fake the tf_arena_round_time value to force the client UI to draw the timer background as it won't if this cvar is set to 0 (the default).
__________________
Not currently working on SourceMod plugin development.
Powerlord is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 12:30.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode