• Register
Forum Thread
  Posts  
Help something is wrong with my script. (Forums : Coding & Scripting : Help something is wrong with my script.) Locked
Thread Options
Jan 12 2015 Anchor
    def setLevel(self, lvl = None):
        attributes = SuitBattleGlobals.SuitAttributes[self.dna.name]
        if lvl is not None:
            self.level = lvl - attributes['level'] - 1
        else:
            self.level = SuitBattleGlobals.pickFromFreqList(attributes['freq'])
        self.notify.debug('Assigning level ' + str(lvl))
        if hasattr(self, 'doId'):
            self.d_setLevelDist(self.level)
        hp = attributes['hp'][self.level]
        self.maxHP = hp
        self.currHP = hp

here is my log tell me what else i should show u so u can help me figure this out

Traceback (most recent call last):  File "toontown\election\DistributedSafezoneInvasionAI.py", line 361, in spawnOne    suit.setLevel(levelOffset)  File "toontown\suit\DistributedSuitBaseAI.py", line 57, in setLevel    hp = attributes['hp'][self.level]IndexError: tuple index out of range:task(error): Exception occurred in PythonTask summon-suit-1-401003822Traceback (most recent call last):  File "C:\Panda3D-1.9.0\python\lib\runpy.py", line 162, in _run_module_as_main    "__main__", fname, loader, pkg_name)  File "C:\Panda3D-1.9.0\python\lib\runpy.py", line 72, in _run_code    exec code in run_globals  File "C:\Users\Administrator\Google Drive\ToonTownServer\ttw-election-branch\toontown\ai\ServiceStart.py", line 48, in     run()  File "otp\ai\AIBase.py", line 190, in run    self.taskMgr.run()  File "C:\Panda3D-1.9.0\direct\task\Task.py", line 502, in run    self.step()  File "C:\Panda3D-1.9.0\direct\task\Task.py", line 460, in step    self.mgr.poll()  File "toontown\election\DistributedSafezoneInvasionAI.py", line 361, in spawnOne    suit.setLevel(levelOffset)  File "toontown\suit\DistributedSuitBaseAI.py", line 57, in setLevel    hp = attributes['hp'][self.level]IndexError: tuple index out of range
Traceback (most recent call last):  File "toontown\election\DistributedSafezoneInvasionAI.py", line 361, in spawnOne    suit.setLevel(levelOffset)  File "toontown\suit\DistributedSuitBaseAI.py", line 57, in setLevel    hp = attributes['hp'][self.level]IndexError: tuple index out of range:task(error): Exception occurred in PythonTask summon-suit-1-401003822Traceback (most recent call last):  File "C:\Panda3D-1.9.0\python\lib\runpy.py", line 162, in _run_module_as_main    "__main__", fname, loader, pkg_name)  File "C:\Panda3D-1.9.0\python\lib\runpy.py", line 72, in _run_code    exec code in run_globals  File "C:\Users\Administrator\Google Drive\ToonTownServer\ttw-election-branch\toontown\ai\ServiceStart.py", line 48, in     run()  File "otp\ai\AIBase.py", line 190, in run    self.taskMgr.run()  File "C:\Panda3D-1.9.0\direct\task\Task.py", line 502, in run    self.step()  File "C:\Panda3D-1.9.0\direct\task\Task.py", line 460, in step    self.mgr.poll()  File "toontown\election\DistributedSafezoneInvasionAI.py", line 361, in spawnOne    suit.setLevel(levelOffset)  File "toontown\suit\DistributedSuitBaseAI.py", line 57, in setLevel    hp = attributes['hp'][self.level]IndexError: tuple index out of range

Edited by: mgracer48

Jan 12 2015 Anchor

The log says "hp = attributes['hp'][self.level]IndexError: tuple index out of range " so I assume that is your problem? :P The index going out of range. I am not a Python coder though, not sure if 'tuple index' has a special meaning in Python.

Reply to thread
click to sign in and post

Only registered members can share their thoughts. So come on! Join the community today (totally free - or sign in with your social account on the right) and join in the conversation.