Raised This Month: $51 Target: $400
 12% 

[TF2] How to trigger when Setup Begins


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Malachi
Senior Member
Join Date: Jun 2010
Location: USA
Old 02-07-2013 , 15:38   [TF2] How to trigger when Setup Begins
Reply With Quote #1

I'm looking to trigger stuff when setup begins. A counterpart to the TF2 event teamplay_setup_finished, I would like to find out when setup starts.

Surely someone has done this before?

Thanks!

Last edited by Malachi; 02-07-2013 at 15:39.
Malachi is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 02-07-2013 , 16:11   Re: [TF2] How to trigger when Setup Begins
Reply With Quote #2

teamplay_round_start

Having said that, teamplay_round_start also triggers on maps that don't have setup time. You have to check the team_round_timer entities to find out which one is active and whether it has setup time. Like this, I think:

PHP Code:
#include <sdktools>

public OnPluginStart()
{
    
HookEvent("teamplay_round_start"RoundStart);
}

public 
RoundStart(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
bool:hasSetup CheckSetup();

}

bool:CheckSetup()
{
    new 
roundTimer = -1;
    
    while ((
roundTimer FindEntityByClassname(roundTimer"team_round_timer")) != -1)
    {
        
// Find current timer  Check if map is KOTH or Arena before doing this
        
if (!GetEntProp(roundTimerProp_Data"m_bIsDisabled"))
        {
            if (
GetEntProp(roundTimerProp_Data"m_nSetupTimeLength") > 0)
            {
                return 
true;
            }
        }
    }
    
    return 
false;

I haven't tested this. Also, some maps may have the timers paused rather than disabled.
__________________
Not currently working on SourceMod plugin development.

Last edited by Powerlord; 02-07-2013 at 16:21.
Powerlord is offline
Malachi
Senior Member
Join Date: Jun 2010
Location: USA
Old 02-07-2013 , 20:13   Re: [TF2] How to trigger when Setup Begins
Reply With Quote #3

Quote:
Originally Posted by Powerlord View Post
teamplay_round_start

Having said that, teamplay_round_start also triggers on maps that don't have setup time. You have to check the team_round_timer entities to find out which one is active and whether it has setup time. Like this, I think:

Thanks, this looks like what I'm after.

I'll try it out and let you know what I find.
Malachi is offline
Malachi
Senior Member
Join Date: Jun 2010
Location: USA
Old 02-18-2013 , 17:14   Re: [TF2] How to trigger when Setup Begins
Reply With Quote #4

BTW, are these entity names the same ones you see in Hammer?
Malachi is offline
Malachi
Senior Member
Join Date: Jun 2010
Location: USA
Old 03-03-2013 , 09:36   Re: [TF2] How to trigger when Setup Begins
Reply With Quote #5

How/where did you find the names for stuff like "m_bIsDisabled" and "m_nSetupTimeLength"?
Malachi is offline
11530
Veteran Member
Join Date: Sep 2011
Location: Underworld
Old 03-03-2013 , 11:24   Re: [TF2] How to trigger when Setup Begins
Reply With Quote #6

Dumping netprops and datamaps to a file.
__________________
11530 is offline
Malachi
Senior Member
Join Date: Jun 2010
Location: USA
Old 03-03-2013 , 12:32   Re: [TF2] How to trigger when Setup Begins
Reply With Quote #7

Quote:
Originally Posted by 11530 View Post
Dumping netprops and datamaps to a file.
Apparently you can get these by using the obscure* built-in SourceMod commands sm_dump_netprops and sm_dump_datamaps as discussed here:
Docs On These?


I ended up just downloading Powerlord's copies (link in the above thread) after noticing other ppl complaining about those commands causing server crashes.



* - try: Entity Properties: SourceMod Commands

Last edited by Malachi; 03-03-2013 at 12:42.
Malachi is offline
Malachi
Senior Member
Join Date: Jun 2010
Location: USA
Old 03-03-2013 , 12:34   Re: [TF2] How to trigger when Setup Begins
Reply With Quote #8

For reference, I found another thread with example code here:
TF2 How to detect if it is the setup?

Last edited by Malachi; 03-03-2013 at 12:35.
Malachi is offline
Reply



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 19:08.


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