Choosing Gender In VN

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
T4R4F13D
Newbie
Posts: 11
Joined: Fri Mar 25, 2016 4:18 am
Projects: BiCurious, The 4 Years Prologue Series
Organization: Hopeshot
Tumblr: tarafyingcarrot
Skype: tara.sipes
Location: United States
Contact:

Choosing Gender In VN

#1 Post by T4R4F13D » Sun Sep 09, 2018 11:07 pm

I was wondering if it's possible for the main character/player to choose their gender at the beginning of the story and have it affect the story. If so, please explain how?

User avatar
Per K Grok
Miko-Class Veteran
Posts: 675
Joined: Fri May 18, 2018 1:02 am
Completed: the Ghost Pilot, Sea of Lost Ships, Bubbles and the Pterodactyls, Defenders of Adacan Part 1
Projects: Defenders of Adacan Part 2
itch: per-k-grok
Location: Sverige
Contact:

Re: Choosing Gender In VN

#2 Post by Per K Grok » Mon Sep 10, 2018 1:01 am

T4R4F13D wrote:
Sun Sep 09, 2018 11:07 pm
I was wondering if it's possible for the main character/player to choose their gender at the beginning of the story and have it affect the story. If so, please explain how?
Yes.

You need a variable to store the information on the player character's gender. You could name that variable "gender".

One way you could give the player the option to chose, is by using a menu. It could look like this.

Code: Select all

menu:
    "Are you male or female?"
    "Male":
        $ gender=0
    "Female":
        $ gender=1
You can then use that information to make the game do different things dependent on the gender

Code: Select all

 
if gender==0:
     --- do something
elif gender==1:
    --- do something different 
Good luck with your project.

User avatar
TAEKO
Newbie
Posts: 21
Joined: Mon Jul 23, 2018 3:24 am
Contact:

Re: Choosing Gender In VN

#3 Post by TAEKO » Mon Sep 10, 2018 2:36 am

Just wanna add something minor... whenever the other characters talk about your character, they get the pronouns right by doing this.

Code: Select all

init python:
    gender = ""
    gender1 = ""
    gender2 = ""
    def genderrrr():
        global gender, gender1 ,gender2
        # global dTotal
        if gender == "male":
            gender1 = "he"
            gender2 = "guy"
        else:
            gender1 = "she"
            gender2 = "girl"
    config.python_callbacks.append(genderrrr)

label start:
    "Are you a boy or a girl?"
    menu:
        "Girl":
            $ gender = "female"
        "Boy":
            $ gender = "male"
    you "I'm a [gender2]"
    person1 "Hey have you heard of the new student?"
    person2 "Ugh that [gender2] always gets in my nerves!"
    person1 "Yeah [gender1] is so annoying!"
Last edited by TAEKO on Mon Feb 18, 2019 4:33 am, edited 3 times in total.
Don't read me...
Seriously don't.
Just kidding. I'm just an awkward potato who doesn't know what to say in my signature...

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

Re: Choosing Gender In VN

#4 Post by trooper6 » Mon Sep 10, 2018 2:40 am

One more time I'm going to do my regular post.

It is current best practices to define your variables outside of any block (i.e. not in init python), but using default.

Code: Select all

default gender = 1

label start:
    "You game starts. etc."
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: Google [Bot]