Raised This Month: $ Target: $400
 0% 

[TF2] Detect/Trigger Sudden Death?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Malachi
Senior Member
Join Date: Jun 2010
Location: USA
Old 03-26-2013 , 15:31   [TF2] Detect/Trigger Sudden Death?
Reply With Quote #1

In TF2 on push/pull maps, I would like to check if sudden death is enabled in the map, then have the option to trigger it.

So far, I've found that the game_round_win entity is where this is controlled. I can find if there is a game_round_win entitiy with this:

Code:
    i_RoundWin = FindEntityByClassname(-1, "game_round_win");
But after that I'm not sure where to go. I can look at:
Code:
        data = GetEntProp(i_RoundWin, Prop_Data, "m_bSwitchTeamsOnWin");
to see if the teams will get switched when rounds end, but looking through the data map doesn't give me any clues. I figure its here somewhere.

Quote:
CBaseEntity - game_round_win
- m_bForceMapReset (Save|Key)(1 Bytes) - force_map_reset
- m_bSwitchTeamsOnWin (Save|Key)(1 Bytes) - switch_teams
- m_iWinReason (Save|Key)(4 Bytes) - win_reason
- InputSetTeam (Input)(0 Bytes) - SetTeam
- InputRoundWin (Input)(0 Bytes) - RoundWin
- m_outputOnRoundWin (Save|Key|Output)(0 Bytes) - OnRoundWin
...


Any help appreciated!
Malachi is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 03-26-2013 , 16:10   Re: [TF2] Detect/Trigger Sudden Death?
Reply With Quote #2

game_round_win doesn't do anything on its own, it's usually called from a team_round_timer or team_control_point.

Having said that, I'm pretty sure that sudden death is controlled by the map type and also by server cvars. Sudden Death occurs on these map types if they have a clock: CTF, 5cp, TC, and Payload Race. However, it can be disabled by setting mp_stalemate_enable 0 in server.cfg.

I'm not sure if the GameRules m_nGameType netprop can tell you whether sudden death will happen or not. The last time I checked, it treated both cp types as the same GameType.

Edit: Apparently Sudden Death is caused by maps having a team_round_timer that makes team 0 (Unassigned) win when time runs out, either via a game_round_win for them or (more likelky) through team_control_point_master's SetWinner(0). Which is basically impossible to detect.
__________________
Not currently working on SourceMod plugin development.

Last edited by Powerlord; 03-26-2013 at 16:27.
Powerlord is offline
friagram
Veteran Member
Join Date: Sep 2012
Location: Silicon Valley
Old 03-26-2013 , 18:33   Re: [TF2] Detect/Trigger Sudden Death?
Reply With Quote #3

You could do something corny like check if the cvar is enabled, and then hook sound for the sudden death sfx... Its not like the server would play the sudden death wav file at any other time.

If you want to force sudden death to happen, you could probably spawn a team control point master and send it a stalemate win input, or spawn/set the time on a team round timer to 1 wile also setting the scores to 0.

Tf has a lot of special rules where something will,only happen sometimes under certain circumstances. If you want it to happen every time, you have to set up the framework for it to happen every time, and then trigger it when you need it.
__________________
Profile - Plugins
Add me on steam if you are seeking sp/map/model commissions.

Last edited by friagram; 03-26-2013 at 18:40.
friagram is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 03-26-2013 , 18:45   Re: [TF2] Detect/Trigger Sudden Death?
Reply With Quote #4

Quote:
Originally Posted by friagram View Post
You could do something corny like check if the cvar is enabled, and then hook sound for the sudden death sfx... Its not like the server would play the sudden death wav file at any other time.
He doesn't want to detect when Sudden Death start, but if sudden death would occur on a map. Incidentally, if you do want to detect when Sudden Death actually starts, you'd hook the teamplay_suddendeath_begin event.
__________________
Not currently working on SourceMod plugin development.
Powerlord is offline
Malachi
Senior Member
Join Date: Jun 2010
Location: USA
Old 03-27-2013 , 00:05   Re: [TF2] Detect/Trigger Sudden Death?
Reply With Quote #5

Quote:
Originally Posted by Powerlord View Post
game_round_win doesn't do anything on its own...
From looking at entities in the SDK/Hammer, it looks like game_round_win has the map setting to enable/disable sudden death.

Quote:
Originally Posted by Powerlord View Post
...it can be disabled by setting mp_stalemate_enable 0...
A cvar is easy to check/change - even if that change is temporary.

Quote:
Originally Posted by Powerlord View Post
I'm not sure if the GameRules m_nGameType netprop can tell you whether sudden death will happen or not. The last time I checked, it treated both cp types as the same GameType.
Forgot about tf_gamerules - it has the setting for 'CTF Overtime'. But I don't think that's the same as sudden death.

Quote:
Originally Posted by Powerlord View Post
...through team_control_point_master's SetWinner(0). Which is basically impossible to detect.
It might be enough to be able to trigger it - even if I have to resort to making a list of maps it works on.
Malachi is offline
Malachi
Senior Member
Join Date: Jun 2010
Location: USA
Old 03-27-2013 , 00:06   Re: [TF2] Detect/Trigger Sudden Death?
Reply With Quote #6

Quote:
Originally Posted by friagram View Post
...you could probably spawn a team control point master and send it a stalemate win input...
Well, that sounds potentially unreliable.

I'll keep it in mind, tho.
Malachi is offline
friagram
Veteran Member
Join Date: Sep 2012
Location: Silicon Valley
Old 03-27-2013 , 03:10   Re: [TF2] Detect/Trigger Sudden Death?
Reply With Quote #7

Spawning a game win or tcpm and sending thoseinputs will trigger a game win and scoreboard screen to show for sure. It was stalemating and going to overtime for me when i was developing my freezetag plugin on payload maps, very irritating.
__________________
Profile - Plugins
Add me on steam if you are seeking sp/map/model commissions.
friagram 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 00:30.


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