I have run into a weird bug that I am trying to pin it down. It only appears when someone loads a save.
I get this:
Code: Select all
I'm sorry, but an uncaught exception occurred.
While running game code:
File "game/script-chapter-02-day-06.rpy", line 271, in script call
call dungeon_fd_garden_maze from _call_dungeon_fd_garden_maze
File "game/dungeon_fd_garden_maze.rpy", line 212, in script
$ dungeon_battle(choose_encounter)
File "game/dungeon_fd_garden_maze.rpy", line 212, in <module>
$ dungeon_battle(choose_encounter)
File "game/battle.rpy", line 536, in dungeon_battle
renpy.show_screen("battle_message", load_skill.name)
AttributeError: 'AbilityCode' object has no attribute 'sprite'
-- Full Traceback ------------------------------------------------------------
Full traceback:
File "game/script-chapter-02-day-06.rpy", line 271, in script call
call dungeon_fd_garden_maze from _call_dungeon_fd_garden_maze
File "game/dungeon_fd_garden_maze.rpy", line 212, in script
$ dungeon_battle(choose_encounter)
File "C:\renpy\renpy\ast.py", line 862, in execute
renpy.python.py_exec_bytecode(self.code.bytecode, self.hide, store=self.store)
File "C:\renpy\renpy\python.py", line 1912, in py_exec_bytecode
exec bytecode in globals, locals
File "game/dungeon_fd_garden_maze.rpy", line 212, in <module>
$ dungeon_battle(choose_encounter)
File "game/battle.rpy", line 536, in dungeon_battle
renpy.show_screen("battle_message", load_skill.name)
AttributeError: 'AbilityCode' object has no attribute 'sprite'
Windows-8-6.2.9200
Ren'Py 7.0.0.196
The Wanderers 0.93
Sun Jun 10 14:01:16 2018
The code is
Code: Select all
elif action == "ability":
renpy.show_screen("battle_message", "Choose Your Ability Code")
renpy.call_screen("battle_skills", member)
renpy.show_screen("battle_message", "Choose Your Target")
#target and range check
if load_skill.target == "enemy":
#damages enemy
if load_skill.range == "single":
#hit one enemy
renpy.call_screen("enemy_target", monsterparty)
target_x, target_y, target_w, target_h = renpy.get_image_bounds(battle_target.image)
renpy.show_screen("battle_message", load_skill.name)
renpy.show(load_skill.sprite)
renpy.pause(1)
renpy.hide(load_skill.sprite)
To verify, i had the following written in my AbilityCode class
Code: Select all
class AbilityCode:
def __init__(self, name, desc, icon, unequipicon, mindamage, maxdamage, minheal, maxheal, cpcost, hpcost, element, elementicon, target, range, status, sprite, color, found, locked="locked_ac"):
self.name = name
self.desc = desc
self.icon = icon
self.unequipicon = unequipicon
self.mindamage = mindamage
self.maxdamage = maxdamage
self.minheal = minheal
self.maxheal = maxheal
self.cpcost = cpcost
self.hpcost = hpcost
self.element = element
self.elementicon = elementicon
self.target = target
self.range = range
self.status = status
self.sprite = sprite
self.color = color
self.found = found
self.locked = locked
The ability being called is:
Code: Select all
ability_codes_list["24"] = AbilityCode("Code: Earth α", "A tiny ball of stone.", "code_earth_a_on", "code_earth_a_off", 20, 30, 0, 0, 3, 0, "Earth", "element_earth", "enemy", "single", "none", "battle_earth_alpha", "#ff0", True)
I am little confused with the way Renpy handles the class as all the attributes are present yet it... isn't?
Help!