Page 1 of 1

average starting gun

PostPosted: Wed May 12, 2010 12:36 am
by Methos
Currently the gun/level you enter on if a map is already in progress is lowest player's gun/level. I'm looking for an option to set the starting gun to be an average of the levels (of the players) already in the game.

PostPosted: Wed May 12, 2010 1:26 am
by PabloP
Ive also posted about this, and still agree with methos here.

Re: average starting gun

PostPosted: Mon May 17, 2010 9:53 pm
by Methos
let me know if anyone is working on this... it looks like it would require a modification of gg_handicap (to operate similar to gg4's version)... my Python skills are rudimentary, so I doubt I'd be able to do it.

PostPosted: Mon May 17, 2010 9:59 pm
by Monday
I have corrected this problem and it will be available on the next release, or you may get it from the SVN

Re: average starting gun

PostPosted: Mon May 17, 2010 10:17 pm
by Methos
Thanks Monday!

Re: average starting gun

PostPosted: Wed May 19, 2010 3:41 am
by Methos
the new gg_handicap (r442) doesn't seem to work.... made sure value was at 2, but still no go... players joining in are starting at glock.

Re: average starting gun

PostPosted: Wed May 19, 2010 8:09 am
by Monday
Methos wrote:the new gg_handicap (r442) doesn't seem to work.... made sure value was at 2, but still no go... players joining in are starting at glock.

Did you make sure you restarted the server? It worked during my testing and on my live server...

Re: average starting gun

PostPosted: Sun May 23, 2010 11:51 pm
by Methos
restart didn't seem to fix it.. i'm still looking into it.

Re: average starting gun

PostPosted: Mon May 24, 2010 6:03 am
by Monday
Methos wrote:restart didn't seem to fix it.. i'm still looking into it.


It is based on the average level of players not sitting in spec...

So if you have 4 players in the server, 2 are on level 1, and 1 guy is on level 2, and 1 guy is on level 3.... thats 1.75, but python rounds its ints down, so a new player joining will end up on level 1 still...

Re: average starting gun

PostPosted: Mon May 24, 2010 6:46 am
by XE_ManUp
Of course, there's a way around that if you are intersted in rounding:

# Set up the levels list as in the above example
levels = [1, 1, 2, 3]

# Show the average as it is now
average = sum(levels) / len(levels)
# >>> average = 1

# Now to import the rounding function (ceiling)
# http://docs.python.org/library/math.html#math.ceil
from math import ceil

# Use float to allow decimal places
average = float(sum(levels)) / len(levels)
# >>> average = 1.75

# Finally, we tie it altogether
average = int(ceil(float(sum(levels)) / len(levels)))
#>>> average = 2


Of course, you probably know this. This is moreso of an educational posting. :geek: