[Solved] Conditional 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
Mikasa01
Newbie
Posts: 13
Joined: Sat Jul 11, 2020 1:01 pm
Contact:

[Solved] Conditional side image

#1 Post 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"
Last edited by Mikasa01 on Sun Jul 12, 2020 1:23 pm, edited 1 time in total.

User avatar
namastaii
Eileen-Class Veteran
Posts: 1350
Joined: Mon Feb 02, 2015 8:35 pm
Projects: Template Maker for Ren'Py, What Life
Github: lunalucid
Skype: Discord: lunalucid#1991
Soundcloud: LunaLucidMusic
itch: lunalucid
Location: USA
Contact:

Re: Conditional side image

#2 Post 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)

Mikasa01
Newbie
Posts: 13
Joined: Sat Jul 11, 2020 1:01 pm
Contact:

Re: Conditional side image

#3 Post 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. :/

User avatar
IrinaLazareva
Veteran
Posts: 399
Joined: Wed Jun 08, 2016 1:49 pm
Projects: Legacy
Organization: SunShI
Location: St.Petersburg, Russia
Contact:

Re: Conditional side image

#4 Post 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

Mikasa01
Newbie
Posts: 13
Joined: Sat Jul 11, 2020 1:01 pm
Contact:

Re: Conditional side image

#5 Post 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!

User avatar
namastaii
Eileen-Class Veteran
Posts: 1350
Joined: Mon Feb 02, 2015 8:35 pm
Projects: Template Maker for Ren'Py, What Life
Github: lunalucid
Skype: Discord: lunalucid#1991
Soundcloud: LunaLucidMusic
itch: lunalucid
Location: USA
Contact:

Re: [Solved] Conditional side image

#6 Post by namastaii »

Sorry about that, I didn't notice the post was from 2014!

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot]