[Solved] Changing Side Image during other dialogue

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
Smaymay
Regular
Posts: 70
Joined: Fri Jul 01, 2016 11:35 am
Completed: Vicboys demo
Tumblr: esmmeh
Deviantart: Smaymay
Location: The Netherlands
Contact:

[Solved] Changing Side Image during other dialogue

#1 Post by Smaymay »

Hi there!

I was wondering if it would be possible to change a side image (expression) even though this particular character isn't speaking at the moment. I looked at https://www.renpy.org/doc/html/side_image.html and managed to make it work to a certain degree. But I keep getting an error saying the image can't be found even though the expression clearly changed. 🠚 Image 'maincharacter happy' not found
It's maybe also good to mention that our side image will stay on screen all the time. I really want to make his work. I think it adds a lot to the story :)

DIALOGUE EXAMPLE

Code: Select all

    window show
    MC neutral "I'm so bored."
    show john neutral at center
    J "Hey!"
    show maincharacter happy
    N "He hands you a present."
SCRIPT.RPY

Code: Select all

define MC = Character('[nickname]', image="maincharacter", show_two_window=True, ctc="ctc_blink", ctc_position="fixed")
define N = Character(None, ctc="ctc_blink", ctc_position="fixed")
define J = Character('John', image="maincharacter", show_two_window=True, ctc="ctc_blink", ctc_position="fixed")
IMAGES.RPY

Code: Select all

    image side maincharacter neutral = "images/CHAR/MC/neutral.png"
    image side maincharacter happy = "images/CHAR/MC/happy.png"

    image john neutral = "images/CHAR/JOHN/neutral.png"
SCREENS.RPY

Code: Select all

screen say(who, what, side_image=None, two_window=False):

    # Decide if we want to use the one-window or two-window variant.
    if not two_window:

        # The one window variant.
        window:
            id "window"

            has vbox:
                style "say_vbox"

            if who:
                text who id "who"

            text what id "what"

    else:

        # The two window variant.
        vbox:
            style "say_two_window_vbox"

            if who:
                window:
                    style "say_who_window"

                    text who:
                        id "who"

            window:
                id "window"

                has vbox:
                    style "say_vbox"

                text what id "what"

# If there's a side image, display it above the text at given position.
    add SideImage() xpos 47 ypos 573
Thanks for reading this thread!
Last edited by Smaymay on Sun Aug 26, 2018 3:05 pm, edited 1 time in total.

User avatar
skyeworks
Regular
Posts: 84
Joined: Thu Jul 27, 2017 11:36 am
Projects: K9-11
itch: skyefrost
Contact:

Re: Changing Side Image during other dialogue

#2 Post by skyeworks »

There is a way. It's changing the side image person's expression via condition switch. (I don't know how to do it but this person seems to do it:

viewtopic.php?p=294991#p294991

Here's another thread about it too:

"Since I used to use LiveComposite and ConditionSwitch for sprites including the side sprite, I could change the side image's expressions with a $ variable any time I want, even if the character isn't talking. "

viewtopic.php?t=50953
Image

User avatar
Smaymay
Regular
Posts: 70
Joined: Fri Jul 01, 2016 11:35 am
Completed: Vicboys demo
Tumblr: esmmeh
Deviantart: Smaymay
Location: The Netherlands
Contact:

Re: Changing Side Image during other dialogue

#3 Post by Smaymay »

Skyeworks
Thank you for leaving a reply and linking these threads. :) They were quite useful. But in the end, I found the solution here: viewtopic.php?t=35598

Now I'm able to change the expression of my mc even if she's not speaking. Here's the updated code for anyone who's interested or wants to achieve the same thing:

DIALOGUE EXAMPLE

Code: Select all

    window show
    MC neutral "I'm so bored."
    show john neutral at center
    J happy "Hey!" #John is speaking but the MC's expression changes to happy.
    N "He hands you a present."
SCRIPT.RPY

Code: Select all

define MC = Character('[nickname]', image="maincharacter", show_two_window=True, ctc="ctc_blink", ctc_position="fixed")
define N = Character(None, image="maincharacter", show_two_window=True, ctc="ctc_blink", ctc_position="fixed")
define J = Character('John', image="maincharacter", show_two_window=True, ctc="ctc_blink", ctc_position="fixed")
IMAGES.RPY

Code: Select all

init python:
    config.side_image_tag = "maincharacter"

init:

    image side maincharacter neutral = "images/CHAR/MC/neutral.png"
    image side maincharacter happy = "images/CHAR/MC/happy.png"
    image john neutral = "images/CHAR/JOHN/neutral.png"

Post Reply

Who is online

Users browsing this forum: Andredron, Bing [Bot], konimyun