gametechmods
Robot Arena => General Support => Topic started by: Paranoia on June 08, 2013, 09:24:06 AM
-
def Tick(self):
# check to see if anyone has been "eliminated" by falling off the tabletop
for each in self.players:
if plus.getLocation(each)[1] < -6:
plus.eliminatePlayer(each)
deathOpt = ("Misc_SinisterLaugh1.wav", "Misc_SinisterLaugh3.wav", "Misc_DontLookDown.wav")
sounds['death'] = plus.createSound("Sounds/announcers/"+random.choice(deathOpt), False, (0,0,0))
plus.playSound(sounds['death'])
This script is part of that from Flextop, it causes a Runtime-Error when a bot is eliminated from falling. Any idea why?
-
The variable "sounds" is not defined in that scope (RA2 doesn't know that you assigned a dictionary named "sounds" because you only have it looking locally and the actual variable is defined locally in another method). Without any sort of testing, I'm thinking that this would work for you:
def Tick(self):
# check to see if anyone has been "eliminated" by falling off the tabletop
for each in self.players:
plus.eliminatePlayer(each)
deathOpt = ("Misc_SinisterLaugh1.wav", "Misc_SinisterLaugh3.wav", "Misc_DontLookDown.wav")
deathSound = plus.createSound("Sounds/announcers/"+random.choice(deathOpt), False, (0,0,0))
plus.playSound(deathSound)