I want to show a pre-defined image on a menu screen. My game has a customizable player avatar, and I want their image to be shown on the menu screen, like this placeholder example:
Here's my problem, though. I can't seem to put images I defined in script.txt there. I can only display them if I directly call the filename, which doesn't work when the player's avatar has to be defined by a ConditionSwitch to be displayed correctly. (I have an if/else code there to be sure something is displayed if this menu is viewed before the avatar is chosen, which functions fine. Don't worry about that part.)
This is the code I'm using to make the character appear on the right, that doesn't work. The stuff on the left is part of the same screen, but I assume it doesn't affect her. Dede is the character in the image above. pc_avatar is defined with the ConditionSwitch, and dede is defined like any regular displayable image would be in the script file, with image dede = "images/dede.png"
Code: Select all
if avatar_set == True:
add pc_avatar at float_6
else:
add dede at float_6
Code: Select all
I'm sorry, but an uncaught exception occurred.
While running game code:
File "game/script.rpy", line 504, in script
File "renpy/common/000statements.rpy", line 519, in execute_call_screen
store._return = renpy.call_screen(name, *args, **kwargs)
File "game/screens.rpy", line 461, in execute
screen descanta_menu():
File "game/screens.rpy", line 461, in execute
screen descanta_menu():
File "game/screens.rpy", line 516, in execute
if avatar_set == True:
File "game/screens.rpy", line 517, in execute
add pc_avatar at float_6
NameError: name 'pc_avatar' is not defined