Renpy name changing code

Psyokratease

New Member
Aug 24, 2020
11
4
I've seen this asked, but never answered. Hopeing someone will drop a hint here to learn this.
I, for another, sometimes want the npcs to have other names. Ive done this by simple editor replace, and wondering if there is a more streamlined, maybe python command in a new rpy file?

I appreciate any helpful response to what probably is a newbie question..
 

AnimeKing314

Giant Perv
Game Developer
Jun 28, 2018
395
605
If the dev set it up so the rpy files are still there then just find where they first declared the character and change the name there. Otherwise if you know the variable name that was used to declare the character then in a new rpy file, use after load and redeclare the character with the new name there. (If you need further help I'll find links that better explain what I'm talking about when I'm actually on a computer cuz I hate looking for that stuff on mobile)
 

Psyokratease

New Member
Aug 24, 2020
11
4
If the dev set it up so the rpy files are still there then just find where they first declared the character and change the name there. Otherwise if you know the variable name that was used to declare the character then in a new rpy file, use after load and redeclare the character with the new name there. (If you need further help I'll find links that better explain what I'm talking about when I'm actually on a computer cuz I hate looking for that stuff on mobile)
Thank you so much for responding! I have a feeble grasp of what you're saying, so an example (at your convenience!) would certainly be welcome!
 

AnimeKing314

Giant Perv
Game Developer
Jun 28, 2018
395
605
Thank you so much for responding! I have a feeble grasp of what you're saying, so an example (at your convenience!) would certainly be welcome!
So I realized there is a potential problem with what I said before and it all depends on how the dev originally coded the game.

Option 1: Dev calls the character object whenever the character's name comes up. Code would look something like this:
Python:
define e = Character("Emma", who_color="#c8ffc8")
define mc = Character("Jeff")

...

e "Hello [mc], how are you?"
mc "I'm fine [e], and you?"
In this case either of my original solutions would work. If they use the character's actual name in the dialogue though then you'd need to change every instance so the original find & replace would be the only way.

As far as my solutions go, the first option would be to just change the name in quotes in the define statement. I also just remembered that after load won't work because it'll only set variables that don't exist yet (usually used for save compatibility). I'll try to keep thinking to see if there's another way
 

Psyokratease

New Member
Aug 24, 2020
11
4
So I realized there is a potential problem with what I said before and it all depends on how the dev originally coded the game.

Option 1: Dev calls the character object whenever the character's name comes up. Code would look something like this:
Python:
define e = Character("Emma", who_color="#c8ffc8")
define mc = Character("Jeff")

...

e "Hello [mc], how are you?"
mc "I'm fine [e], and you?"
In this case either of my original solutions would work. If they use the character's actual name in the dialogue though then you'd need to change every instance so the original find & replace would be the only way.

As far as my solutions go, the first option would be to just change the name in quotes in the define statement. I also just remembered that after load won't work because it'll only set variables that don't exist yet (usually used for save compatibility). I'll try to keep thinking to see if there's another way
Thank you!