vaendryl / Sunrider

source code of the visual novel 'Sunrider'
http://sunrider-vn.com/
41 stars 21 forks source link

AttributeError: 'NoneType' object has no attribute 'wtype', Mission Tydaria #124

Closed andrealexandrewangliu closed 9 years ago

andrealexandrewangliu commented 9 years ago
I'm sorry, but an uncaught exception occurred.

While running game code:
  File "game/script.rpy", line 3174, in script
    $BM.battle()  #continue the battle
  File "game/script.rpy", line 3174, in <module>
    $BM.battle()  #continue the battle
  File "game/classes.rpy", line 955, in battle
    self.result = ui.interact()
  File "game/screens custom.rpy", line 98, in execute
    screen battle_screen:
  File "game/screens custom.rpy", line 130, in execute
    viewport id "grid":
  File "game/screens custom.rpy", line 265, in execute
    for ship in BM.ships: #cycle through every ship in the battle
  File "game/screens custom.rpy", line 267, in execute
    if ship.location != None:
  File "game/screens custom.rpy", line 327, in execute
    if ship.faction == 'Player':
  File "game/screens custom.rpy", line 330, in execute
    if BM.targetingmode:
  File "game/screens custom.rpy", line 334, in execute
    if BM.active_weapon.wtype == 'Support':
AttributeError: 'NoneType' object has no attribute 'wtype'

-- Full Traceback ------------------------------------------------------------

Full traceback:
  File "game/script.rpy", line 3174, in script
    $BM.battle()  #continue the battle
  File "/Users/xmyx/Library/Application Support/Steam/steamapps/common/Sunrider/renpy/ast.py", line 778, in execute
    renpy.python.py_exec_bytecode(self.code.bytecode, self.hide, store=self.store)
  File "/Users/xmyx/Library/Application Support/Steam/steamapps/common/Sunrider/renpy/python.py", line 1382, in py_exec_bytecode
    exec bytecode in globals, locals
  File "game/script.rpy", line 3174, in <module>
    $BM.battle()  #continue the battle
  File "game/classes.rpy", line 955, in battle
    self.result = ui.interact()
  File "/Users/xmyx/Library/Application Support/Steam/steamapps/common/Sunrider/renpy/ui.py", line 247, in interact
    rv = renpy.game.interface.interact(roll_forward=roll_forward, **kwargs)
  File "/Users/xmyx/Library/Application Support/Steam/steamapps/common/Sunrider/renpy/display/core.py", line 2145, in interact
    repeat, rv = self.interact_core(preloads=preloads, **kwargs)
  File "/Users/xmyx/Library/Application Support/Steam/steamapps/common/Sunrider/renpy/display/core.py", line 2393, in interact_core
    root_widget.visit_all(lambda i : i.per_interact())
  File "/Users/xmyx/Library/Application Support/Steam/steamapps/common/Sunrider/renpy/display/core.py", line 335, in visit_all
    d.visit_all(callback)
  File "/Users/xmyx/Library/Application Support/Steam/steamapps/common/Sunrider/renpy/display/core.py", line 335, in visit_all
    d.visit_all(callback)
  File "/Users/xmyx/Library/Application Support/Steam/steamapps/common/Sunrider/renpy/display/core.py", line 335, in visit_all
    d.visit_all(callback)
  File "/Users/xmyx/Library/Application Support/Steam/steamapps/common/Sunrider/renpy/display/screen.py", line 382, in visit_all
    callback(self)
  File "/Users/xmyx/Library/Application Support/Steam/steamapps/common/Sunrider/renpy/display/core.py", line 2393, in <lambda>
    root_widget.visit_all(lambda i : i.per_interact())
  File "/Users/xmyx/Library/Application Support/Steam/steamapps/common/Sunrider/renpy/display/screen.py", line 394, in per_interact
    self.update()
  File "/Users/xmyx/Library/Application Support/Steam/steamapps/common/Sunrider/renpy/display/screen.py", line 553, in update
    self.screen.function(**self.scope)
  File "game/screens custom.rpy", line 98, in execute
    screen battle_screen:
  File "game/screens custom.rpy", line 130, in execute
    viewport id "grid":
  File "game/screens custom.rpy", line 265, in execute
    for ship in BM.ships: #cycle through every ship in the battle
  File "game/screens custom.rpy", line 267, in execute
    if ship.location != None:
  File "game/screens custom.rpy", line 327, in execute
    if ship.faction == 'Player':
  File "game/screens custom.rpy", line 330, in execute
    if BM.targetingmode:
  File "game/screens custom.rpy", line 334, in execute
    if BM.active_weapon.wtype == 'Support':
  File "<screen language>", line 334, in <module>
AttributeError: 'NoneType' object has no attribute 'wtype'

Darwin-13.4.0-x86_64-i386-64bit
Ren'Py 6.18.1.670
Sunrider Mask of Arcadius  Beta 7.1a

It occurred when bombarding the pirate base mission after getting both Black Jack and Liberty. The same issue didn't occur when restarting the game and continueing, It did happen when restarting the mission entirely.

vaendryl commented 9 years ago

I added some fail-safes for this. hopefully it doesn't crash on this again.