TC - CP count and locations?

Installation support, coding tips, and general tutorials.
3 posts Page 1 of 1 First unread post
shaz


Alright so on aos://1932730546:31773 I'm going to use TC as the gamemode.

However I want to know how you can set the number of control points and their locations for the TC gamemode. I guess this is just a separate script that has to be inserted in the script list?

If so, anyone got a good script I can use, I can't really find a suitable one D:
VladVP
Post Demon
Post Demon
Posts: 1425
Joined: Fri Dec 14, 2012 10:48 pm


This is waht I'm assuming you want to do:(Code is completely untested)
Code: Select all
from commands import add
from pyspades.server import Territory

cpamount = 6 #amount of control points
cpcoordb = [(10, 10),(30, 50),(50, 400)] #blue control points
cpcoordg = [(300, 20),(500, 500)] #green control points
cpcoordn = [(256, 256)] #neutral control points (if and only if applicable)

def apply_script(protocol, connection, config):
	class TerritoryProtocol(protocol):
		def get_cp_entities(self):
			entities = []
			cps = cpamount
			for n, (x,y) in enumerate(cpcoordb):
				entity = Territory(n, self, *(x,y), 0)
				if n <= cps:
					entity.team = self.blue_team
					self.blue_team.cp = entity
					self.blue_team.spawn_cp = entity
					self.blue_team.cp.disabled = False
					entities.append(entity)
					cps -= 1
				else:
					return entities
			for n, (x,y) in enumerate(cpcoordg, cpamount - cps):
				entity = Territory(n, self, *(x,y), 0)
				if n <= cps:
					entity.team = self.green_team
					self.green_time.cp = entity
					self.green_team.spawn_cp = entity
					self.green_team.cp.disabled = False
					entities.append(entity)
					cps -= 1
				else:
					return entities
			for n, (x,y) in enumerate(cpcoordn, cpamount - cps):
				entity = Territory(n, self, *(x,y), 0)
				if n <= cps:
					entities.append(entity)
				else:
					break
			return entities
	return TerritoryProtocol, connection
thepolm3
Scripter
Scripter
Posts: 424
Joined: Sat Feb 16, 2013 10:49 pm


this was created in the "Cracking the territory control code" topic. Go there (its in this forum)
3 posts Page 1 of 1 First unread post
Return to “Help!”

Who is online

Users browsing this forum: No registered users and 17 guests