slothvely

Warper
Member
Joined
Jul 7, 2022
Messages
2
Reaction score
1
First Language
English
Primarily Uses
RMVXA
Hello all,

After failing miserably to write a script myself, I come to you for help.
For localisation purposes I want to support gendered dialog.
For English, there is of course no issue, but some languages have gendered verbs, adjectives and nouns...
As it would increase the amount of dialog threefold, I cannot use the simple solution of conditional branches.
So here is what I want to do:
Using a variable, that is set to either 0, 1 or 2, I want to be able to call either neutral, male or female dialogue options.
The player will be able to choose their gender at the start of the game and the respective value will be assigned.
Then inside the dialogue it should look something like this:
"You don't know if \x[they heard|he heard|she heard] you."
And depending on the assigned value, the expected gender option will be displayed within the text.

I just about figured that variables are called and set with $game_variables[x]=y, but for actually setting conditions depending on the value, I couldn't find any reference and was thus lost very quickly.
This post I found for RPGMaker MV is similar to what I am trying to achieve, but I could not make sense of the script as a reference:
https://forums.rpgmakerweb.com/inde...the-choice-at-the-beginning.92133/post-835689
I am very intent on supporting the neutral option, so a switch would not work either.

If anyone is able to figure this out, I'd be so grateful.
 

slothvely

Warper
Member
Joined
Jul 7, 2022
Messages
2
Reaction score
1
First Language
English
Primarily Uses
RMVXA
Glad you knew that that code would not work for VX Ace.
You could try MR. Bubble Wand's Gender Functions.
Explaination here - https://mrbubblewand.wordpress.com/rgss3/gender-functions/
Script here - https://github.com/Archeia/RMVXA-Script-Repository/tree/master/Mr. Bubble/Utility
I came across this script during my search, but it seems that it still uses conditional branches to work, so it is not quite what I am looking for. Thank you very much regardless!
 

Roninator2

Gamer
Veteran
Joined
May 22, 2016
Messages
4,258
Reaction score
1,159
First Language
English
Primarily Uses
RMVXA
not quite what I am looking for
Ruby:
# ╔═════════════════════════════════════╦════════════════════╗
# ║ Title: Gender Text                  ║  Version: 1.00    ║
# ║ Author: Roninator2                  ║                    ║
# ╠═════════════════════════════════════╬════════════════════╣
# ║ Function:                           ║   Date Created     ║
# ║   Add escape code to message box    ╠════════════════════╣
# ║   Choose name based on variable     ║    20 May 2022     ║
# ╚═════════════════════════════════════╩════════════════════╝
# ╔══════════════════════════════════════════════════════════╗
# ║ Instructions:                                            ║
# ║                                                          ║
# ║    Set Variable in the game to 0, 1 or 2                 ║
# ║    Can be more if you want                               ║
# ║                                                          ║
# ║    text boxes will be formated like this                 ║
# ║                                                          ║
# ║    "I think that \lg[he, she, they] is funny"            ║
# ║                                                          ║
# ║     When the variable is 0 the text will show up as      ║
# ║    "I think that he is funny"                            ║
# ║                                                          ║
# ║     When the variable is 2 the text will show up as      ║
# ║    "I think that they is funny"                          ║
# ║                                                          ║
# ║      I picked lg as the code to mean life gender         ║
# ║                                                          ║
# ║    The text can also be longer. It is seperated          ║
# ║    by the comma. So you can write more than one word     ║
# ║    in the text box. As you saw in the example            ║
# ║    'they is' is not really good english                  ║
# ║    So you can write longer conversations                 ║
# ║    "I think that \lg[he is,she is,they are] funny"       ║
# ║                                                          ║
# ╚══════════════════════════════════════════════════════════╝
# ╔══════════════════════════════════════════════════════════╗
# ║ Updates:                                                 ║
# ║   2022-Jul-07 - Initial publish                          ║
# ╚══════════════════════════════════════════════════════════╝
# ╔══════════════════════════════════════════════════════════╗
# ║ Terms of use:                                            ║
# ║ Free for all uses in RPG Maker VX Ace - except nudity    ║
# ╚══════════════════════════════════════════════════════════╝

module R2_Gender_Names
  Names_Var = 5 # variable that will hold the key value
end

class Window_Base < Window
  alias convert_escape_characters_r2_gender convert_escape_characters
  def convert_escape_characters(text)
    result = convert_escape_characters_r2_gender(text)
    result = convert_text_gender_variable(result)
    return result
  end
  def convert_text_gender_variable(result)
    result.gsub!(/\eLG\[(\w+(?:[, ]*\w*)*)\]/i) { gender_text_name($1) }
    return result
  end
  def gender_text_name(names)
    names.split(",").each_with_index do |name, i|
      if i == $game_variables[R2_Gender_Names::Names_Var]
        return name
      end
    end
  end
end
 

Latest Threads

Latest Profile Posts

Anyone know of any good guides for editing the UI in RMMV?
eris2.png
just 1 more then I'm done with these sheets *tears of joy*
Im free today . finally have some time to continue coding . yes!
Regret that I wasn't able to actually finish my igmc entry in time for the actual igmc. Will probably just offload it as a standalone thing.

Forum statistics

Threads
124,430
Messages
1,163,534
Members
163,233
Latest member
Nannou
Top