Tutorial: How to create a character that the player can name in a Ren’Py visual novel.

Someone very nicely asked how I did this in Must Love Jaws (where the player can name the shark), so I’ve made a tutorial. :)

(This is my first tutorial, I’m nervous!)

Okay, so first you pull up the script where you want this scene to happen. I wrote some conversation between Matt and Bernard that leads to them naming the shark. (Lines 606-611) Matt wants to name him “Bruce.” I added a Menu option where Bernard (the player) can agree with this, or pick a name themselves. (Lines 613-618)

Now this is where it get’s interesting: At Line 625, you need to type what you want to use as the label for the shark’s name (I used shark_name. Just remember that you’ll have to type it out EVERY time you use the shark’s name in dialogue), what you want the textbox to say (I wrote “I need to think up a better name for the shark”), and the character limit (meaning how many letters the name can be. I used a character limit of 10, so I typed length=10). Adding a character limit is important, because if the player chooses a long name, it could cause the text to go off-screen! 0_o Lines 627-628: Removes spaces if the player added one in the name. Lines 632-633: This code is in case the player leaves it blank. Lines 635-636: If the player types in Bruce, the name Matt suggested, the game acts as if the player agrees with Matt’s original suggestion. Lines 657-659: The player picking the name, followed by Bernard saying the name in conversation. EXTRA CREDIT - Lines 638-655: This code is for creating custom responses to certain names. I made it so that if you name the shark “Ogu Pigu,” (I did this in case ChrisTenarium played the game, which he did. XD ) Matt gets mad and changes the name to “Dave.” Also, if you name the shark “Dave,” Matt notes how it’s a plain name, but goes along with it anyway. You can also use this code to prevent the player from using swear words or other characters’ names.

I think that’s about it? Any questions, just let me know! Hope this helps. :)