[Code snippet] Teambalance change
Featured Replies
Сейчас на странице 0
- Нет пользователей, просматривающих эту страницу
A better way to browse. Learn more.
A full-screen app on your home screen with push notifications, badges and more.
Используя этот сайт, вы соглашаетесь Условия использования.
Hey,
here is a mini release of a teambalance mod i just made.
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.
go to _teams.gsc and search for the balanceTeams() function and change it to:
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]; //pers["teamTime"] 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]; } } }Hmm, identation gets kinda fucked up...
Or just download the attachment.
Virustotal: https://www.virustotal.com/file/26ce761 ... 341933812/