Debriefing > Questions, Help, & How To's

Disable body armor?

<< < (4/6) > >>

major:
Here is GunGame:

http://wiki.goldeneyesource.net/index.php/GunGame_Py

drukqaddik:
cool. ill see what i can come up with. seems way more clear than lua, but well see how that goes lol.

Mark [lodle]:
Yeah thats the whole reason for the switch. Makes coding the gamemodes easier and easier for us to bind c++ stuff to python meaning more stuff can be done.

drukqaddik:
ya. i see more variables available already

killermonkey:
NOTE THIS IS NOT FINAL


--- Code: ---
from GamePlay import PYBaseGamePlay

import GEEntity, GEPlayer, GEUtil, GEWeapon, GEMPGameRules, GEGlobal

class DeathMatch(PYBaseGamePlay):
def __init__(self):
super(DeathMatch, self).__init__()

def GetIdent(self):
return "DeathMatch"

def GetPrintName(self):
return "#GES_GP_DEATHMATCH_NAME"

def GetHelpString(self):
return "#GES_GP_DEATHMATCH_HELP"

def GetGameDescription(self):
if GEMPGameRules.IsTeamplay():
return "Team Deathmatch"
else:
return "Deathmatch"

def GetTeamPlay(self):
return GEGlobal.TEAMPLAY_TOGGLE

def OnLoadGamePlay(self):
self.CreateCVar("dm_fraglimit", "0", "Enable frag limit for DeathMatch.")
self.LoadConfig()

def PreRoundBegin(self):
GEMPGameRules.SetAllowTeamSpawns( False )
GEMPGameRules.ResetAllPlayersScores()

def OnPlayerKilled(self, victim, killer, weapon):

#what exactly got killed?
if not victim:
return

#death by world
if not killer:
victim.IncrementScore( -1 )
return

if victim.GetId() == killer.GetId():
killer.IncrementScore( -1 )
elif GEMPGameRules.IsTeamplay() and killer.GetTeamNumber() == victim.GetTeamNumber():
killer.IncrementScore( -1 )
else:
# In DM we add TEAM and PLAYER scores on a kill
# We don't care if teamplay is enabled, if its not this will be ignored
team = GEMPGameRules.GetTeam(killer.GetTeamNumber())
team.IncrementScore( 1 )
killer.IncrementScore( 1 )

def OnThink(self):
fragLimit = int(GEUtil.GetCVarValue("dm_fraglimit"))
if fragLimit != 0:
if GEMPGameRules.IsTeamplay():

teamJ = GEMPGameRules.GetTeam(GEGlobal.TEAM_JANUS);
teamM = GEMPGameRules.GetTeam(GEGlobal.TEAM_MI6);

jScore = teamJ.GetRoundsWon() + teamJ.GetScore()
mScore = teamM.GetRoundsWon() + teamM.GetScore()

if jScore >= fragLimit or mScore >= fragLimit:
GEMPGameRules.EndMatch()
else:
for i in range(32):

if not GEUtil.IsValidPlayerIndex(i):
continue

player = GEUtil.GetMPPlayer(i)

if  (player.GetMatchScore() + player.GetScore()) >=  fragLimit:
GEMPGameRules.EndMatch()

--- End code ---

And some shitty first-cut wiki documentation:
http://wiki.goldeneyesource.net/index.php/Category:Python

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version