Changing Character Side Image

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
Catboo12
Newbie
Posts: 6
Joined: Tue Oct 18, 2016 12:36 pm
Contact:

Changing Character Side Image

#1 Post by Catboo12 » Tue Oct 18, 2016 4:00 pm

So, I've decided that I want my main character's side image to change depending on her emotions. So, I copied the code that was provided on the Ren'py official site and changed it to fit my character. This is now my code:

Code: Select all

define MC = Character('player_name', window_left_padding=160,
          show_side_image=ConditionSwitch(
          "express == 'what'", "Char_What.png",
          "express == 'happy'", "Char_Happy.png",
          "express == 'sad'", "Char_Sad.png",
          "express == 'normal'", "player.png",
        ), color='#ECCEF5', what_color='#ECCEF5')

image side Char_Happy = "Char_Happy.png"
image side Char_Sad = "Char_Sad.png"
image side player = "player.png"
image side Char_What = "Char_What.png"


However, when I run the game, I get this error message:
File "game/script.rpy", line 66, in script
MC "%(player_name)s."
Exception: Unknown keyword arguments: side_image
Can someone help me fix this? I've tried fiddling around with it but I can't fix it. (line 66 is just a line of dialogue the character says)

User avatar
Ocelot
Eileen-Class Veteran
Posts: 1883
Joined: Tue Aug 23, 2016 10:35 am
Github: MiiNiPaa
Discord: MiiNiPaa#4384
Contact:

Re: Changing Character Side Image

#2 Post by Ocelot » Tue Oct 18, 2016 4:14 pm

show_side_image never worked for me. I usually use image='player' and defining side image later. Notice that image statement takes any displayable and you can even stuff ConditionSwitch in it:

Code: Select all

image side player = ConditionSwitch(
    "express == 'what'", "Char_What.png",
    "express == 'happy'", "Char_Happy.png",
    "express == 'sad'", "Char_Sad.png",
    "express == 'normal'", "player.png",
)
< < insert Rick Cook quote here > >

Catboo12
Newbie
Posts: 6
Joined: Tue Oct 18, 2016 12:36 pm
Contact:

Re: Changing Character Side Image

#3 Post by Catboo12 » Tue Oct 18, 2016 4:25 pm

Thank you! It works now :)

Post Reply

Who is online

Users browsing this forum: No registered users