Request Ren'Py How To Create Mods That Edit Text In Ren'Py

Potato

Member
Oct 15, 2016
249
424
Now that Patreon is requesting developers to remove certain content from their games, it might be an idea for this community to edit certain things back in.

Are there people who can help/teach?
 

muttdoggy

Dogerator
Staff member
Moderator
Aug 6, 2016
7,793
43,553
If the archive is in .rpa form, it needs to be extracted to .rpy - Then you can edit the .rpy with several programs like notepad++ and search keywords then replace those. Be careful that you don't change a line of script. However, it's usually never a problem to edit the conversations.
I use Sam's UnRen and/or RPA Extractor to pull the .rpy files from the .rpa archives. Then I use notepad++ to edit the .rpy files.
I'm the one who does the DogMod for LabRats and it is one of the few mods I've done. I'm not a programmer and that game is fairly easy to mod.
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Respected User
Donor
Jun 10, 2017
10,145
14,830
[...]Then you can edit the .rpy [...]
Why ? Why always use brute force to mod Ren'py games ? It come with so many features that you can do it softly, in a gentle way, making the engine orgasm under your touch while giving birth to the game you want.
Let your imagination go wild. Not only it will be less works in the end (since you'll not have to redo everything for each new version), but it also let the player use more than one mod.

Take this particular case. You'll have to change so many dialog lines directly in the source code, that every single file will be changed. So, when the player will try to use it with another mod for this game, one will revert the change made by the other...
So what ? No more DogMod ? Mandatory incest for DogMod ? Each time an "Incest DogMod" and an "IncestFree DogMod" ? And why if the (will clearly happen) "lab rats incest mod" don't change the sentences in the same way than DogMod will do it ?
Why working in this hard way when you can make mods cohabit like two polite roommates ?

For this particular case, there's three "soft" possibilities :

1) Using one of the callback to change the text on fly.
I've already done something like this in a previous mod. It's easy to do it but it will be limited to generic changes, which isn't necessary the better option in this particular case. You can still go further with this approach, but it will need more works and probably require a more complex support behind.

2) Using the translation feature of Ren'py.
I'm pretty sure that it's not limited to wathever -> English. It can also translate PatreonEnglish into IncestEnglish. And like the engine fallback to the original text when it don't found a translation, you only need to copy, then "translate", the sentences you need to revert. It will also works fine with any new version, it's just that the new content will not be reverted to the "incest way" before you update the mod.

3) Game developers works hand in the hand with modders.
Instead of using hard coded sentences, they generalize the use of variables for part of the content. So, in place of something like :
Code:
m "But we can't do this, you are the son of my best friend !"
[...]
m "What ? Are you implying that I want to have sex with him ? He's the son of my best friend. You must be insane if you think that I see him that way."
you'll have something like :
Code:
$ mcIsForM = "the son of my best friend"
[...]
m "But we can't do this, you are [mcIsForM] !"
[...]
m "What ? Are you implying that I want to have sex with him ? He's [mcIsForM]. You must be insane if you think that I see him that way."
Then come a mod who just change the content of mcIsForM to "my son".
Obviously it will works better if the developers use each variable more than one time.


Please modders, stop to traumatize Ren'py games, start to mod them softly.
 

RexMoon

New Member
Feb 5, 2018
2
1
If the archive is in .rpa form, it needs to be extracted to .rpy - Then you can edit the .rpy with several programs like notepad++ and search keywords then replace those. Be careful that you don't change a line of script. However, it's usually never a problem to edit the conversations.
I use Sam's UnRen and/or RPA Extractor to pull the .rpy files from the .rpa archives. Then I use notepad++ to edit the .rpy files.
I'm the one who does the DogMod for LabRats and it is one of the few mods I've done. I'm not a programmer and that game is fairly easy to mod.
Hello ,may i ask this . I tried to edit some dialog texts of a Renpy-Visual Novel on Steam (I changed text log only )
I did like this
Step1: I used rpa-tool to extract scripts.rpa to the folder that contents those scripts.rpyc with this code
"rpatool -x scripts.rpa"
Step2: I used unrpyc-tool to turn an .rpyc into .rpc ,in my case ,its name is Chaper1.rpy
Step3: I used Notepad++ to edit some texts in Chaper1.rpy.Example : I changed "Good day to you" into "Glad to see you again"
Step4: Then I use rpatool to archived it with this code
"rpatool -c scripts.rpa"
Step5: I copied the scripts.rpa (which it contents new Chaper1.rpy and old Chaper1.rpyc ) and replaced the original scripts.rpa.

When I run the game ,this error showed :
IOError: Couldn't find file 'SteamGames/steamapps/common/game_name/game/scripts/Chapter1.rpyc'.

I thought Chaper1.rpyc will auto complie itself . Am I wrong or mising something ?
Very appreciate if you help me !
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Respected User
Donor
Jun 10, 2017
10,145
14,830
I thought Chaper1.rpyc will auto complie itself . Am I wrong or mising something ?
It will auto-compile itself, but not from a rpa file. So what you do wrong is your step 5.
1) "unRPA" every scripts, and let them in the [game main directory]/game folder.
2) move the .rpa file outside of this folder.
3) "unRPYC" every thing, still in the [game main directory]/game folder.
4) Edit the rpy file you want, directly in the folder.
5) Run the game
Now it should works.

When you're done with all the changes, and you've run the game at least once (to generate the .rpyc files, then you can generate a .rpa file if you want. But it's not mandatory. The best option is probably to generate a .rpa file with everything that isn't a script, and keep the rpy/rpyc files outside of the archive.
 
  • Like
Reactions: Lodas and fried

RexMoon

New Member
Feb 5, 2018
2
1
It will auto-compile itself, but not from a rpa file. So what you do wrong is your step 5.
.
I was not expecting someone will reply my question this fast (or even care to reply me :eazyHype:) in this old post.
I just began to put my interest in this and literally do whatever the Internet guilds me to do.
Thank you so much, I will try it soon .
Edited: I have succeeded. Thanks again !
 
  • Like
Reactions: spada76

THARAKA1984

Member
Apr 8, 2019
115
22
Hi.i am not a programmer.but i want edit some script.rpyc with incest contact, (because i usually play games on android.)the thing is i want to know, after i unrypc and changed script in notepad ** how to save it back to as rpyc file.
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Respected User
Donor
Jun 10, 2017
10,145
14,830
Hi.i am not a programmer.but i want edit some script.rpyc with incest contact, (because i usually play games on android.)the thing is i want to know, after i unrypc and changed script in notepad ** how to save it back to as rpyc file.
Save it as rpy, then run the game. It's Ren'py itself that will generate the rpyc files as part of its load process.
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Respected User
Donor
Jun 10, 2017
10,145
14,830
But how will he run it in renpy if the game is Android apk I'm having the same problem please teach me.
Oh... for this, you'll have to ask someone else, sorry, my knowledge of Ren'py/APK is too basic.
I remember seeing some mods that seem to works as additions to the original APK, but I haven't looked further since I don't need them.
This said, the best way to mod/patch an Android version is still to rebuild the whole package with the mod/patch included.
 

THARAKA1984

Member
Apr 8, 2019
115
22
Hi.can any one tell me is their any way to unrpyc the x-rpyc files.those files are inside the renpy apk games.