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

Discussion in 'RPG Maker MV' started by ShadowMeowth, Mar 3, 2018.

  1. ShadowMeowth

    ShadowMeowth Creature of Quirks Member

    Messages:
    4
    Likes Received:
    2
    Location:
    Valencia, Spain.
    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. :)
     
    #1
  2. Harrumi

    Harrumi Veteran Veteran

    Messages:
    168
    Likes Received:
    538
    Location:
    canada
    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.
     
    #2
  3. ShadowMeowth

    ShadowMeowth Creature of Quirks Member

    Messages:
    4
    Likes Received:
    2
    Location:
    Valencia, Spain.
    First Language:
    Spanish
    Primarily Uses:
    Other
    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
     
    #3
  4. Plueschkatze

    Plueschkatze Veteran Veteran

    Messages:
    507
    Likes Received:
    1,485
    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: Mar 3, 2018
    #4
    Harrumi likes this.
  5. ShadowMeowth

    ShadowMeowth Creature of Quirks Member

    Messages:
    4
    Likes Received:
    2
    Location:
    Valencia, Spain.
    First Language:
    Spanish
    Primarily Uses:
    Other
    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?
     
    #5
  6. Plueschkatze

    Plueschkatze Veteran Veteran

    Messages:
    507
    Likes Received:
    1,485
    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.
     
    #6
  7. Nolonar

    Nolonar Veteran Veteran

    Messages:
    106
    Likes Received:
    112
    First Language:
    French, German
    Primarily Uses:
    RMMV
    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.
     
    #7
  8. ShadowMeowth

    ShadowMeowth Creature of Quirks Member

    Messages:
    4
    Likes Received:
    2
    Location:
    Valencia, Spain.
    First Language:
    Spanish
    Primarily Uses:
    Other
    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! :)
     
    #8
    Plueschkatze likes this.
  9. SwiftSign

    SwiftSign Veteran Veteran

    Messages:
    184
    Likes Received:
    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.
     
    #9
    Dreadshadow and Plueschkatze like this.
  10. Dreadshadow

    Dreadshadow Lv 38 Tech Magician Moderator

    Messages:
    3,651
    Likes Received:
    2,334
    First Language:
    Greek
    Primarily Uses:
    RMMV
    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!
     
    #10
    Plueschkatze likes this.
  11. scanime

    scanime Will Make RPGs For Fun Veteran

    Messages:
    35
    Likes Received:
    26
    Location:
    United States
    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: Mar 4, 2018
    #11
    Dreadshadow likes this.
  12. Zarsla

    Zarsla Veteran Veteran

    Messages:
    675
    Likes Received:
    190
    First Language:
    English
    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.
     
    #12

Share This Page