Page 1 of 2

[GAME MODE] Rush

Posted: Tue Jun 18, 2013 4:31 pm
by thepolm3
Sorta like TOW, but the blue team has longer respawns and can't capture teritories. If the green team capture all the teretories, they win. Otherwise, after 5 minutes, the blue team win. Sound fun?
Code: Select all
"""
Rush by thepolm3.
Horray!
"""

from pyspades.constants import *
from pyspades.server import Territory
from random import randint
from twisted.internet.reactor import callLater

CP_COUNT = 4
TIME_LIMIT=5 #minutes before blue wins
WILDNESS=10

def apply_script(protocol, connection, config):
    class RushTerritory(Territory):
    
        def add_player(self, player):
            if player.team==self.protocol.blue_team and self.team!=player.team:return
            if self.team.id:move = -1
            else: move = 1
            try:
                if self.protocol.entities[self.id+move].team==self.team:return
            except Exception:
                pass
            Territory.add_player(self, player)
        
    class RushConnection(connection):

        def get_respawn_time(self):
            if self.team==self.protocol.blue_team:
                return (self.protocol.respawn_time-1)*2
            return connection.get_respawn_time(self)
            
    class RushProtocol(protocol):
        game_mode = TC_MODE

        def get_cp_entities(self):
            entities=[]
            p=WILDNESS
            add=0
            a,b,c=randint(-p,p),randint(-p,p),randint(-p,p)
            #generate a quadratic equation (ax^2)+bx+c
            p=min(16,max(1,CP_COUNT)) #gets us a value between 1 and 16
            xspread=(min(100,500/p)) #gets how spread out the tents will be
            xstart=randint(0,abs(512-(p*xspread))) #gets where to start
            xys=[]
            for i in range(p):
                x=float((xstart+xspread*i)-256)/50 #gets the x
                y=(a*(x**2))+(b*x)+c+256 #finds the y
                x=(x*50)+256 #undoes any negativity
                xys.append([x,y]) #add it to da list
                add=min(max(add,-y),512-y) #if out of bounds, add that to all tents
            for i in range(len(xys)):
                x,y=xys[i]
                y=min(max(0,y+add),512) #get the true y
                z=self.map.get_z(x,y) #get x
                cp = RushTerritory(i,self,x,y,z) #turn this indo into a territory
                cp.team=self.blue_team
                entities.append(cp) #add it to da list
            return entities #PWNAGE AT ALGEBRA

        def on_map_change(self,map):
            callLater(TIME_LIMIT*60,self.reset_game)
            return protocol.on_map_change(self,map)

    return RushProtocol, RushConnection

Re: [GAME MODE] Rush

Posted: Tue Jun 18, 2013 4:33 pm
by KillerShot
Yes, it does sound fun. Could any server host it?

Re: [GAME MODE] Rush

Posted: Tue Jun 18, 2013 5:55 pm
by Jdrew
Best gamemode yet, besides moba that is. Keep up the great work!

Re: [GAME MODE] Rush

Posted: Wed Jun 19, 2013 12:19 am
by Handles
Wow, nice. I should talk to topo or PABH or tin and ask them to use this in their next event Green_BigSmile

Re: [GAME MODE] Rush

Posted: Fri Jun 21, 2013 3:24 pm
by IceCream
nice script thepolm3 :)

btw. I could host a server, if you want.

IceCraft

Re: [GAME MODE] Rush

Posted: Fri Jun 21, 2013 3:29 pm
by Jdrew
IceCraft wrote:
nice script thepolm3 :)

btw. I could host a server, if you want.

IceCraft
I would like that

Re: [GAME MODE] Rush

Posted: Fri Jun 21, 2013 5:31 pm
by IceCream
k server online

Re: [GAME MODE] Rush

Posted: Fri Jun 21, 2013 6:16 pm
by IceCream
btw., the anti-respawn makes the gamemode a bit boring and the players mad. they disconnect very fast. may you could chnage it? :)

Re: [GAME MODE] Rush

Posted: Fri Jun 21, 2013 6:30 pm
by Jdrew
I tested it ot on icecraft and heres what I think. The gamemode is fun, kind like a tc version of infiltration, but the no respawn makes a lot of the players mad and forces them to leave. Its fun but with the no respawn it makes the gamemode boring.

Re: [GAME MODE] Rush

Posted: Fri Jun 21, 2013 6:42 pm
by thepolm3
What would you suggest?
You understand, I just implemented a suggestion I got

Re: [GAME MODE] Rush

Posted: Fri Jun 21, 2013 7:09 pm
by Jdrew
I suggest having the respawn be set at 7 seconds, the gamemode is fine you just need to enable respawning. Can you define the respawn time in the gamemode?

Re: [GAME MODE] Rush

Posted: Sat Jun 22, 2013 8:54 am
by thepolm3
Finished!
Now blue takes double the time to respawn, but doesn't have limited respawns

Re: [GAME MODE] Rush

Posted: Tue Jun 25, 2013 7:08 pm
by XxXAtlanXxX
<3

Re: [GAME MODE] Rush

Posted: Tue Jun 25, 2013 7:38 pm
by Venator
thepolm3 masterscripter.
<33333

Re: [GAME MODE] Rush

Posted: Wed Jun 26, 2013 12:33 am
by TB_
Do the tents spawn at random places, or do you select it some places for custom maps?