- Posts
- 798
- Likes
- 875
Hello community. As some of you may know, I recently started writing a script that would allow for an automated way to limit the amount of players that are allowed to join a class in MovieBattles II Open Mode.
This script is external to MovieBattles II and functions as a plugin, similar to the RTV/RTM plugin.
As such, it does not have the optimal functionality (for example it cannot prevent people from selecting a class and can only display warning messages at a certain time). But that's ok, since it was meant as a quick way to introduce class limits in MBII gameplay, as a temporary solution until class limits are properly coded within MBII itself, at which point they should have all expected functionality.
The script works by reading the server log and sending svsay and forceteam commands to the server according to classes picked by the players.
If a player picks a class after its limit has been reached, he/she will receive a warning.
If the player doesn't switch classes in time to an available one, the script will forceteam him/her to spectator.
Due to the nature of the script, the time between warning and forceteam may be limited to a few seconds, so it's advisable that a player looks at which classes are available before a new round begins. This can be done by joining a team and pressing "TAB". The classes of the players in the team will be shown in the scoreboard.
The class limits themselves are announced by the script once they are enabled. For repeat announcements, it is advisable to use the embedded DisplayMessage functionality (see below).
This script can be used by any server owner and is currently used on OFFICIAL HARDCORE servers (COMPETITIVE mode) and BG Class Limits server (LIMITS mode).
The following files are attached in this thread:
ClassLimits.exe - This is the script itself
cl.cfg - an example configuration file, similar to rtvrtm.cfg for RTV
readme.txt - the readme
LimitsCalculator.exe - a quick app I put together that allows you to easily calculate the limits you want and creates the configuration string for cl.cfg
Please note that while the script has been extensively debugged, it may still have bugs that I am unaware of.
Credits for helping with the debugging to: @AaronAaron, @DaloLorn, @eksha, @fortiseven, @FRANK LAMPART, @HuntresS, @Liniyka_xddd, @Mcbober, @Nex, @NPC, @Quinto, @qwerty, @Threepwood
Mode explanation:
This script supports two modes: LIMITS and COMPETITIVE. A third option is to disabled all limits with DISABLED mode.
*****************************************************************************************************************
DISABLED Mode
*****************************************************************************************************************
To allow for class limits to be disabled without stopping this script, the Mode in cl.cfg can be changed to DISABLED.
This removes the need to start the script on an empty server if you want to enable COMPETITIVE mode, as all you have to do is start the script on an empty server once, then use DISABLED Mode to disable all limits until you want to enable them again.
You can then switch to COMPETITIVE mode while the server is populated.
*****************************************************************************************************************
LIMITS Mode
*****************************************************************************************************************
The LIMITS mode applies predefined limits for each class to the server.
These limits can be changed anytime on the cl.cfg script by editing the Limits variable.
The script will detect new limits every 5 seconds.
Supported limits range from 0 (class disabled) to 32 for all classes.
The class order on the Limits variable is: Reb Soldier, Jedi, Hero, Mandalorian, Wookiee, Droideka, Clone Trooper, Reb Commander, Super Battle Droid, Arc Trooper, Bounty Hunter, Imp Soldier, Sith, Imp Commander
For example, if Limits is defined as: Limits=00-00-01-00-00-00-00-00-00-00-00-00-00-01 then the script will allow 1 Hero and one Imp Commander. All other classes will be disabled.
WARNING: The script does not check if the defined limits allow all players to join a class. This means if your limits allows for 3 class spots in total but your server supports 12 players, then 9 players will not be able to play. It is up to you to define the limits correctly.
*****************************************************************************************************************
COMPETITIVE Mode
*****************************************************************************************************************
The COMPETITIVE mode functions on the premise that all classes have the same limit, which depends on the total number of people on the server.
The limit changes between the values of 1, 2 and 3 depending on the number of players in the server.
The number of players at which the limit will change to 2 or 3 is defined in the cl.cfg with the Limits2 and Limits3 variables.
These are checked to ensure that all players in the server can join the game. This means that Limits2 cannot be larger than 15 (as a limit of 1 supports up to 14 players) and Limits3 cannot be larger than 29 (as a limit of 2 supports up to 28 players).
*****************************************************************************************************************
Configuration:
Please enter the following values in cl.cfg:
- IP: Server IP
- Port: Server port
- RCON: Server rconpassword
- log_path: Absolute path to server log file
- DisplayMessage: Message you want to be repeated via svsay on the server (leave blank to disable). Make sure it doesn't contain an '=' character
- DisplayMessage2: Second message you want to be repeated via svsay on the server (leave blank to disable). Make sure it doesn't contain an '=' character
- RepeatInterval: How often the DisplayMessages will be repeated, in seconds (between 5 and 1800)
- Mode: LIMITS or COMPETITIVE or DISABLED
- Limits: The predefined Class Limits, in XX format, for all 14 classes separated by a -, for example: 00-00-01-00-00-00-00-00-00-00-00-00-00-01 (for LIMITS mode). Class order: Reb Soldier, Jedi, Hero, Mandalorian, Wookiee, Droideka, Clone Trooper, Reb Commander, Super Battle Droid, Arc Trooper, Bounty Hunter, Imp Soldier, Sith, Imp Commander
- Limits2: Number of players that must be connected to the server for Class Limit to increase to 2 (for COMPETITIVE mode)
- Limits3: Number of players that must be connected to the server for Class Limit to increase to 3 (for COMPETITIVE mode)
How to use:
The script is configured in the cl.cfg configuration file, which must be saved in the same directory as the executable. The script reads cl.cfg for any changes every 5 seconds.
- Start this script after the server has been started and while the server is empty.
- There is no requirement to clean the server log before starting this script.
- If you only want to use LIMITS mode, the script can be activated when the server is populated.
- COMPETITIVE mode will NOT work unless the script was started on empty server.
- If the script was started on a populated server then COMPETITIVE mode will only start working properly when server becomes empty again.
- Until that happens, the script won't count the population properly and the limits won't be changed when they should.
TIP: To remove the g_password, set it to "none"
V2.1: The mode can now be also controlled via /smod say and /rcon say by typing "!mode <mode>" where <mode> is COMPETTIVE, LIMITS, or DISABLED. This will overwrite the mode defined in cl.cfg until cl.cfg mode is changed again.
KNOWN ISSUES:
- This script sends rcon commands to the server. If a forceteam command happens to overlap with commands from another source (e.g. automessages, RTV, manual rcon commands), it is possible that the forceteam will NOT go through and therefore the script will allow that player to exceed the class limit until he either joins spectator or changes class. This is unlikely but may still happen.
- RTV archiving may interfere with this script as a few lines (1 line probably) might NOT be written in the log while RTV archives. Unlikely that these lines will be important, but if they are related to a client disconnect this could cause a problem with the script.
Download here
Last edited: