Page 3 of 3

Re: Cracking the Terrority Control Code

Posted: Thu Jun 06, 2013 8:43 pm
by thepolm3
I found something out; you cannot have more than 16 cps

Re: Cracking the Terrority Control Code

Posted: Thu Jun 06, 2013 8:49 pm
by TB_
^
Interesting find, although more are probably not needed.

And btw, we could have a TOW/TC map competition where the mappers can create places where the tents will be. Sort of like on team fortress 2.

Re: Cracking the Terrority Control Code

Posted: Thu Jun 06, 2013 8:57 pm
by thepolm3
Nice idea! I'll get on it!
Edit: misread your post XD

Re: Cracking the Terrority Control Code

Posted: Fri Jun 07, 2013 7:52 am
by TB_
Get on what, the placing of tents wherever they want? Isn't that already done on this thread by BR_?
Or are you talkinga bout the map competition?

Re: Cracking the Terrority Control Code

Posted: Tue Jun 18, 2013 5:22 pm
by thepolm3
Simple setting of cps via map extensions
Code: Select all
"""
have fun!
put the extention in this format:
"territories":[(x,y),(x,y),(x,y)]
"""
from pyspades.server import Territory

def apply_script(protocol, connection, config):
    class CPProtocol(protocol):
        """game_mode=1"""


        def get_cp_entities(self):
            terretories=[] #default
            positions=[(0,0,63)] #default

            #getting positions
            extensions=self.map_info.extensions
            if extensions.has_key("territories"):
                positions=extensions['territories']
            l=len(positions)+1

            #looping through positions
            for i in range(l-1):
                pos=positions[i]

                if len(pos)>2: #if given the x,y and z
                    x,y,z=pos

                else: #if given only x and y
                    x,y=pos
                    z=self.map.get_z(x,y)

                cp=Territory(i, self, x, y, z) #creates the territory

                #sets the team                
                if i<l/2:
                    cp.team=self.blue_team
                elif i<l/2:
                    cp.team=self.green_team
                else:
                    cp.team=None

                #add the teretory to the list
                terretories.append(cp)

            #the end!
            return terretories
    return CPProtocol,connection