Gender-based text depending on the choice at the beginning.

ShadowMeowth

Creature of Quirks
Member
Joined
Mar 2, 2018
Messages
4
Reaction score
2
First Language
Spanish
Primarily Uses
Other
Hey there! Pleased to meet you all. Well, I am new to the community, and I have been toying around with RPG Maker MV to try create something. The thing is, I am next to incultured in programming language and scripts and variables and anything involving maths, and here I am struggling with an issue.

I shall explain. While the game's characters are well-defined and have their own gender, there is a choice in the beginning, the usual one, of "are you a man or a woman?" This is because the characters will refer to a third person whose gender will vary depending of the starting choice, throughout the game. Is there any way to achieve it?

Do not hesitate to explain it as if it were an explanation for fools, my brain has its limits. |'D

Thanks in advance for your help. :)
 

Harrumi

Veteran
Veteran
Joined
Dec 13, 2017
Messages
194
Reaction score
618
First Language
English
Primarily Uses
RMMV
I think this would be done through if conditions, but I'm not 100% sure exactly what you mean.
 

ShadowMeowth

Creature of Quirks
Member
Joined
Mar 2, 2018
Messages
4
Reaction score
2
First Language
Spanish
Primarily Uses
Other
I think this would be done through if conditions, but I'm not 100% sure exactly what you mean.
I will try making some example...

For instance, if you chose "female" in the initial choice, then the characters would say something like:

Character1: "If I only knew [x] is safe." = in this case, [x] would be either the character's name, or a pronoun, or the like.

But if you chose "male", then it would change to: "If I only knew he is safe."

Not only with pronouns, but with whatever gendered word or article or whatever, and about a non-appearing character.

I am not sure if I explained myself or I just muddled up things more, but still. |'D
 

Plueschkatze

Veteran
Veteran
Joined
Aug 4, 2016
Messages
522
Reaction score
1,551
First Language
German
Primarily Uses
N/A
You could event it by using conditions.
Set a Switch or a Variable when you let the player decide the gender
Switch (n) = ON = Female

for every conversation you would need to do a conditional branch
if switch (n) = ON
all dialogue with female pronouns
else
all diaglogue with male pronouns.

You'd need to always do this.
 
Last edited:

ShadowMeowth

Creature of Quirks
Member
Joined
Mar 2, 2018
Messages
4
Reaction score
2
First Language
Spanish
Primarily Uses
Other
You could it event it by using conditions.
Set a Switch or a Variable when you let the player decide the gender
Switch (n) = ON = Female

for every conversation you would need to do a conditional branch
if switch (n) = ON
all dialogue with female pronouns
else
all diaglogue with male pronouns.

You'd need to always do this.
That might work! I shall try. Though my RPG Maker language set is in Spanish. Does it matter if I introduce the command in English, or does it have to be in its Spanish equivalent?
 

Plueschkatze

Veteran
Veteran
Joined
Aug 4, 2016
Messages
522
Reaction score
1,551
First Language
German
Primarily Uses
N/A
That's not a script call.

0blah.PNG

Conditional branch is an actual event function.
Chose switch (name it gender=female or so, so can remember what it does)
and check "create else" at the bottom.
 

Nolonar

Veteran
Veteran
Joined
Feb 18, 2018
Messages
163
Reaction score
243
First Language
French, German
Primarily Uses
RMMZ
If you only need small changes, then I wouldn't use conditional branches, because you'll have to write the same text twice every time you need to use male/female pronouns.

A plugin would be much better suited.
So I wrote one for you:

Code:
//=============================================================================
// GenderSpecificMessages
//=============================================================================
/*:
 * @plugindesc Provides a method to easily make changes to messages depending on the player's gender.
 * @author Nolonar
 *
 * @param Gender Switch ID
 * @desc The ID of the Switch that defines the player's gender.
 * @default 1
 * @type number
 *
 *
 * @help
 * Adds the following control character:
 * \x[male|female]
 *
 * Example
 *     "Hello, young \x[man|lady]! How are you today?"
 *
 * If switch is off -> Hello, young man! How are you today?
 * If switch is on -> Hello, young lady! How are you today?
 */
(function() {
//=============================================================================
// Settings
//=============================================================================
    var Parameters = PluginManager.parameters('GenderSpecificMessages');
    var Param = {
        GenderSwitchId: Number(Parameters['Gender Switch ID'])
    }
    var IsFemale = function() {
        return $gameSwitches.value(Param.GenderSwitchId);
    }
//=============================================================================
// Window_Base
//=============================================================================
    var _Window_Base_convertEscapeCharacters = Window_Base.prototype.convertEscapeCharacters;
    Window_Base.prototype.convertEscapeCharacters = function(text) {
        text = _Window_Base_convertEscapeCharacters.call(this, text);
        text = text.replace(/\x1bx\[(.*?)\|(.*?)\]/gi, function() {
            return IsFemale() ? arguments[2] : arguments[1];
        });
        return text;
    };
})();
How to install:
In your project's folder, there's a "js" folder. Inside, there's a "Plugins" folder with a couple of .js files.
Make a copy of one of the .js files. To do so, select a file (for instance "AltMenuScreen.js"), press Ctrl + C, then Ctrl + V, and the copy will appear (in this case "AltMenuScreen - copy.js").
Rename the copy into "GenderSpecificMessages.js".
Open the file in Notepad (or Notepad++). To do so, right-click on the file and click on "Edit" instead of "Open".
Replace the content of the file with the plugin code from above.

Open RMMV.
Open the Plugin Manager (click on the jigsaw icon, to the right of the Database).
There should already be 2 plugins. Click below the last plugin to select an empty row. Double-click the empty row.
Under "Name" select our plugin ("GenderSpecificMessages"), then click OK.

How to use:
1. You need a Switch that defines if the player is male or female (ON means female, OFF means male). If you want it to be the other way around (ON for male, OFF for female), then just modify the plugin, like this:
Code:
            return IsFemale() ? arguments[1] : arguments[2];
Just find the line that looks very similar and replace it with this new one.
By default, the gender Switch is Switch #0001. If you want to use a different switch, just change the plugin's setting. To do so, open the Plugin Manager, double-click on our plugin ("GenderSpecificMessages"), then double-click on "Gender Switch ID" on the right, then input another number.

2. When you write a message, you can insert "\x[male|female]" so RMMV will automatically select the right one.
For example:
Hello, young \x[boy|girl], how are you today?

Will change to
Hello, young boy, how are you today?
or
Hello, young girl, how are you today?
depending on whether the Switch is ON or OFF.


Important note:
If you need vastly different messages, like:
Male: "Who are you, man? Why are you looking at me like that?"
Female: "Hello, beautiful! Would you like to have a chat over tea?"

then you should use a Conditional Branch instead. The plugin is only for small differences.


Ah, before I forget...
Terms of use for the plugin:
Feel free to use it as you like for any RPG Maker project, commercial or non-commercial.
No need to mention me in the credits if you don't want to.
Feel free to modify the plugin as necessary.
You may redistribute the plugin if you like, as long as you don't change the "@author Nolonar" part or claim the plugin for your own.
You're not allowed to sell the plugin by itself or as part of a resource pack, but it's OK to sell RPG Maker games that use the plugin.
 

ShadowMeowth

Creature of Quirks
Member
Joined
Mar 2, 2018
Messages
4
Reaction score
2
First Language
Spanish
Primarily Uses
Other
That's not a script call.

View attachment 84100

Conditional branch is an actual event function.
Chose switch (name it gender=female or so, so can remember what it does)
and check "create else" at the bottom.
Alright! I tried and it worked. I will have to do extra dialogues, but it is a fine solution. Thank you so much for your time! :)
 

SwiftSign

Veteran
Veteran
Joined
Aug 5, 2015
Messages
184
Reaction score
45
First Language
English
Primarily Uses
RMMV
I like setting a a variable for this. Set Var1 = ‘he’ if male. Then if you simply need the right pronoun you can use \v[1] in your text with no vonditionz.
 

_Shadow_

Tech Magician Level:
Moderator
Joined
Mar 2, 2014
Messages
4,078
Reaction score
2,654
First Language
Greek
Primarily Uses
RMMZ
I like setting a a variable for this. Set Var1 = ‘he’ if male. Then if you simply need the right pronoun you can use \v[1] in your text with no vonditionz.
This is probably the BEST suggestion so far.
Doesn't even need to run any commands or install any plugin.
It can be done with pure eventing.
You can either make Conditional Branches with exact copy-paste of a huge dialogue and change "he" to "she", or just use this VERY clever solution, write the Event dialogue once and instead of he/she, he's/she's, his/her, man/woman you can use variables that have been already set up with values after player choose gender.
Spectacular!
 

scanime

Will Make RPGs For Fun
Veteran
Joined
Mar 7, 2014
Messages
35
Reaction score
26
First Language
English
Primarily Uses
RMMV
And in case you completely missed it at first like me, you can set a variable to text by using the Script option at the bottom of the Control Variables command. Then put your text there in quotes, like so: 'she' or "him"

I spent all my time before that use pure scripting to assign variables text values...

I'd also recommend that you have a few variables set aside for the pronouns that you would use frequently. I don't know if your game will be in English, but if it is I would have three sets of variables: he/she, him/her, and his/her. Then I would have a few more variables set aside for temporary use of words you would need less often, like boy/girl or for when you need capitalization like He/She.
 
Last edited:

Zarsla

Veteran
Veteran
Joined
Jan 23, 2015
Messages
710
Reaction score
228
First Language
English
Primarily Uses
I'm usimg this plugin in my game. To set the gender of an actor, with a choice, don't notetag the actor instead in the event where you choose man or woman use this script calls(using thge script call event):
$gameActors.actor(x).setGender("text");

So in my game I have this choice set up for actor 1.
So under the man choice I have:
$gameActors.actor(1).setGender("male");

And under woman I have:
$gameActors.actor(1).setGender("female");

And then in messages use this for the actor:
\actgen[x,y,z]
Replace 'x' with the actor ID as it is stated in the database, 'y' with the male variant and 'z' with the female variant.
Examples: \actgen[1,gentleman,lady] - will draw 'gentleman' if actor 1 or 'lady' if female.

\pargen[x,y,z]
Replace 'x' with the index of the wanted party member in the party.0 is the party leader, 1 is the second member, etc.
, 'y' with the male variant and 'z' with the female variant.
Examples: \pargen[0,gentleman,lady] - will draw 'gentleman' if
the party leader or 'lady' if female.

Also place this under Yanfly Plugins.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

grief... lol... I keep seeing request for MZ versions of MV plugins. this is why I haven't moved over and just MZ for my MV project.
Egg-sitting minigame is coming along nicely. Are you a bad enough dino to keep all these raptor eggs warm?

I forgot to post the animated version of the previous map I was working on. I'm still arguing with myself on if I like the stark blue ground better than the undergrowth ground used on the waterfall map. Hmm...
now that fmod is free for indie(<200k revenue), it would be interesting to see someone add fmod support for rpg maker
Can't say I can't promise progress on a project just yet. But I can say I had fun databasing tonight. :)

Forum statistics

Threads
105,800
Messages
1,016,555
Members
137,492
Latest member
KOGA
Top