Raised This Month: $ Target: $400
 0% 

Simple Team Balancer for TFC


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Plugin Info:     Modification:   Team Fortress Classic        Category:   General Purpose        Approver:   Arkshine (91)
pizzahut
Senior Member
Join Date: Oct 2004
Old 04-06-2010 , 08:46   Simple Team Balancer for TFC
Reply With Quote #1

A team balancer for TFC

When joining a team, it checks the number of human players in all teams, and only allows joining if this wouldn't unbalance the teams.

Note: Because the plugin is based on human player count, bots should be set to even the teams. With FoxBot, use these settings in file "foxbot\tfc\foxbot.cfg":
Code:
# Bot team balance (0 off, 1 on)
# Turn this on to have the bots auto switch when teams become uneven
bot_team_balance 1

# Bot to human balance (0 off, 1 on)
# Turn this on to balance the teams in a bot to human ratio (May be buggy)
bot_bot_balance 0
Unbalanced teams can still happen by players leaving or joining the spectator team.
The human-to-human ratio can get messed up if people use auto assign while bots are present. (This is fixed in the beta.)

CVARS

stb_on (1/0) - enable the plugin (default: 1)
stb_teams (1 .. 4) - number of teams the current map has (default: 2)
stb_version - version number (visible in server rules)

Code:
Simple team balance plugin for TFC

Can be configured to work with 4 teams via cvar (stb_teams).
Put stb_teams "4" into the corresponding map cfg file (e.g. rats).

For maps where the teams are supposed to be uneven (e.g. the TFC map "hunted"),
the plugin can be disabled via map cfg file. Put stb_on "0" into the map cfg in
addons/amxmodx/configs/maps/.

Admins with immunity can switch to any team.

tfc_autoteam should be disabled when there are bots (but can be enabled for maps
like hunted), because the plugin is based on human players, which tfc_autoteam
is not.

If the cvars are changed in map configs, then the default values for the cvars
should be put into amxx.cfg or server.cfg. Else the cvars will not reset to
default after map change.
Note that only the beta is compatible with maps which feature uneven teams, e.g. hunted, ukfootie. All other plugins (stb, utw, fts) need to be configured as described above!

Beta changes

No need for map specific configs

Available teams and team size limits are detected automatically, map specific configs setting stb_on and stb_teams aren't necessary any more.

Cvar stb_handle_auto_assign

Handling auto assign prevents human players getting stacked in one team when bots are present.

0 = let TFC handle auto assign
1 = move player to the team with the least humans (default)
2 = disable auto assign

Cvar stb_immunity

Only check immunity if this cvar is "true" (1), which is the default.

Cvar stb_debug

Debug infos in console and hint in chat, off by default.

To do
  • Announcement if teams are uneven (EDIT: This is currently implemented as an alternative plugin (UTW - uneven teams warning).)
  • When a player selects auto assign (5), this command should be blocked / exchanged with the appropriate team according to human count. (Since auto assign doesn't differentiate between bots and humans.) (EDIT: This is currently in beta.)
  • Determine number of teams through pfn_keyvalue forward / function copy_keyvalue. Check which teams are used by spawns (entity class info_player_teamspawn), check entity (class) info_tfdetect for team size limits. (EDIT: This is currently in beta.)
  • "Team switch denied" sound (like the Admin Mod plugin)
  • Optional forced switching if teams become uneven Use "fts" plugin instead of "utw".
  • Perhaps a vote trigger to allow a humans vs. bots mode.
  • Optionally ignoring admin immunity (cvar). (EDIT: This is currently in beta.)
  • Scramble / shuffle teams
(There's probably more to do which I don't remember right now.)
Attached Files
File Type: sma Get Plugin or Get Source (stb.sma - 2169 views - 3.0 KB)
File Type: sma Get Plugin or Get Source (utw.sma - 1666 views - 1.7 KB)
File Type: sma Get Plugin or Get Source (fts6.sma - 1146 views - 4.3 KB)
File Type: sma Get Plugin or Get Source (shuffle_teams.sma - 1107 views - 3.4 KB)
File Type: sma Get Plugin or Get Source (stb_beta6.sma - 138 views - 6.6 KB)
__________________
My AMXX plugins (content date 2007-03-29, link check 2017-04-26)

Plugins for the Royston Vasey TFC server - These are UNSUPPORTED, except those which have been published at AMX Mod X.

Last edited by pizzahut; 07-13-2023 at 15:16. Reason: Bug fix stb_beta: Teams on avanti style maps are now detected.
pizzahut is offline
 


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 06:56.


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