Change access to certain characters based on players 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
Nadohunter
Newbie
Posts: 4
Joined: Tue Sep 23, 2014 7:40 pm
Contact:

Change access to certain characters based on players gender?

#1 Post by Nadohunter »

I was wondering if I could do something where certain characters would be more willing to get with the player based on their gender.

For example, if the player chooses to be a female, then it would be harder to get with my straight female character. But they might be more accessible to a lesbian female character.
Is there a way I could maybe do a menu option in the beginning that would effect it in the game?

Would I do something like...

Code: Select all

menu:
    "Boy"
    $ Boy == True
    jump start
    "Girl"
    $ Boy == False
    jump start
    "Other"
    $ Boy == False
    jump start
or maybe I should write out an 'If' statement? Or maybe I should write the menu differently? Because it doesn't jump to a certain place, I just want it to affect certain actions later, so for example if I did...

Code: Select all

 if Boy == True
    f "Oh, I'm sorry, but I'm not really into guys."
    else
    f "Hmm... I guess I don't mind."
It would work. Unless I'm thinking this through the completely wrong way.

User avatar
qirien
Miko-Class Veteran
Posts: 541
Joined: Thu Jul 31, 2003 10:06 pm
Organization: Metasepia Games
Deviantart: qirien
Github: qirien
itch: qirien
Location: New Mexico, USA
Discord: qirien
Contact:

Re: Change access to certain characters based on players gen

#2 Post by qirien »

Yes, at the beginning you could have a menu like this:

Code: Select all

menu:
    "What is your gender?"
    "Male":
        $ gender = "Male"
    "Female":
        $ gender = "Female"
    
if (gender == "Male"):
    $ nancy_pts += 10
    $ joe_pts += 10
elif (gender == "Female"):
    $ frank_pts += 10
    $ bess_pts += 10
You can increase these when players make choices these characters like, and then later you can have:

Code: Select all

        
if (bess_pts >= 10):
    bess "You're kinda cute"
else:
    bess "I don't think you're my type."
Hope this helps!
Finished games:
Image
Image
Image

User avatar
Kia
Eileen-Class Veteran
Posts: 1040
Joined: Fri Aug 01, 2014 7:49 am
Deviantart: KiaAzad
Discord: Kia#6810
Contact:

Re: Change access to certain characters based on players gen

#3 Post by Kia »

qirien said it all. to be clear you can give each character and the main player values to be compared:

player_chance_with_girls = 0
player_chance_with_boys = 0

sarah_intrest_in_boys = 100
sarah_intrest_in_girls = 40
sarah_attention = 0

john_intrest_in_boys = 10
john_intrest_in_girls = 70
john_attention = 0

fall_in_love_amount = 200

give player values based on his/her gender he chose and make a random amount add the 3 together the see if its equal or more than fall in love requirement. you can give each target a fall in love cap and let player improve the chance with training or something.
don't forget to use define when you define the variables

User avatar
trooper6
Lemma-Class Veteran
Posts: 3712
Joined: Sat Jul 09, 2011 10:33 pm
Projects: A Close Shave
Location: Medford, MA
Contact:

Re: Change access to certain characters based on players gen

#4 Post by trooper6 »

You don't have to do it through points, you can do some true/false as well.
Remember when writing your code: "=" means assigning value, "==" mean checking value.
Also remember you need to have ":" after your choices in your menus...and the indentation in your code wasn't right. You might want to review the Renpy quick start again for some of the basics.

All of that said, this is how to do what you want:

Code: Select all

define ljw = Character('Leather Jacket Woman', color="#c8ffc8")
define cw = Character('Cardigan Woman', color="#c8ffc8")
define xw = Character('X-Files Woman', color="#c8ffc8")

# The game starts here.
label start:
    $ boy = False 

    menu:
        "What gender are you?"
        "Boy":
            $ boy  = True
            jump scene1
        "Girl":
            $ boy  = False
            jump scene1
        "Other":
            $ boy  = True
            jump scene1
        
label scene1:
    "You were supposed to meet your blind date at the cafe. You were told that she would be wearing a white rose behind her ear. But there are three women with white roses! One is wearing a leather jacket with short spiky hair, one is wearing a cardigan sweater with her hair in a pony tail, and one is wearing an X-Files T-shirt with a shaggy hair cut."

    menu date_choice:
        "Which woman do you approach?"
        "Leather Jacket Woman":
            if boy:
                ljw "Hello! You must be my date!"
                jump leather_date
            else:
                ljw "Oh, I'm sorry, but I'm not into women."
                jump date_choice
        "Cardigan Woman":
            if boy:
                cw "Oh, I'm sorry, but I'm only into women."
                jump date_choice
            else:
                cw "Hello! You must be my date!"
                jump cardigan_date
        "X-Files Woman":
                xw "Hello! You must be my date!"
                jump xfiles_date
        "Date No One":
            "You find fulfillment as a single person with just your friends and family!"
            jump end

label leather_date:
    "You ride on motorcycles together. What a nice time!"
    jump end
    
label cardigan_date:
    "You debate philosophy together. What a nice time!"
    jump end
    
label xfiles_date:
    "You marathon a bunch of sci-fi TV and geek out together. What a nice time!"
    jump end
    
label end:
    "You live long and prosper!"
    return

But, since you want to be non-binary about how you see gender, I'd to the game like this:

Code: Select all

# Declare characters used by this game.
define e = Character('Eileen', color="#c8ffc8")
define ljw = Character('Leather Jacket Woman', color="#c8ffc8")
define cw = Character('Cardigan Woman', color="#c8ffc8")
define xw = Character('X-Files Woman', color="#c8ffc8")

# The game starts here.
label start:
    $ gender = "girl"
        
    menu:
        "What gender are you?"
        "Boy":
            $ gender  = "boy"
            jump scene1
        "Girl":
            $ gender  = "girl"
            jump scene1
        "Other":
            $ gender  = "other"
            jump scene21     
        
label scene1:
    "You were supposed to meet your blind date at the cafe. You were told that she would be wearing a white rose behind her ear. But there are three women with white roses! One is wearing a leather jacket with short spiky hair, one is wearing a cardigan sweater with her hair in a pony tail, and one is wearing an X-Files T-shirt with a shaggy hair cut."

    menu date_choice:
        "Which woman do you approach?"
        "Leather Jacket Woman":
            if gender == "boy":
                ljw "Hello! You must be my date!"
                jump leather_date
            else:
                ljw "Oh, I'm sorry, but I'm only into guys."
                jump date_choice
        "Cardigan Woman":
            if gender == "girl":
                cw "Hello! You must be my date!"
                jump cardigan_date
            else:
                cw "Oh, I'm sorry, but I'm only into gals."
                jump date_choice
        "X-Files Woman":
            if gender == "other":
                xw "Hello! You must be my date!"
                jump xfiles_date
            else:
                xw "Oh, I'm sorry, but I'm only into non-binary people."
                jump date_choice
        "Date No One":
            "You find fulfillment as a single person with just your friends and family!"
            jump end

label leather_date:
    "You ride on motorcycles together. What a nice time!"
    jump end
    
label cardigan_date:
    "You debate philosophy together. What a nice time!"
    jump end
    
label xfiles_date:
    "You marathon a bunch of sci-fi TV and geek out together. What a nice time!"
    jump end
    
label end:
    "You live long and prosper!"
    return
A Close Shave:
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?)
Check out My Clock Cookbook Recipe: http://lemmasoft.renai.us/forums/viewto ... 51&t=21978

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot]