Balanced lobby mode + need help with adding functions

Everything about mods can be found here.

Moderator: Morax

Balanced lobby mode + need help with adding functions

Postby Green_Nymph » 13 Mar 2018, 20:44

Hey guys i modified the FAF lobby file and added a function /bal or /balance that tells you the perfect teams and how much better the balance will be in rating points. Works for up to 12 players and for 2 teams which can be improved with help.
example.png
example.png (20.34 KiB) Viewed 927 times

Installation
To install it you need to place the file lobby.lua into
Code: Select all
C:\ProgramData\FAForever\gamedata\lua.nx2\lua\ui\lobby\
You can open lua.nx2 file with winrar. After you include the lobby.lua into the file you need to set file to read-only so FAF doesnt replace it for you.

The function goes trough all possible balance options and selects the one with the minimum diffrence between the rating of 2 teams (using the rating equal to MEAN-3*DEV wich is the same number shown in FAF lobby)
Where i need help
-Right now i have a list of all posible combinations i use but i would love to replace that with a function so it can support 16 players. I already programmed the function in python( which is how i got my list in the first place but i dont know how to write that in lua(also kinda lazy to google everything up)
python code:
Spoiler: show
Code: Select all
lista=[]
for i in range(2**12-1):
    try:
        lista[len(bin(i))-3].append(list(map(int,list(bin(i)[2:]))))
    except:
        lista.append([])

-I would like to make it so that if you are host and write /bal or /balance it automatcily moves people to spots and balances game. The problem i have is that i dont know which spots belong to a certian team so i dont know to which spots to move team 1 and team 2
-I would like for the function to tell for how much the % balance will be better which I included in my code but had to comment it out as the resoult was always -1

Thanks to Washy for help with coding
Attachments
lobby.lua
Place this in lua.nx2\lua\ui\lobby\
(309 KiB) Downloaded 107 times
Green_Nymph
Crusader
 
Posts: 19
Joined: 10 Sep 2014, 10:09
Has liked: 3 times
Been liked: 11 times
FAF User Name: NymphNoob

Return to Mods & Tools

Who is online

Users browsing this forum: No registered users and 1 guest