Page 1 of 1

[Solved] Conditional side image

Posted: Sat Jul 11, 2020 1:13 pm
by Mikasa01
Hey. I have a question regarding side images which I hope I could get some help with.

I am trying to make a side image for my main character that is placed at a different x,y pos than the regular images for the other characters.

I know it has something to do in here:

Code: Select all

    if not renpy.variant("small"):
        add SideImage() xalign 0.25 yalign 0.80
But I am not quite sure how to go about doing this. I tried:

Code: Select all

    if not renpy.variant("small"):
    	if Character() == main_character:
        	add SideImage() xalign 0.65 yalign 0.80
        else:
        	add SideImage() xalign 0.25 yalign 0.80
But it always ends up using the else statement regardless. Any clues?

This is my main character definition:

Code: Select all

define mc = Character("[main_character]",
            color = "#FFBFFF",
            image = "mc")

image side mc talk = "side_images/side_mc_talk.png"

Re: Conditional side image

Posted: Sun Jul 12, 2020 2:24 am
by namastaii
you probably want to address the "who" but I'm not sure. I haven't messed with side images in a couple of years. But right now you're referring to the entire character function

*update* here I found this viewtopic.php?t=25136 :)

This is probably the most straight forward solution:

Code: Select all

define e = Character('Eileen', color="#c8ffc8", image="eileen", show_side_xalign=1.0)

Re: Conditional side image

Posted: Sun Jul 12, 2020 8:34 am
by Mikasa01
namastaii wrote: Sun Jul 12, 2020 2:24 am you probably want to address the "who" but I'm not sure. I haven't messed with side images in a couple of years. But right now you're referring to the entire character function

*update* here I found this viewtopic.php?t=25136 :)

This is probably the most straight forward solution:

Code: Select all

define e = Character('Eileen', color="#c8ffc8", image="eileen", show_side_xalign=1.0)
Hi. Thanks for replying. Unfortunately that code seems outdated and doesn't seem to be working. :/

Re: Conditional side image

Posted: Sun Jul 12, 2020 10:41 am
by IrinaLazareva
in init:

Code: Select all

default main_character = 'J.M.'

define mc = Character('main_character', dynamic=True, 
    image='mc',
    color='#ffbfff',
    )
image side mc = 'some_picture.jpg'
in screen say():

Code: Select all

    if not renpy.variant("small"):
        if who==main_character:
            add SideImage() xalign .65 yalign .8             
        else:
            add SideImage() xalign .25 yalign .8    
https://www.renpy.org/doc/html/dialogue ... characters

Re: Conditional side image

Posted: Sun Jul 12, 2020 1:23 pm
by Mikasa01
IrinaLazareva wrote: Sun Jul 12, 2020 10:41 am in init:

Code: Select all

default main_character = 'J.M.'

define mc = Character('main_character', dynamic=True, 
    image='mc',
    color='#ffbfff',
    )
image side mc = 'some_picture.jpg'
in screen say():

Code: Select all

    if not renpy.variant("small"):
        if who==main_character:
            add SideImage() xalign .65 yalign .8             
        else:
            add SideImage() xalign .25 yalign .8    
https://www.renpy.org/doc/html/dialogue ... characters
This works great! Thank you very much, Irina!

Re: [Solved] Conditional side image

Posted: Sun Jul 12, 2020 2:12 pm
by namastaii
Sorry about that, I didn't notice the post was from 2014!