I've a situation where a character has possible clothing swaps. Casual, Dress and Base outfits. I'm still learning the but I managed to use normal If statements to check which outfit to display but that only allows to check for 2
It seems to me that putting a new If statement anytime she changes expressions feels clumsy and excessive.
Example. at the moment I use Vicky_Expression_Dress, Vicky_Expression_Casual, ect ect. to call up which ever is needed.
I was hoping there was a way that I could use adjustable variable or condition to change the defined image to whichever is needed.
Here is the example code I was trying. I can get it to work with just a IF/Else statement but elifs are proving to be tricky.
if vcos == 1:
image vhappy = LiveComposite(
(580, 480),
(0, 0), "images/v-base2.png",
(0, 0), "images/v-smile.png")
image vdef = LiveComposite(
(580, 480),
(0, 0), "images/v-base2.png",
(0, 0), "images/v-neutral.png")
image vsad = LiveComposite(
(580, 480),
(0, 0), "images/v-base2.png",
(0, 0), "images/v-sad.png")
#Base
elif vcos == 2:
image vhappy = LiveComposite(
(580, 480),
(0, 0), "images/v-base3.png",
(0, 0), "images/v-smile.png")
image vdef = LiveComposite(
(580, 480),
(0, 0), "images/v-base3.png",
(0, 0), "images/v-neutral.png")
image vsad = LiveComposite(
(580, 480),
(0, 0), "images/v-base3.png",
(0, 0), "images/v-sad.png")
#Casual
else:
image vhappy = LiveComposite(
(580, 480),
(0, 0), "images/v-base.png",
(0, 0), "images/v-smile.png")
image vdef = LiveComposite(
(580, 480),
(0, 0), "images/v-base.png",
(0, 0), "images/v-neutral.png")
image vsad = LiveComposite(
(580, 480),
(0, 0), "images/v-base.png",
(0, 0), "images/v-sad.png")
Using Conditionals, or Variable to alter Image Defines?
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.
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.
- LateWhiteRabbit
- Eileen-Class Veteran
- Posts: 1867
- Joined: Sat Jan 19, 2008 2:47 pm
- Projects: The Space Between
- Contact:
Re: Using Conditionals, or Variable to alter Image Defines?
If you are using the latest version of RenPy, you'll want to use Layered Images instead. PyTom just added it to make situations like this much easier. Much easier than LiveComposite.
Re: Using Conditionals, or Variable to alter Image Defines?
If you're not using layered images, you can also use Composite with variables:
You'd need a character object called eileen in the above scenario, with attributes base and mood. Then just change eileen's mood by changing the attributes and the image will change.
Also you don't need /images in your image statements, unless your images are inside /game/images/images
Code: Select all
image eileen = Composite(
(580, 480),
(0, 0), "v-[eileen.base].png",
(0, 0), "v-[eileen.mood].png")
Also you don't need /images in your image statements, unless your images are inside /game/images/images
Who is online
Users browsing this forum: Google [Bot]