Cracking the Terrority Control Code

Incomplete code that isn't ready for use.
35 posts Page 3 of 3 First unread post
thepolm3
Scripter
Scripter
Posts: 424
Joined: Sat Feb 16, 2013 10:49 pm


I found something out; you cannot have more than 16 cps
TB_
Post Demon
Post Demon
Posts: 998
Joined: Tue Nov 20, 2012 6:59 pm


^
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.
thepolm3
Scripter
Scripter
Posts: 424
Joined: Sat Feb 16, 2013 10:49 pm


Nice idea! I'll get on it!
Edit: misread your post XD
Last edited by thepolm3 on Fri Jun 07, 2013 5:34 pm, edited 1 time in total.
TB_
Post Demon
Post Demon
Posts: 998
Joined: Tue Nov 20, 2012 6:59 pm


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?
thepolm3
Scripter
Scripter
Posts: 424
Joined: Sat Feb 16, 2013 10:49 pm


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   
Attachments
CustomTerritories.py
(1.4 KiB) Downloaded 243 times
35 posts Page 3 of 3 First unread post
Return to “Work In Progress”

Who is online

Users browsing this forum: No registered users and 14 guests