Page 1 of 1

Choosing Gender In VN

Posted: Sun Sep 09, 2018 11:07 pm
by T4R4F13D
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?

Re: Choosing Gender In VN

Posted: Mon Sep 10, 2018 1:01 am
by Per K Grok
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.

Re: Choosing Gender In VN

Posted: Mon Sep 10, 2018 2:36 am
by TAEKO
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!"

Re: Choosing Gender In VN

Posted: Mon Sep 10, 2018 2:40 am
by trooper6
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."