[GAME MODE] Dog eat Dog 1.1.2

Intended for use on live public servers.
15 posts Page 1 of 1 First unread post
thepolm3
Scripter
Scripter
Posts: 424
Joined: Sat Feb 16, 2013 10:49 pm


Dog eat Dog!
One rule:
  1. If you kill a player, you "eat" him. That player is dead until someone else "eats" you
Simple, but fun :D
Code: Select all
#Dog eat Dog by thepolm3; based on FFA by youself (edied by thepolm3)
#Idea by TB_ and ninja_pig_pro
 
from twisted.internet.task import LoopingCall
from random import randint, choice
from twisted.internet.reactor import callLater
from pyspades.common import to_coordinates, coordinates
from commands import add, admin, get_player, join_arguments, name, alias, get_team
from pyspades.constants import *
 
# If ALWAYS_ENABLED is False, free for all can still be enabled in the map
# metadata by setting the key 'ded' to True in the extensions dictionary
ALWAYS_ENABLED = True

nom_sayings=["{player} has nommed on {kills}! He is pwning at nommage!","omnomnom! {player} is winning with {kills}","THE KING OF NOMMAGE {player} with {kills} noms","Watch out for {player}! He has nommed on {kills} people already!"] 
# If WATER_SPANS is True, then players can spawn in water
WATER_SPAWNS = False
 
HIDE_POS = (0, 0, 63)
 
def apply_script(protocol, connection, config):
    class dedProtocol(protocol):
        game_mode=CTF_MODE
        ded=None
        winner="No-one"
        winner_kills=0
        winner_alert=0
        allow=False
        
        def winner_noms(self):
            max_noms=0
            max_player="No-One"
            for key in self.players:
                player=self.players[key]
                if player.noms>max_noms:
                    max_noms=player.noms
                    max_player=player
            self.winner=max_player.name
            self.winner_kills=max_noms
            if max_player.noms>=len(self.players)-1:
                self.allow=True
                max_player.take_flag()
                max_player.capture_flag()
                self.allow=False
                max_player.kill(type=FALL_KILL)
                self.send_chat("%s wins!" %(max_player.name))

        def winner_annoy(self):
            self.send_chat(choice(nom_sayings).format(player=self.winner,kills=self.winner_kills))

        def on_map_change(self, map):
            self.winner_alert.stop()
            extensions = self.map_info.extensions
            if ALWAYS_ENABLED or config.get("game_mode","ctf")=="ded":
                self.ded = True
            else:
                if extensions.has_key('ded'):
                    self.ded = extensions['ded']
                else:
                    self.ded = False
            if self.ded:
                self.friendly_fire = True
                self.winner_alert=LoopingCall(self.winner_annoy)
                self.winner_alert.start(10)
            return protocol.on_map_change(self, map)
        
        def on_base_spawn(self, x, y, z, base, entity_id):
            if self.ded:
                return HIDE_POS
            return protocol.on_base_spawn(self, x, y, z, base, entity_id)
 
        def on_flag_spawn(self, x, y, z, flag, entity_id):
            if self.ded:
                return HIDE_POS
            return protocol.on_flag_spawn(self, x, y, z, flag, entity_id)
 
    class dedConnection(connection):
        noms=0
        swallowed_players=[]
        eaten=False
        def on_spawn_location(self, pos):
            if self.protocol.ded:
                while True:
                    x = randint(0, 511)
                    y = randint(0, 511)
                    z = self.protocol.map.get_z(x, y)
                    if z != 63 or WATER_SPAWNS:
                        break
                # Magic numbers taken from server.py spawn function
                z -= 2.4
                x += 0.5
                y += 0.5
                return (x, y, z)
            return connection.on_spawn_location(self, pos)

        def on_connect(self):
            if self.protocol.ded and not get_team(self, "green").locked:
                get_team(self, "green").locked = True
            return connection.on_connect(self)

        def respawn(self):
            if self.eaten:
                return False
            return connection.respawn(self)

        def on_refill(self):
            if self.protocol.ded and not self.protocol.allow:
                return False
            return connection.on_refill(self)
 
        def on_flag_take(self):
            if self.protocol.ded and not self.protocol.allow:
                return False
            return connection.on_flag_take(self)
        
        def on_kill(self, by, type, grenade):
            if self.protocol.ded and by is not None and by.team is self.team and self is not by:
                by.swallowed_players.append(self)
                self.eaten=True
                self.send_chat("Oh nose! %s nomed on you! You lost all you nomms." %(by.name))
                by.noms+=1
                self.noms=0
                for player in self.swallowed_players:
                    player.eaten=False
                    player.spawn(self.position())
                    player.send_chat("Hooray! %s nommed on %s, freeing you!" %(by.name,self.name))
                self.swallowed_players=[]
                self.protocol.winner_noms()
                self.world_object.dead=True
                self.world_object.set_position(*HIDE_POS) #hide da bodiez!
            elif self.protocol.ded:
                self.noms=0
                for player in self.swallowed_players:
                    player.eaten=False
                    player.spawn(self.position())
                self.spawn(self.position())
            return connection.on_kill(self, by, type, grenade)

        def position(self):
            pos=self.world_object.position
            return pos.x+randint(-10,10),pos.y+randint(-10,10),pos.z+randint(0,5)

    return dedProtocol, dedConnection
ALL CREDIT TO TB_ AND NINJA_PIG_PRO FOR IDEAS
EDIT: removed annoying chat
EDIT: re-removed anoying chat XD
Last edited by thepolm3 on Fri May 31, 2013 1:03 pm, edited 3 times in total.
TB_
Post Demon
Post Demon
Posts: 998
Joined: Tue Nov 20, 2012 6:59 pm


OMGOMGOMGOMGOMG
Holy crap thanks a lot man! Blue_BigSmile


edit: do dead players get teleported to a viewing area, or are they forced to spectator mode?
StarDust
League Participant
League Participant
Posts: 205
Joined: Sun Nov 11, 2012 12:37 pm


looooooooooooool It looks very cool ..
thepolm3
Scripter
Scripter
Posts: 424
Joined: Sat Feb 16, 2013 10:49 pm


TB_ wrote:
do viewers get teleported to a...
Niether. It's like arena, as in you are dead and stay dead and can look at all the players on your team (which means evryone)
Ninja_pig_pro
Build and Shoot's 1st Birthday
Build and Shoot's 1st Birthday
Posts: 418
Joined: Thu Dec 20, 2012 1:24 pm


Suggestion:
Green team is locked unless killed. It unlocks and will send the player who was killed to that area. Using the mapextensions+ script set the green spawn into a disclosed area, so when you spawn you stay in that area. Using scripts from rampage it can get points, and it should check if the "killer" is on green team.
matthew0901
Deuced Up
Posts: 105
Joined: Wed Nov 21, 2012 12:23 pm


Wow your such a great scripter!!
rakiru
Coder
Coder
Posts: 1349
Joined: Sun Nov 11, 2012 12:26 pm


Ninja_pig_pro wrote:
Suggestion:
Green team is locked unless killed. It unlocks and will send the player who was killed to that area. Using the mapextensions+ script set the green spawn into a disclosed area, so when you spawn you stay in that area. Using scripts from rampage it can get points, and it should check if the "killer" is on green team.
I'd much rather be able to spectate than be stuck in a box with nothing to do.

Some people might even switch to spectator, or even blue team, if they get killed, which would just mess with things. It'd be far better to just lock green team and ignore it.
TB_
Post Demon
Post Demon
Posts: 998
Joined: Tue Nov 20, 2012 6:59 pm


Played a bit earlier, so I have some feedback to give you. Blue_Happy1

First of all, the chat was very very spammy. I think the only thing you should include is a [X player is in the lead].
You didn't need to make a message about people killing others, that's why we have the kill feed.

Also, if you manage to reset the kill count you see when you press Tab, we could easily see how many people someone has killed.

F.ex. If someone has 3 kills on the kill count, and there is 7 players online. You will automatically know that he has to kill 4 players. If he fails to do this and dies, his kill count will reset to 0. If that's possible.

The map we played on was forks. Which didn't seem to fit the gamemode very well, as it was mostly terrain. Which made it too easy to spot players from long distances. Some more buildings would fit the mode better. And full maps would also be a possibility, as you'd always find your enemies as you can just look at the map to spot them. Since they are technically on the same team.


Something else that could be possible, would be two teams. so if there are two teams with 5 players, and one of the team kills everyone but one. That last guy could revive his team mates by killing enemies. Which would be fun and exciting.
Jdrew
Mapper
Mapper
Posts: 4808
Joined: Tue Oct 30, 2012 10:48 pm


we play this in gym but we call it toga and we use dodge balls instead of funs, great gamemode though Blue_Happy3
thepolm3
Scripter
Scripter
Posts: 424
Joined: Sat Feb 16, 2013 10:49 pm


TB_ wrote:
First of all, the chat was very very spammy.
Fixed.
Sorry about the kills thing, can't figure out how to do that... Might have an idea though
But it DOES work then Blue_BigSmile
TB_
Post Demon
Post Demon
Posts: 998
Joined: Tue Nov 20, 2012 6:59 pm


Yeah, the gamemode worked and you did a great job with it. :)
You could always ask some other modders if they know how to reset the killcounter.
TB_
Post Demon
Post Demon
Posts: 998
Joined: Tue Nov 20, 2012 6:59 pm


joined danheeze's ded server. A lot of spam. :/
thepolm3
Scripter
Scripter
Posts: 424
Joined: Sat Feb 16, 2013 10:49 pm


Yeah, I've seen it. It doesn't happen when I test it.... Do you know what happened danhezee?
TB_
Post Demon
Post Demon
Posts: 998
Joined: Tue Nov 20, 2012 6:59 pm


Did you test it alone? Because I'm pretty sure it only happens when someone has died.
thepolm3
Scripter
Scripter
Posts: 424
Joined: Sat Feb 16, 2013 10:49 pm


yeah, idk whats wrong.... Maybe danhezee has changed some settings?
EDIT: fixed it! (i think)
15 posts Page 1 of 1 First unread post
Return to “Completed Releases”

Who is online

Users browsing this forum: No registered users and 29 guests