renaming the characters

ankys

New Member
Jan 24, 2019
9
3
Dear all,
Actually i am new to this forum moreover i have no knowledge of computer language. I need your special help that what is the procedure to rename the characters in the game?? is it some special job or some good hacking is required to done the same?? if it is a simple job please explain . i will be very very thankful to you. Please tell me the games in which i rename the characters of the games. thanks again

regards
ankur
 

MissFortune

I Was Once, Possibly, Maybe, Perhaps… A Harem King
Respected User
Game Developer
Aug 17, 2019
4,914
8,026
A simple google search would've given you your answer much faster than asking here, honestly. But here's what I use for just regular names, that won't have any other special names/pet names attached to them:

Code:
$ player_name = ""

    $ player_name = renpy.input("What's his/her/your name?")
    $ player_name = player_name.strip()
    if player_name == "":
        $ player_name = "Lil Pump"
So the topmost line is more or less what the player will see when they're asked to enter a name. So, for example, in the parenthesis you ask for the players name in any fashion you'd like: ("What's your name?") is usually best, depending on your POV. The second and third line you can leave as is. What the third line is doing is basically saying: if [player_name] is blank, then give user this name.

So, in the example above: if player_name is "(blank)": $ player_name = "Lil Pump". Lil Pump would be the default name if player chooses not to enter one. You can change Lil Pump to anything you want, of course.

After applying that code, you'll want to define that name for your character. Like so:

Code:
define mc = Character("[player_name]", color="#ebdc38")
So, this will allow the player's chosen name to show up in the textbox, and the color can be changed to anything you like. So, how do you use this in a practical sense? Let's use two namable characters in context:

Code:
define mc = Character("[player_name]", color="#ebdc38")
define mc2 = Character("[player_name2]", color="#FFFFF")

$ player_name = ""

    $ player_name = renpy.input("What's your name?")
    $ player_name = player_name.strip()
    if player_name == "":
        $ player_name = "Lil Pump"

$ player_name2 = ""

    $ player_name2 = renpy.input("What's your your girlfriend's name?")
    $ player_name2 = player_name2.strip()
    if player_name2 == "":
        $ player_name2 = "Nick Cannon"
        
label opening scene:
    scene inthecloset1 with fade
    mc "Aye, Gucci Gang?"
    mc2 "Gucci Gang? Nah. I wanna diss Eminem and ruin what's left of my career with it."
    scene inthecloset2 with dissolve
    mc "Aye, Diamond Chains?"
    mc "Brain go poop if me thinks too much."
 

79flavors

Well-Known Member
Respected User
Jun 14, 2018
1,581
2,219
So two weeks later and you create a new thread asking the same thing... which I guess means you couldn't get your head around MissFortune's reply.

So let me try explaining it in a alternative way.

Firstly... It will all depend on what language/engine the game is written in. Lots of games here on F95 are written in RenPy. A lot in RPGMaker. Then there are other notable mentions like Unity, UnrealEngine, HTML, Flash and others. Each engine/language will have a completely different solution for renaming characters... some won't be possible at all.

Thankfully, based on this thread - it looks like you are trying to rename characters in Summer with Mia, which is written in RenPy - and RenPy is easy. Or at least, that's the first game you are interested in... the solutions(s) will be largely the same for other RenPy games.

At the very least, you're probably going to need to unpack the game using a tool called UnRen. Most games shipped by RenPy are compressed into a RenPy archive file archive.rpa or a collection of such archives *.rpa. UnRen un-compresses these, so you can access the RenPy source code. Occasionally developers get clever and remove the source code, but UnRen has a second option to rebuild the *.rpy files based on their equivalent *.rpyc (compiled RenPy code) files. Not all games use *.rpa archives - but if for any reason, you can't see *.rpy files in the game's /game/ folder (or /game/scripts/ or other subfolders) - then UnRen will likely be the solution.

The end result is that you can access the game's *.rpy files, which means you can change anything you like - as long as you can understand the very basics of the RenPy language.

Looking at "Summer with Mia" (which I just downloaded) - it doesn't use RenPy archives and the *.rpy source code files are already available for editing.

Your starting point will usually be the script.rpy file. Although developers can split their game up anyway they like.

In this particular game, the main character definitions are primarily in the script.rpy file. Although I also found a couple in Act_1_OoH_Story.rpy too. Additionally, there's a gallery too, which picks up some character names stored in a special RenPy storage area called persistent.

You don't have permission to view the spoiler content. Log in or register now.
You don't have permission to view the spoiler content. Log in or register now.
You don't have permission to view the spoiler content. Log in or register now.


The persistent in the gallery is probably going to go a little over your head at this stage. Just know that when run code like a gallery, it "forgets" everything that would normally be stored in a saved file... including your choices AND your character names. persistent is a way around that, where information you'd normally have in your saved file is copied to the persistent area - then when you run the gallery, it's copied back. The end result is that the gallery shows the choices and names that the latest playthrough had (which may be different than the first playthough, or second, etc.).

Anyway, forget that for the moment... what you probably want are the Character() names in the main script file.

So lets say you want to rename Emma to be "Saanvi". You'd simply start by changing:

define e = Character("Emma", who_color="#7c23b0")#dark purple
to
define e = Character("Saanvi", who_color="#7c23b0")#dark purple

Unfortunately, it's nowhere near that simple...

... again, looking at the Act_1_OoH_story.rpy file, there's a line of dialogue that reads:

mc "E-Emma? \n(Holy shit! Sam's [m_r!t] got hot as fuck!)"

The mc at the beginning of the line (before the quotes) just means the mc Character() is speaking.
The [m_r!t] is one way (I hate it) to show a variable called m_r as text type (!t). In this case, I think m_r stands for "Mia's relationship with MC"... it's probably "brother" or "roommate" (I'm guessing Sam has a brother/sister/roommate too.

Now, normally, after you've changed the Character() definition to rename the character - you'd edit the other script files to change anywhere where it says "Emma" to "Saanvi". A good text editor (like RenPy default editor Atom) will quite happily let you change one bit of text to another across multiple files (i.e. the whole project). But there are two problems.

Firstly... in this example... you'd now have "E-Saanvi? \n(Holy shit! Sam's [...]"... Does "E-Saanvi" really make sense? Surely it should be "S-Saanvi"? And therein lies the first problem with mass changing something as simple as a name.

Second... "Emma" might not only be used in dialogue. It might also be in the source code as part of a label or part of the name of an image.
Like label D_3_Noon_Liq_Emma_Helps:
... or image anim_emma_1120 = Movie(play="images/anim/anim_Emma_1120.webm")

Basically, you can't change EVERY occurrence of "Emma" to "Saanvi" for fear of breaking the game.
... At which point, it becomes a very time consuming exercise to selectively change the name everywhere it's used in game dialogue, without breaking the game by changing it anywhere else.

However there is a solution. RenPy includes something called "text filter". Almost every bit of text shown in game (including all the lines of dialogue) are run through the text filter before they are shown on screen. It's the last step in a process that means the game can alter things right before they are shown to the player. Sadly, not the character names.

So you'd create a new file in the /game/ folder. Maybe something like namechange.rpy, then copy/paste this code into it:

Python:
# --- namechange.rpy ---

init 3 python:

    wholeLineChg = {
        "E-Emma? \n(Holy shit! Sam's [m_r!t] got hot as fuck!)" :
            "S-Saanvi? \n(Holy shit! Sam's [m_r!t] got hot as fuck!)",
        }

    matchWordsChg = r'\b(?:emma|Emma|EMMA)\b'
    replaceWordsChg = {
        "emma": "saanvi",
        "Emma": "Saanvi",
        "EMMA": "SAANVI",
        }

    def smtf( text ):
        def innerChange( m ):
            return replaceWordsChg [ m.group(0) ]
        return wholeLineChg[text] if text in wholeLineChg else renpy.re.sub( matchWordsChg, innerChange, text )

    config.say_menu_text_filter = smtf

Talking it through...

init 3 python: is just technical bullshit. It's needed, but don't worry about it. Same with config.say_menu_text_filter = smtf and everything after def smft ....

wholeLineChg = { ... } is a list of WHOLE lines that need to be replaced. Everything is in pairs, with the first line being what you want to be replaced ... then a colon ( : ) ... then the replacement line. It has to be the WHOLE line, letter for letter otherwise it won't match. It's a good way to fix those oddball lines like "E-Emma...".

You might notice that the replacement line ends in a comma ( , ). This is to make it easier to add more lines onto the list without it being too much of a headache. While there's only one replacement line in the list right now, there could be as many as you like. Additionally, it's split over two lines (the before and after text) because it assumes some dialogue lines will be very long.

matchWordsChg = r'\b(?:emma|Emma|EMMA)\b' is a list of words to try and match. In this case, "emma", "Emma" and "EMMA". I'm just covering all the bases here, probably "Emma" alone would have been enough. The \b is code for "only check WHOLE words (to avoid problems like replacing names like "Tom" when the game might include other words like "stomp" or "tomb". The | means "OR", in this case... search for "emma" OR "Emma" OR "EMMA".

IF a word is matched to the matchWordsChg list, it then searches the replaceWordsChg = { ... } list for what to replace each word by. Again, matched pairs... "before" and "after" separated by a colon.

If it wasn't already obvious, the search and replace is case sensitive. "Emma" and "emma" are different.

So if you add this script into the game and edit it accordingly, that will take care of the game's dialogue. Editing the Character() lines will rename the speaking character. Both together will solve 99% of your problems - though you may need to come back and edit the "search and replace" script occasionally as you find exceptions.

Now the bad news... Summer with Mia isn't perfectly written. There are a couple of characters where this solution isn't going work. Specifically "Tom" and "Jimmy". With luck, those aren't the characters you cared about anyway. Nor is it easy to work with renaming the "mc" (main character) - but you can do that ingame already. I'm not going to explain why, because it's already a lot of information to take in. In addition, this sort of character renaming may not work when using the game's replay gallery, due to the way the game uses persistent data.


In summary:
  • (optionally) Unpack the game using UnRen
  • (optionally) recreate the *.rpy files using UnRen
  • Edit the game source lines that contain Character() definitions to rename the character.
  • Copy/Paste the namechange.rpy I included and edit it as needed.
  • Run the game and play.
  • Quit and then edit the namechange.rpy file anytime you come across something that isn't quite right.
  • Learn to live with problems you can't solve using namechange.rpy - it won't be worth the hastle.

As long as the game is RenPy... this solution will (mostly) work for other games. Other games in other game engines... all bets are off.
 
Last edited:

ankys

New Member
Jan 24, 2019
9
3
Thank you very much for giving this knowledge and thank you very much for taking your valuable time to write my answer, you have explained it in so much detail that I can understand it easily. Just as a help can you please tell me more games where there is option of renaming characters are possible like summertime with mia and two weeks. pls it really helps .
thanks
ankur
 

79flavors

Well-Known Member
Respected User
Jun 14, 2018
1,581
2,219
Realistically, most RenPy games are written in the same basic way.
There will exceptions of course... But this style of solution will work for most games.
With so many games out there, it's practically impossible to list them all.

All I can suggest is to pick the games you want to play anyway and see if this solution works for them. If not, no harm done.

I'm imagining that you want each game to have each mother named something specific. Then the sister to have a similar specific name you prefer. Or some variation on that theme. Just keep in mind, the visual models will all be vastly different and their character back stories will vary widely too.
 

ankys

New Member
Jan 24, 2019
9
3
thank you again for your immediate reply. In fact, I've played several games but I just need your help with a list of games where crack with naming characters is available like Summer With Mia, Two Weeks and Oath of Loyalty.Still I'm trying your way to rename characters. thank you again for your support
 

79flavors

Well-Known Member
Respected User
Jun 14, 2018
1,581
2,219
Ah. Maybe I'm missing something here then.

I was only talking about the basic version of "Summer with Mia". I wasn't aware of "Two Weeks" or "Oath of Loyalty" until you posted your replies. I certainly wasn't aware of any modded/cracked versions of any of these games, except that your SwM post I quoted was in a mod to that game now I think about it. I hadn't made that leap of faith, as you hadn't mention it.

So you're looking as some sort of "mod of a mod" type thing?
Perhaps I need to look at what the mod itself does, since it may already do renaming and you were merely asking how to install and use it. Kinda busy today, but if you can reply to clarify... that would help.
 

Meushi

Well-Known Member
Aug 4, 2017
1,146
12,727
Ah. Maybe I'm missing something here then.

I was only talking about the basic version of "Summer with Mia". I wasn't aware of "Two Weeks" or "Oath of Loyalty" until you posted your replies. I certainly wasn't aware of any modded/cracked versions of any of these games
I'm not familiar with the other games, but Oath of Loyalty has a built in mechanism for players to customize character names & their relationships in game (the names and relationships are all variables).

By default the relationships are boss, boss's wife etc. An incest patch is available which sets up these relationships to be father, mother etc. The same thing can be done without the ipatch, it's just a convenience thing so the player doesn't have to configure things each playthrough.
 
  • Like
Reactions: 79flavors