Layered Images and Variables

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
danasavage
Newbie
Posts: 9
Joined: Thu Jun 11, 2020 9:28 am
Projects: Girl Games
Contact:

Layered Images and Variables

#1 Post by danasavage »

Forgive me bombarding the forum with questions, but I'm still trying to puzzle out the solution to my wardrobe/inventory/paperdoll problem. I am aware that Layered Images can be used in a "dressup" style screen, but is there any way to give the choices the player makes about their appearance knock-on effects (ie to set extra variables)?

In other words, say I had a "wardrobe" screen in my game that the player could return to whenever they wanted and change their outfit. If they were wearing pants and a tshirt, they couldn't get into the shower block. But if they switched into wearing a towel, then voila! They could finally get clean!

I tried adding an extra variable to my dressup screen like so:

layeredimage ethan:

always "player"


if outfit == 1:
"towel"
$ towel = True

if outfit == 2:
"boy_mode"
$ towel = False

but that didn't seem to work/do anything. Is this a possibility?

And on the same track, say later on the player went to a shop and bought a NEW TOWEL. Is there a way of adding/appending new items to the outfit choices later on down the line, or gating them off at the start until some extra flag has been tripped or whatever? (I hope i'm making sense!)

Or, alternately, is there some way of perhaps combining layered images with a classic inventory that kept track of players clothing choices and then displayed back what were wearing in real-time?

THanks in advance! :)

User avatar
MaydohMaydoh
Regular
Posts: 165
Joined: Mon Jul 09, 2018 5:49 am
Projects: Fuwa Fuwa Panic
Tumblr: maydohmaydoh
Location: The Satellite of Love
Contact:

Re: Layered Images and Variables

#2 Post by MaydohMaydoh »

I don't think you can set variables within layered images. Couldn't you just use the outfit variable to check the outfit?
Instead of checking if $ towel is true or false, you could just check if $ outfit is 1.
As for the new towel thing, you could use a condition switch for the image

Code: Select all

image towel = ConditionSwitch(
    "new_towel", "towel.png",
    "True", "new_towel.png")

danasavage
Newbie
Posts: 9
Joined: Thu Jun 11, 2020 9:28 am
Projects: Girl Games
Contact:

Re: Layered Images and Variables

#3 Post by danasavage »

Ah, okay, this is starting to make sense to me now. Thanks so much for answering!

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot]