Page 1 of 1

[Solved] Changing Side Image during other dialogue

Posted: Sat Aug 18, 2018 10:02 am
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!

Re: Changing Side Image during other dialogue

Posted: Sun Aug 19, 2018 7:40 pm
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

Re: Changing Side Image during other dialogue

Posted: Sun Aug 26, 2018 3:04 pm
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"