Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Release Teambalance routine change
#1
Hey,
here is a mini release of a teambalance mod i just made, because some people wanted the teambalance routine to be changed...
It chooses the player with the lowest "session time" on the server instead of the player that has been on the team the shortest ammount of time.

BTW: timePlayed["total"] only gets counted up if you are on axis or allies not for spectators ;D.

go to _teams.gsc and search for the balanceTeams() function and change it to:

Code:
balanceTeams()
{
    iPrintLnBold( game["strings"]["autobalance"] );
    //Create/Clear the team arrays
    AlliedPlayers = [];
    AxisPlayers = [];

    // Populate the team arrays
    players = level.players;
    for(i = 0; i < players.size; i++)
    {            
        if(!isdefined(players[i].timePlayed["total"]))
            continue;

        if((isdefined(players[i].pers["team"])) && (players[i].pers["team"] == "allies"))
            AlliedPlayers[AlliedPlayers.size] = players[i];
        else if((isdefined(players[i].pers["team"])) && (players[i].pers["team"] == "axis"))
            AxisPlayers[AxisPlayers.size] = players[i];
    }
    totalTime = undefined;
    while((AlliedPlayers.size > (AxisPlayers.size + 1)) || (AxisPlayers.size > (AlliedPlayers.size + 1)))
    {
        if(AlliedPlayers.size > (AxisPlayers.size + 1))
        {
            //(OLD) Move the player that's been on the team the shortest ammount of time (highest teamTime value) (OLD)
            
            //Move the player that's been in the server for the shortest amount of time (lowest timePlayed value)
            for(j = 0; j < AlliedPlayers.size; j++)
            {
                if(isdefined(AlliedPlayers[j].dont_auto_balance))
                    continue;
                
                if(!isdefined(totalTime))
                    totalTime = AlliedPlayers[j];        
                else if(AlliedPlayers[j].timePlayed["total"] < totalTime.timePlayed["total"])
                    totalTime = AlliedPlayers[j];
            }

            totalTime [[level.axis]]();
        }
        else if(AxisPlayers.size > (AlliedPlayers.size + 1))
        {
            //(OLD)Move the player that's been on the team the shortest ammount of time (highest teamTime value) (OLD)
            
            //Move the player that's been in the server for the shortest amount of time (lowest timePlayed value)
            for(j = 0; j < AxisPlayers.size; j++)
            {
                if(isdefined(AxisPlayers[j].dont_auto_balance))
                    continue;

                if(!isdefined(totalTime))
                    totalTime = AxisPlayers[j];
                else if(AxisPlayers[j].timePlayed["total"] < totalTime.timePlayed["total"])
                    totalTime = AxisPlayers[j];
            }

            totalTime [[level.allies]]();
        }

        totalTime = undefined;
        AlliedPlayers = [];
        AxisPlayers = [];

        players = level.players;
        for(i = 0; i < players.size; i++)
        {
            if((isdefined(players[i].pers["team"])) && (players[i].pers["team"] == "allies"))
                AlliedPlayers[AlliedPlayers.size] = players[i];
            else if((isdefined(players[i].pers["team"])) &&(players[i].pers["team"] == "axis"))
                AxisPlayers[AxisPlayers.size] = players[i];
        }
    }
}

Or just download the attachment.

Virustotal: https://www.virustotal.com/file/26ce761c...341933812/


Attached Files
.zip   z_teambalance(extract!).zip (Size: 4.36 KB / Downloads: 15)
[Image: lxkf2.jpg]
Reply

#2
Very good practical use. +1.
Reply

#3
very nice, i like this better than the old routine, just seems more reasonable to the players that have been in the server the longest, plus keeps the team balance happening without changing rounds! +1
Reply

#4
I suggest you move the first n players who die, I hate when teambalance kill me while im in a row!
My Reputation is low, help me with +1 rep if i helped you! Big Grin
Reply



Possibly Related Threads…
Thread Author Replies Views Last Post
  Using Cheat Engine 6.2 to change BO2 address values wzlrsaur 6 8,150 08-06-2013, 06:28
Last Post: 14th
  Mw3 Feed Color Change?? aluzion 5 5,913 07-16-2013, 19:52
Last Post: barata
  Change death animation Keouf 3 4,032 07-05-2013, 18:39
Last Post: Nekochan
Question Help change single file lzma maker to multiple in c# raminr63 1 3,075 05-12-2013, 19:31
Last Post: raminr63
Information How to change text messages in MP (.ff edit) giofrida 5 4,893 05-02-2013, 20:05
Last Post: Pozzuh
Its My Birthday! [Release] ServerConfigurator: Change your server settings easily JariZ 39 82,928 03-10-2013, 19:17
Last Post: wisamskay
  i want change mod to .iwd file ABDULMAILK 7 6,305 03-10-2013, 05:24
Last Post: DidUknowiPwn
Question Change Valkyrie Rockets to a Predator Missile Style? PMac18 1 2,681 01-18-2013, 06:15
Last Post: PMac18
  HOW I CAN CHANGE TEAMS NAME? s.j-rez 12 10,432 01-03-2013, 19:49
Last Post: zuiopas1
  Se7en's name change Pozzuh 31 15,110 12-13-2012, 20:07
Last Post: JariZ

Forum Jump:


Users browsing this thread:
1 Guest(s)

Forum Powered By MyBB, Theme by © 2002-2024 Melroy van den Berg.