Entropy, thank you for your support
I think I did it the way you asked, but in addition to the errors below, I believe I need to change something in the GamePlayManager.py file. The following is the log
************LOG ERROR****************
Attempting to load scenario: LTK
Traceback (most recent call last):
File "c:\sourceges\gesource\python/ges\GamePlayManager.py", line 46, in LoadScenario
scenario = getattr( sys.modules[module], scenario_name )()
KeyError: 'GamePlay.LTK'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "c:\sourceges\gesource\python/ges\GamePlayManager.py", line 50, in LoadScenario
__import__( module, globals(), locals() )
File "c:\sourceges\gesource\python/ges\GamePlay\LTK.py", line 31
self.warmupTimer = GEWarmUp( self )
^
TabError: inconsistent use of tabs and spaces in indentation
Scenario load failed for LTK! Reverting back to DeathMatch.
******************LTK.PY********************************************
from .DeathMatch import DeathMatch
from .Utils.GEWarmUp import GEWarmUp
from .Utils import GetPlayers
import GEPlayer, GEUtil, GEMPGameRules as GERules, GEGlobal as Glb
USING_API = Glb.API_VERSION_1_2_0
# LTK is just deathmatch with no armor, a high damage multiplier, and popout help.
class LTK( DeathMatch ):
def GetPrintName( self ):
return "#GES_GP_LTK_NAME"
self.warmupTimer = GEWarmUp( self )
def GetScenarioHelp( self, help_obj ):
help_obj.SetDescription( "#GES_GP_LTK_HELP" )
def GetGameDescription( self ):
if GERules.IsTeamplay():
return "Team LTK"
else:
return "LTK"
def OnLoadGamePlay( self ):
super( LTK, self ).OnLoadGamePlay()
self.ltk_SetDamageMultiplier( 1000 )
GERules.SetSpawnInvulnTime( 0, True )
self.warmupTimer.StartWarmup(0)
def OnUnloadGamePlay(self):
self.warmupTimer = None
def OnPlayerConnect( self, player ):
player.SetDamageMultiplier( 1000 )
def OnPlayerSpawn( self, player ):
if player.IsInitialSpawn():
GEUtil.PopupMessage( player, "#GES_GP_LTK_NAME", "#GES_GPH_LTK_GOAL" )
def OnRoundBegin( self ):
super( LTK, self ).OnRoundBegin()
GERules.DisableArmorSpawns()
def ltk_SetDamageMultiplier( self, amount ):
for player in GetPlayers():
player.SetDamageMultiplier( amount )
**************************GamePlayManager.py**************************
import sys
import GEGamePlay, GEUtil
from GEGlobal import PY_BASE_DIR
import GamePlay
from GESFuncs import *
class PYGamePlayManager( GEGamePlay.CGamePlayManager ):
def __init__( self ):
super( PYGamePlayManager, self ).__init__()
import reimport
reimport.reimport( GamePlay )
def LoadScenario( self, scenario_name ):
found_scenario = FindModule( GamePlay, scenario_name )
if not found_scenario:
GEUtil.Warning( "Failed to find scenario %s!\n" % scenario_name )
return None
else:
# Assign the found scenario to ensure we have the right case
scenario_name = found_scenario
module = "GamePlay.%s" % scenario_name
scenario = None
try:
# Try to load immediately, fallback to import if new class
scenario = getattr( sys.modules[module], scenario_name )()
print( "Loading scenario %s from cache" % scenario_name )
except KeyError:
try:
__import__( module, globals(), locals() )
scenario = getattr( sys.modules[module], scenario_name )()
print( "Loading scenario %s from disk" % scenario_name )
except ImportError:
PrintError( "Failed to load scenario %s\n" % scenario_name )
if scenario and not CheckAPI( sys.modules[module], GEGlobal.API_GP_VERSION ):
GEUtil.Warning( "Scenario load FAILED due to API mismatch.\n" )
return None
return scenario
pyGamePlayMangObj = None
def GetManager():
global pyGamePlayMangObj
if not pyGamePlayMangObj:
pyGamePlayMangObj = PYGamePlayManager()
return pyGamePlayMangObj
def PurgeManager():
global pyGamePlayMangObj
pyGamePlayMangObj = None