Changing images with outfits and gender

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
SerpentEyes
Newbie
Posts: 2
Joined: Sat Nov 18, 2017 12:52 pm
Contact:

Changing images with outfits and gender

#1 Post by SerpentEyes » Sat Nov 18, 2017 1:09 pm

I am trying to set up a system where not only does the character image shown change with gender selection, but with outfit worn. I didn't want to go into the complexities of composite images, since this isn't a dress-up game, just a bit of customization I want.

However, my image sets are static, and only go off default values no matter how much they are changed. Even when I put in choice threads, as I've seen suggested in other questions, it only goes to the default, not to the current setting. So:

Code: Select all

define gender = 0
define outfit = 0

image pov comms:
    choice(outfit == 0):
        choice(gender == 0):
            "pov_0_0_comms.png"
        choice(gender == 1):
            "pov_1_0_comms.png"
    choice(outfit == 1):
        choice(gender == 0):
            "pov_0_1_comms.png"
        choice(gender == 1):
            "pov_1_1_comms.png"
Always shows pov_0_0_comms.png no matter how the values change.

Code: Select all

show pov comms
Shows pov_0_0_comms.png, the default. But

Code: Select all

$ gender = 1
$ outfit = 1
show pov comms
Also shows pov_0_0_comms.png. I have checked the variables, and those are changing.

Ideally I'd want a more efficient way of doing this too, so I don't have to create massive choice loops for everything. I should be able to set up something like:

Code: Select all

Image("pov_%s_%s_comms.png" % (gender, outfit))
But all my efforts to do so have just returned the defaults. Tips on how to do this better would be appreciated.

User avatar
Remix
Veteran
Posts: 356
Joined: Tue May 30, 2017 6:10 am
Completed: None... yet
Projects: An un-named 3d anime based trainer game
Contact:

Re: Changing images with outfits and gender

#2 Post by Remix » Sat Nov 18, 2017 1:35 pm

image pov comms = DynamicImage( "pov_[gender]_[outfit]_comms.png" )
*might do it

DynamicImage
DynamicImage(name)

A DynamicImage is a displayable that has text interpolation performed on it to yield a string giving a new displayable. Such interpolation is performed at the start of each interaction.

SerpentEyes
Newbie
Posts: 2
Joined: Sat Nov 18, 2017 12:52 pm
Contact:

Re: Changing images with outfits and gender

#3 Post by SerpentEyes » Sat Nov 18, 2017 2:31 pm

That did it! Thanks so much.

Post Reply

Who is online

Users browsing this forum: Ocelot