Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
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.
- Posts: 2
- Joined: Sun Jan 05, 2020 3:50 am
- Tumblr: gimyosan
I'm trying to implement a semi-randomized outfit system where a character is dressed consistently for a period of time. I'm currently using a layered image system for the clothing sprites and it works great, but I'm a bit stuck on how to approach the randomizer system. I was thinking of something kind of like this:
Code: Select all
$ bottom = renpy.random.choice(["pants"])
$ top = renpy.random.choice(["collar", "longsleeve", "sweater"])
show npc armscrossed happy [bottom] [top]_armscrossed
But that doesn't work due to the way layer image attributes are called. Does anyone have tips on how to tackle this problem?
- Miko-Class Veteran
- Posts: 620
- Joined: Mon Jan 26, 2009 7:21 pm
Layeredimages can use variables to set a picture for that layer, so you can use a renpy.random to randomize what to show.
Finally, the if statement adds a layer that selects between displayables using a Python statement. This is evaluated constantly, and the first condition that evaluates to true is the one that's displayed.
10 ? "RENPY"
20 GOTO 10
Users browsing this forum: Google [Bot], yurikha