*Request* HardPoint

5 posts Page 1 of 1 First unread post
Kamikaze_Blargle
Blue Master Race
Blue Master Race
Posts: 263
Joined: Mon Dec 17, 2012 5:43 pm


"A neutral hardpoint to capture is marked in the level. Capture and hold it to gain points." - Black Ops 2

HardPoint. My favorite 'Blops 2' Game-mode. I think it would make a great addition to the ever-expanding list of game-modes made by thepolm(or any other coder that dares attempt to beat thepolm to it). If it needs to be explained to some of you... here it is:

A single zone (CP) is marked on the map, the teams have to capture it and defend it to gain points. The zone moves after a set amount of time, say around 5 minutes - this is named the 'lifetime' of the hardpoint. When the hardpoint moves the previous one will be taken away and a new on appears somewhere else on the map. I think the server host should be able to choose a couple of things: the lifetime of the hardpoint, around 4-8 locations for the hardpoint to appear (unique for each map), and if you have time... a hardcore option - at the top of the script like so:
Code: Select all
LIFETIME = 360 #seconds
HARDCORE_HEALTH = True/False
HARDCORE_BULLET = True/False
(*note* this should be optional for the people that like to play it safe ;3)

This would either reduce everyone's health to around 10 (so that their is a slim chance for a player to survive a grenade blast, but still be '1-shotted' by any weapon) or increase all bullet damage too about 100 (but maybe reduce the shotgun bullet damage so that it isn't too overpowered.) But if you really wanted to, you could do both so their is no way of a person surviving a bullet-wound :3

I really hope someone could do this, i would love to see it be brought to life in AoS.
Hope the hardcore part isn't too over the top :P
thepolm3
Scripter
Scripter
Posts: 424
Joined: Sat Feb 16, 2013 10:49 pm


Too late ^^
Code: Select all
"""
Hardpoint
thepolm3
Idea by Kamikaze_Blargle

for map extensions;
"hardpoint":[(x,y),(x,y),(x,y)]

you can do
"hardpoint":[(x,y,z),(x,y,z),(x,y,z)]
"""

from twisted.internet.task import LoopingCall
from twisted.internet.reactor import seconds,callLater
from pyspades.constants import *
from pyspades.server import Territory

HARDCORE = False #all bullets are lethal
ANNOY = 6 #times
LIFETIME = 60 #seconds
HIDE_POS = (0,0,63)

def apply_script(protocol, connection, config):

    class HardTerritory(Territory):
        def add_player(self, player):
            if self.id==self.protocol.capturing_entity:
                Territory.add_player(self,player)


    class HardConnection(connection):

        def on_hit(self,damage,player,value,type):
            if player and player!=self and HARDCORE: return 100
            else: return connection.on_hit(self,damage,player,value,type)
            
        def on_command(self,command,parameters):

            if command=="time":
                i=self.protocol.capturing_entity
                self.send_chat("If they hold it for %d seconds, they win!" %(self.protocol.end-seconds()))
                self.send_chat("%s holds the %dth cp!" %(self.protocol.entities[i].team.name,i))
                return False
            return connection.on_command(self,command,parameters)
            
    class HardProtocol(protocol):
        telling=None
        end=None
        capturing_entity=0
        game_mode = TC_MODE

        def get_cp_entities(self):
            entities=[]
            if not self.telling:
                self.telling=LoopingCall(self.tell_time)
                self.telling.start(LIFETIME/ANNOY)
            self.end=None
            extensions=self.map_info.extensions
            if extensions.has_key("hardpoint"):
                positions=extensions["hardpoint"]
                for pos in positions:
                    if len(pos)>2: x,y,z=pos
                    else:
                        x,y=pos
                        z=self.map.get_z(x,y)
                    entity=HardTerritory(0,self,*HIDE_POS)
                    entity.team=None
                    entity.callbackpos=(x,y,z)
                    entities.append(entity)
                entities[0].x,entities[0].y,entities[0].z=entities[0].callbackpos
                return entities
            oldentities = protocol.get_cp_entities(self)
            for entity in oldentities:
                newentity=HardTerritory(0,self,*HIDE_POS)
                newentity.callbackpos=entity.x,entity.y,entity.z
                newentity.team=None
                entities.append(newentity)
            entities[0].x,entities[0].y,entities[0].z=entities[0].callbackpos
            return entities

        def tell_time(self):
            if self.end and self.end-seconds()>0:
                self.send_chat("If they hold it for %d seconds, they win!" %(self.end-seconds()))
                self.send_chat("%s holds the hill" %(self.entities[0].team.name))

        def next_cp(self):
            if self.end and self.end-seconds()<5:
                if self.capturing_entity>=len(self.entities):
                    score=0
                    for entity in entities:
                        if entity.team==self.blue_team:score+=1
                        else:score-=1
                    if score>0:self.entities[0].team=self.blue_team
                    elif score<0:self.entities[0].team=self.green_team
                    elif score==0:self.entities[0].team=None
                    self.reset_game(None,self.entities[0],True)
                    protocol.on_game_end(self)
                else:
                    entity=self.entities[self.capturing_entity]
                    entity.x,entity.y,entity.z=HIDE_POS
                    entity.update()
                    self.capturing_entity+=1
                    entity=self.entities[self.capturing_entity]
                    entity.x,entity.y,entity.z=entity.callbackpos
                    entity.update()
                    self.send_chat("%s has captured a control point!" %(self.entities[self.capturing_entity].team.name))

        def reset_game(self, player = None, territory = None, ovverule=False):
            if ovverule:
                return protocol.reset_game(self, player, territory)
            elif territory:
                territory.update()

        def on_game_end(self):
            return
            
        def on_cp_capture(self,cp):
            if cp.id==self.capturing_entity:
                self.end=LIFETIME+seconds()
                team=cp.team.name
                callLater(LIFETIME,self.next_cp)
                self.send_chat("If they hold it for %d seconds!" %(self.end-seconds()))
                self.send_chat("%s has captured a control point" %(team))
                protocol.on_cp_capture(self,cp)

    return HardProtocol, HardConnection
Attachments
hardpoint.py
(4.9 KiB) Downloaded 244 times
Kamikaze_Blargle
Blue Master Race
Blue Master Race
Posts: 263
Joined: Mon Dec 17, 2012 5:43 pm


Thanks, i love this gamemode <3
Hope that it could be hosted somewhere though :3
Awzi.
Deuce
Posts: 7
Joined: Thu Aug 01, 2013 12:09 am


Might host this if I figure out how to use map_extensions and how to change the gamemode (newbie at this whole server thing). Nice share :)
MrFritz
League Operator
League Operator
Posts: 484
Joined: Sat Nov 10, 2012 1:57 am


I would play this game mode. I hope someone considers it and gives it a test run
5 posts Page 1 of 1 First unread post
Return to “Ideas / Requests”

Who is online

Users browsing this forum: No registered users and 2 guests