Possible To Alter Team Player Ratioss?

Bullet_ForceBullet_Force Join Date: 2012-11-02 Member: 165952Members
<div class="IPBDescription">A question on modding</div>I am looking to make a mod that would alter the number of players allowed on one team compared with the other. Ie for every player on Team A there are 2 on Team B. Is this possible to do with auto balance?

Comments

  • Soul_RiderSoul_Rider Mod Bean Join Date: 2004-06-19 Member: 29388Members, Constellation, Squad Five Blue
    edited November 2012
    Yes, it's very simple. You would just need to change the code in NS2_Gamerules.lua

    Edit this function:

    <!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->// Enforce balanced teams
        function NS2Gamerules:GetCanJoinTeamNumber(teamNumber)

            local team1Players = self.team1:GetNumPlayers()
            local team2Players = self.team2:GetNumPlayers()
            
            if (team1Players > team2Players) and (teamNumber == self.team1:GetTeamNumber()) then
                return false
            elseif (team2Players > team1Players) and (teamNumber == self.team2:GetTeamNumber()) then
                return false
            end
            
            return true

        end<!--c2--></div><!--ec2-->

    Also remember to update the auto-team balance code, the join random team code and the numbers of players per team. I have published how do set teams with different numbers of players on this forum previously, but that was before all this auto-balance stuff was added...
Sign In or Register to comment.