How to easily change character portraits?

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
User avatar
jingleriot
Regular
Posts: 25
Joined: Mon Sep 05, 2016 7:53 pm
Projects: Ventio Mortis, Sector Chimera, Monster Party
Deviantart: jingleriot
itch: https://jingleriotga
Contact:

How to easily change character portraits?

#1 Post by jingleriot »

Hello, all! I was wondering what the easiest and most effective way to show character portraits might be?
Am I doomed to simply code endlessly like this?:

Code: Select all

    show character_sad at right
    c "dialog!"
    hide character_sad
    show character_happy at right
    c "happy expression change!"
Or is there an easier way to do this? This starts to become quite cumbersome and messy as you go on writing and scripting (it can honestly get so confusing along the way...), and especially when adding more characters or using a heavy cast. It can sometimes look like this:

Code: Select all

    show character_sad at right
    show second_sad at left
    c "dialog!"
    hide character_sad
    show character_surprised at right
    s "alternate dialog!"
    hide second_sad
    show newchar_happy at left
    show character_happy at right
    c "happy expression change!"
Am I just doing it wrong from the get-go? This is the only way I know how to do it. Any advice would be appreciated!

User avatar
Divona
Miko-Class Veteran
Posts: 678
Joined: Sun Jun 05, 2016 8:29 pm
Completed: The Falconers: Moonlight
Organization: Bionic Penguin
itch: bionicpenguin
Contact:

Re: How to easily change character portraits?

#2 Post by Divona »

That's pretty much what a normal Ren'Py script looks like. It's like writing screenplay where you separate between action and dialogues. To minimize writing, I would suggest using image attributes with character emotion/facial so you don't have to hide character every time they change pose/emotion. Leave some white space between actions would help make the script easier to read as well.

Code: Select all

image character sad = "character_sad.png"
image character surprised = "character_surprised.png"

image second sad = "second_sad.png"

image newchar happy = "newchar_happy.png"


label start:

    show character sad at right
    show second sad at left

    c "dialog!"

    show character surprised

    s "alternate dialog!"

    hide second
    show newchar happy at left
    show character happy

    c "happy expression change!"
Last edited by Divona on Sat Oct 14, 2017 9:28 pm, edited 2 times in total.
Completed:
Image

User avatar
jingleriot
Regular
Posts: 25
Joined: Mon Sep 05, 2016 7:53 pm
Projects: Ventio Mortis, Sector Chimera, Monster Party
Deviantart: jingleriot
itch: https://jingleriotga
Contact:

Re: How to easily change character portraits?

#3 Post by jingleriot »

Ohhhhhhhhhh, alright! I didn't know I could do that with the attributes, and that definitely will make it so much easier. Thank you!

Post Reply

Who is online

Users browsing this forum: apocolocyntose, simple_human