average starting gun

Request a custom addon/script you would like to see made.

average starting gun

Postby Methos » Wed May 12, 2010 12:36 am

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.
Methos

Private
Private
 
Posts: 6
Joined: Wed May 12, 2010 12:22 am

Postby PabloP » Wed May 12, 2010 1:26 am

Ive also posted about this, and still agree with methos here.
PabloP

Private 1st Class
Private 1st Class
 
Posts: 141
Joined: Tue Mar 02, 2010 1:02 am

Re: average starting gun

Postby Methos » Mon May 17, 2010 9:53 pm

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.
Methos

Private
Private
 
Posts: 6
Joined: Wed May 12, 2010 12:22 am

Postby Monday » Mon May 17, 2010 9:59 pm

I have corrected this problem and it will be available on the next release, or you may get it from the SVN
Monday

Site Admin
Site Admin
User avatar
 
Posts: 97
Joined: Sat Feb 14, 2009 1:51 am

Re: average starting gun

Postby Methos » Mon May 17, 2010 10:17 pm

Thanks Monday!
Methos

Private
Private
 
Posts: 6
Joined: Wed May 12, 2010 12:22 am

Re: average starting gun

Postby Methos » Wed May 19, 2010 3:41 am

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.
Methos

Private
Private
 
Posts: 6
Joined: Wed May 12, 2010 12:22 am

Re: average starting gun

Postby Monday » Wed May 19, 2010 8:09 am

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...
GunGame Developer

If you ask something stupid before reading the instructions that are likely included in the files, I will make fun of you for being a lazy idiot.
Monday

Site Admin
Site Admin
User avatar
 
Posts: 97
Joined: Sat Feb 14, 2009 1:51 am

Re: average starting gun

Postby Methos » Sun May 23, 2010 11:51 pm

restart didn't seem to fix it.. i'm still looking into it.
Methos

Private
Private
 
Posts: 6
Joined: Wed May 12, 2010 12:22 am

Re: average starting gun

Postby Monday » Mon May 24, 2010 6:03 am

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...
GunGame Developer

If you ask something stupid before reading the instructions that are likely included in the files, I will make fun of you for being a lazy idiot.
Monday

Site Admin
Site Admin
User avatar
 
Posts: 97
Joined: Sat Feb 14, 2009 1:51 am

Re: average starting gun

Postby XE_ManUp » Mon May 24, 2010 6:46 am

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:
XE_ManUp

Site Admin
Site Admin
 
Posts: 662
Joined: Sat Sep 06, 2008 3:36 am



Return to Script Requests

Who is online

Users browsing this forum: No registered users and 5 guests

cron