Tutorial : Basic Choice of Genders in Games

This simple tutorial will show you the basics of a binary gender selection, male or female. If there is interest for it, I could make an advanced version detailing a third or no gender option as well, but this should still be enough to give you an idea how to proceed on your own.

What you need in your startup file;


*create mc_isfemale false
*create mc_malefemale ""
*create mc_manwoman ""
*create mc_menwomen ""
*create mc_boygirl ""
*create mc_fathermother ""
*create mc_brothersister ""
*create mc_husbandwife ""
*create mc_heshe ""
*create mc_hisher ""
*create mc_himher ""

These are some of the more commonly used pronouns and designations given, depending on your game’s needs, you may ommit or add to these as you see fit. The best part is, once you have set them, you don’t need to worry about them anymore. And if you have scenes, choices or text that you wish to be exclusive to one gender simply check the boolean variable mc_isfemale using *if. An example is given further down.

These are two examples of what you may add in game.

Example 1;


Are you a boy or a girl?
*fake_choice
   #Boy
      *set mc_malefemale "male"
      *set mc_manwoman "man"
      *set mc_menwomen "men"
      *set mc_boygirl "boy"
      *set mc_fathermother "father"
      *set mc_brothersister "brother"
      *set mc_husbandwife "husband"
      *set mc_heshe "he"
      *set mc_hisher "his"
      *set mc_himher "him"
   #Girl
      *set mc_isfemale true
      *set mc_malefemale "female"
      *set mc_manwoman "woman"
      *set mc_menwomen "women"
      *set mc_boygirl "girl"
      *set mc_fathermother "mother"
      *set mc_brothersister "sister"
      *set mc_husbandwife "wife"
      *set mc_heshe "she"
      *set mc_hisher "her"
      *set mc_himher "her"

You are a ${mc_boygirl}. If you had a sibling, the sibling would call you ${mc_brothersister}. You go to the bathroom marked $!{mc_boygirl}s.

*if (mc_isfemale)
   *line_break
   Your father bought you a girl's bike.
*if (mc_isfemale = false)
   *line_break
   Your father bought you a boy's bike.

*page_break
*goto done

*label done
You are done.

Example 2;


Are you male or female?
*choice
   #Male
      *set mc_malefemale "male"
      *set mc_manwoman "man"
      *set mc_menwomen "men"
      *set mc_boygirl "boy"
      *set mc_fathermother "father"
      *set mc_brothersister "brother"
      *set mc_husbandwife "husband"
      *set mc_heshe "he"
      *set mc_hisher "his"
      *set mc_himher "him"
      *page_break
      *goto done
   #Female
      *set mc_isfemale true
      *set mc_malefemale "female"
      *set mc_manwoman "woman"
      *set mc_menwomen "women"
      *set mc_boygirl "girl"
      *set mc_fathermother "mother"
      *set mc_brothersister "sister"
      *set mc_husbandwife "wife"
      *set mc_heshe "she"
      *set mc_hisher "her"
      *set mc_himher "her"
      *page_break
      *goto done

*label done

YOU ARE A $!!{mc_manwoman}!!! If you had a child, the child would call you ${mc_fathermother}. If you were married, your spouse would call you ${mc_husbandwife}.  When the protagonist was young, ${mc_hisher} mother told ${mc_himher} to be ${mc_himher}self.

*choice
   *selectable_if (mc_isfemale = false) #I want to be a shinobi!
      *goto go_ninja_go_shinobi
   *selectable_if (mc_isfemale) #I want to be a kunoichi!
      *goto go_ninja_go_kunoichi
   #I don't like ninjas.
      *goto no_ninjas_please

*label go_ninja_go_shinobi
As a shinobi, you were the scourge of the break room, always climbing the walls.
*goto end

*label go_ninja_go_kunoichi
As a kunoichi, you were the scourge of the break room, always leaving your shurikens everywhere.
*goto end

*label no_ninjas_please
What a shame. No Ninjas for you then.
*goto end

*label end
THE END


Please note that in these examples, I have used 3 spacebar indents, make sure that the indentation fits with the rest of your code. With the exception of the indentation though, these can easily be copy pasted directly into your game. I have tried to include some good examples of what you can do with these simple variables, but I’ll be happy to answer questions, troubleshoot and take requests. I’m planning on creating several tutorials of different kinds as I have seen some of these questions being posted a lot. Good luck!

9 Likes

Oh so that’s what I was doing wrong. Thanks for the help

This is a great tutorial, @MutonElite! I had forgotten about the selectable_if choices. Looking forward to the rest of your tutorials!

I did something similar. I offered it to LordIrish to use on the Choice of Box site although not sure if it’s there. You should send your tutorials to him.

@FairyGodfeather I have it back up on the site.

@MutonElite I have added this as well

:slight_smile:

www.choiceofbox.com

Thank you very much. It never daunted on me that the most convenient way to name a variable is to just use the two alternative values :).

@that1german @MultipleChoice @Mayday Thank you all for the praise, always nice to be appreciated. :slight_smile: And if your games become a little little better with my help, all the better for me when I play them! Hehe.

@FairyGodfeather @Lordirish Great! Can never have too many tutorials, I noticed that despite choiceofbox and the wiki, people still asked so I figured I’d might as well put something up on here as well. Plus I was bored. :stuck_out_tongue:

Hope it will be of use. For the next one, I’m thinking inventory system and shops. We’ll see. Let me know if anyone has requests.

Quick question about *if statements if you have the time. Would I set them up like this?



*title
*blab a
*blabla
*create banditdead false

Then


This guy just tried to kill you. Do you
*choice
       #kill him
              *set banditdead true
              Hahaha he's dead
               *goto blabla
       #Let him go
               *set banditdead false
               Well that was stupid of you
               *goto blabla

And finally


You're surrounded by even more bandits!
         *if banditdead true
         They all jump on you at once, leaving your body for the vultures
          *if banditdead false
          You see a familiar face in the crowd. It's the bandit from before! Certainly he'll help right? Well he doesn't, cause he puts a shank in your neck.

*ending

So my question is am I doing it right?

I think your indents are wrong.

So


You're surrounded by even more bandits!
         
*if banditdead true
         They all jump on you at once, leaving your body for the vultures

*if banditdead false
          You see a familiar face in the crowd. It's the bandit from before! Certainly he'll help right? Well he doesn't, cause he puts a shank in your neck.


Also you need either

*if banditdead=true
*if banditdead=false

or

*if banditdead
*if not (banditdead)

1 Like

Ok so get rid of indents and include equal sign/parentheses in the statement. Got it. Thanks for the help :slight_smile:

If banditdead is a boolean, you don’t need to use true.


*if (banditdead)
   This is now true.
*if (banditdead = false)
   This is obviously false.

What’s worth remembering about indents is to be consistent, to stick with a standardized amount of them. If you choose to use 2 tab, then stick with it. If you choose to use 3 spacebar indents, same thing. You can’t mix them in the same paragraph, or maybe not even in the same scene.

The only times you need to indent is below a *choice and yet again below the #s, with a few exceptions such as the *scene_list. So if you have chosen to go with 3 indents, then it will be 3 spacebar indents below the *choice, and then 6 spacebar indents below the #, like so;


Do you? (No indents)
*choice
   #I choose to do so. (3 indents)
      You did (6 indents)
      *goto end
   #I choose not to. (3 indents)
      You didn't (6 indents)
      *goto end

*label end

This will remain true if you say nest a choice within a choice, like this;


Do you want some ice-cream? (No indents)
*choice
   #Yes (3 indents)
      Vanilla or chocolate? (6 indents)
      *choice
         #Vanilla, please. (9 indents)
            You have selected vanilla. (12 indents)
            *goto stop
         #Chocolate, please. (9 indents)
            You have selected chocolate. (12 indents)
            *goto stop
   #No (3 indents)
      I forgot you were allergic. (6 indents)
      *goto stop

*label stop

So the amount of indents doubles for every new *choice or # below the first *choice.

It is however recommended that you don’t nest too many choices within a choice, as the indentation will make it tougher to spot mistakes and it will look like a right mess, instead use *labels and *gotos when you can. Personally, I set the limit at 3 nested choices, including the first one, anything beyond that is a right nightmare.

Going back to the original post, I figured out how to use this code to change the genders of other characters, similar to what Choice of Zombies does (if you choose a female character, all npcs are female).

I just copied the set of variables a couple of times, changing “mc” to something else (in my case “sib” and “ally.” Then when I set the main character’s gender I also set the genders of the other two characters.

It’s a lot more work, because you basically have to replace EVERY pronoun with ${mc_himher}, etc. but it’s pretty cool.

Oh, and thank you @MutonElite for posting this. It’s a real lifesaver!

@toutomoutochan Thank you, glad to see it’s been of use. :slight_smile:

Everybody will find different things helpful; for me, I’d go a little bit nuts if I were typing 12-character pronouns all the time. My MC pronoun set is just {he} {him} etc. (masculine only because of the often important his/him distinction which doesn’t exist in feminine pronouns in English, not because the default MC is male).

And for gender swapping NPCs, I use xhe, xhim etc for characters of the preferred gender and zhe, zhim etc for the non-preferred (or second preferred, if bi).

That shorthand will be too short and thus unhelpful to some, but I find it much preferable to long pronoun variables.

@Havenstone I definately see your point and to each their own. This was just an example, no need to call them exactly what I suggested after all. :slight_smile: For me personnally, I like having both options present in the variable because it helps me with spelling if it’s something more complex than heshe and helps me remember what the other equivalent of a word/title is. I have yet to implement a third gender option in my own game though, so I haven’t decided yet how to handle that.