[Player Customization] In-Game Warderobe + NPC notices

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
User avatar
Posts: 13
Joined: Sat Jul 01, 2017 7:27 am
Deviantart: HollaceDay

[Player Customization] In-Game Warderobe + NPC notices

#1 Post by Hollace » Tue May 04, 2021 10:47 am

Hi there! I've got a pretty ambiguous game plan in mind, I've already found most of the things I need to get started on coding, but one I couldn't quite find... And that's player customization. I apologize in advance for my English, I am not a native speaker but I truly do my best.

I've already looked everywhere, I've found some for dress-up games and some that turn those into usable player customizations, but so far it only works in the beginning and seems to be only a visual change. Now the thing is, what I want is a little more grande than that, I want the player to be able to change outfits and hair during gameplay and to have those changes be visual in the talking sprite (while simultaneously having expressions). But I don't just want visual changes... You see, my game is a dating sim that includes sexualities as well as genders (like trans and non-binary), it's one of the core components. I think I know how to deal with the sexuality part, but suggestions are appreciated... BUT this game also deals with attraction, so for example you have a male NPC who is heterosexual and is into femme girls... how exactly do I program that? As the attraction will come from the things you change within the wardrobe (in-game character customization)

The wardrobe section is also different from the player creation, so they're also gonna be two different UIs. The player creation is something you won't be able to change later game (except for the hair) and will be set in stone.

Example of what I want to create in the player creation section are these:
-Gender (male, female, trans-male, trans-female, and non-binary)
-Skin Colour (this is also an important part of the game, and needs to be able to be checked by the NPC)
-Eyes (and another section for eye color)
-Skin details

Example what I want to be able to change in the wardrobe section are these:
- Hair
- Makeup (put in 3 different sections; lipstick, eyeshadow blush)
- Top
- Top layer
- head accessories
- hair accessories
- neck accessories

Now what I think is the best way to handle this is through having each changeable section be a point, so basically we have 9 sections and points. The style (what I'm gonna be calling it) will be the one that has the most points, so for example you got 3 points in femme, 5 points in casual, and 1 point in EMPTY you'll have the casual styling. But now some problems come up with that theory;
1. What if it's a tie? I only want one style to be visual. The only thing I can come up with is to have the hair section be a dominant section and break ties... but how would I do that? As I only want it to be a dominant feature if there is a need for a tie-breaker.
2. ...how does it confirm that these are the style points, is it once you click out of the UI? Or is it during the UI? I have the sense it might be too much for the UI to handle.
3. the EMPTY... I need this in case they chose not to have an accessory of some sort, but how do I program this without it interfering with the points?

For more information, these are the styles I want to be using;
- Femme
- Masculine
- Casual
- Elegant
- Preppy
- Sporty
- Goth
- Kawaii

I know what I want is pretty grande and it makes me nervous that this might not be even possible within what Ren'py got to offer, but I really do hope so as so far, Ren'py is the software I am most comfortable when it comes to visual novels. I hope I have explained everything well!
I'm a freelance 2D character artist, check out my works on the websites listed here:

Posts: 28
Joined: Sun Apr 14, 2019 4:12 am
itch: shie
Discord: Shie#3769

Re: [Player Customization] In-Game Warderobe + NPC notices

#2 Post by Shie » Tue May 04, 2021 2:36 pm

(Not native english speaker too)
This is totally possible to do in renpy. Just assign to each clothes pice/accesorry/ssomething else points, like hairstyle might be 5 in feminine, 3 in masculine and 7 in sporty, then write a function that will calculate overall points for each of style. For changing clothes i'd use layered image. For cheking if npc likes mc you can write another function, that checks it(and in this cheking you can just not check EMPTY). This is more about math and balancing game(like 1st question). I didnt quite understood second question - but from what i understood - depends on how you'll do screens

If you want have multiple styles per pice/accesorry/ssomething else, i'd reccomend using dictionaries - other depends on how you're planning to do screens and data struture

I hope i was able to help, but if you have more questions - ask ahead

User avatar
Posts: 13
Joined: Sat Jul 01, 2017 7:27 am
Deviantart: HollaceDay

Re: [Player Customization] In-Game Warderobe + NPC notices

#3 Post by Hollace » Thu May 06, 2021 7:50 pm

Thank you for the response! I'm a little late as I wanted to code what I could before replying in case I figure it out on my own. So far I've got the dress up to work flawlessly, I've got gender recognition as well as skin colour recognition... the only thing where I am currently stuck at is the fashion style stat.

So for context, here's how I've coded my player customization (these are bits and pieces as it's a lot of repetitiveness with different assetts):

Code: Select all

if top == 1 and clothes == "Male":
    elif top == 2 and clothes == "Male":
    #this continues all the way
    elif top == 18 and clothes == "Male":
    elif top == 1 and clothes == "Female":
    #this continues all the way
    elif top == 18 and clothes == "Female":

init python:
    def change_mc(aspect, way):
        global skin
        global hair
        global haircolour
        global eyes
        global eyecolour
        global eyebrows
        global nose
        global mouth
        global skindetails
        global lipstick
        global eyeshadow
        global eyeshadowcolour
        global cheeks
        global top
        global bodyacc
        global headacc

        if aspect == "headacc":
            if way == "+":
                headacc += 1
            if way == "-":
                headacc -= 1

        if headacc > 23:
            headacc = 1
        if headacc < 1:
            headacc = 23

#this continues with every value

screen Wardrobe():

    add "Assets/background2.png"

        yalign 0.5
        xalign 0.5
        spacing 100


            text "hair"

                textbutton "Prev" action Function(change_mc, "hair", "-")
                textbutton "Next" action Function(change_mc, "hair", "+") 
What I want is that the player can customize their character and depending on what they wear they receive a certain amount of value points within the given style. The value with the most points would be used, so for example; the player has the most points in the 'femme' style, so this is the variable that would be used to check $ style.
Now I've tried to assign the style values to the clothing in the same matter as I did with the aspects, so;

Code: Select all

default casual = 0
default femme = 0
default masc = 0
default elegant = 0
default preppy = 0
default sporty = 0
default punk = 0
default kawaii = 0

init python:
    def fashion_style(aspect):
        global casual
        global femme
        global masc
        global elegant
        global preppy
        global sporty
        global punk
        global kawaii

        if aspect == "top":
            if top == 1:
                casual += 1
            elif top == 2:
                casual += 1
            elif top == 2:
                casual += 1
            elif top == 3:
                casual += 1
            elif top == 4:
                casual += 1
            elif top == 5:
                femme += 2
            elif top == 6:
                femme += 2
            elif top == 7:
                masc += 2
but it doesn't seem to work, as when I check the points in-game it always comes out 0, I have set the values default 0 like I did with the customization assetts but that shouldn't affect this. I feel like I am doing something terribly wrong and tbh I probably am, but this isn't my comfort zone and I am very confused. I don't think I can continue with the max values if I don't even get this to work <:(
I'm a freelance 2D character artist, check out my works on the websites listed here:

Posts: 28
Joined: Sun Apr 14, 2019 4:12 am
itch: shie
Discord: Shie#3769

Re: [Player Customization] In-Game Warderobe + NPC notices

#4 Post by Shie » Fri May 07, 2021 12:34 am

Thats not the best way to code it. Simplier would be using classes, like for example for clothing

Code: Select all

class clothes_piece:
    def __init__(self, name, points):
        self.name = name # same with points
and define get_points that will return self.points
user point would be fe

Code: Select all

mc_points = {"feminine":2,"masculine":4 and other} # check it every time you put on ot or remove clothe piece
and define clothes as

Code: Select all

define top1 = clothes_piece("top1",{"masculine":4,"feminine":2,"sporty":5})
then you can use arrays or dict to collect all clothes (that you can use it in screens: all_tops[variable_for_to_number] and same for other clothes)
define all_tops = [top1,top2] # and so on

for adding it to body, use:

Code: Select all

default body = {"head":no_clothes,"top":top1,"bottom":pants1} # no_clothes is closes piese with points == {}
then for cheking all points:

Code: Select all

mc_points = {"masuline":4 and others} # reset points to 0
for i in body:
    for j in body[i]:
        mc_points[i] += body[i][j].points
same can be done with hair

Having that is simplier to write and debug then writing tonns of "if"
For showing clothing you can use dynamic images

Code: Select all

sex would be variable of what user body is. Or you can make it part of clothe class

Code here wasn't run in python so these are bugs, but i hope it gives you picture of what i want to say


Dynamic images
https://www.renpy.org/doc/html/displaya ... splayables

Of you can use layered images

Post Reply

Who is online

Users browsing this forum: Google [Bot], Ocelot