[Solved] How to give the option to change default MC's name?

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
User avatar
Mimrose
Regular
Posts: 33
Joined: Thu May 02, 2013 1:46 pm
Projects: Bitter Honey (Writer)
Contact:

[Solved] How to give the option to change default MC's name?

#1 Post by Mimrose » Tue May 14, 2013 7:27 pm

Hi!

When creating my MC, I would like to have it so that the player is free to change the name of the MC to their own or to whatever name they'd like, also how to make it so the change is permanent. (For example, if the MC's name was changed to Cecilia, what would you need to do so that every time the MC's name shows up, it would show Cecilia instead of the default name). Unfortunately, since I'm fairly bad at coding outside the basics, I'm not quite sure how to go about it.

Any help would be appreciated!!

Thank you :)
Last edited by Mimrose on Wed May 22, 2013 9:31 pm, edited 1 time in total.
Image

Need a writer or editor? Check out my recruitment page here! (Currently accepting short edit jobs, but closed as a writer)

Visit my tumblr for reviews about otome games, smexy pixel men, random reblogs, and fanfics! :D [/color]

User avatar
Googaboga
Eileen-Class Veteran
Posts: 1383
Joined: Wed Dec 12, 2012 1:37 pm
Completed: https://gbpatch.itch.io/
Projects: Floret Bond, XOXO Blood Droplets, Our Life
Organization: GB Patch Games
Tumblr: gb-patch
itch: gbpatch
Contact:

Re: How to give the option to change default MC's name?

#2 Post by Googaboga » Tue May 14, 2013 7:39 pm

Add this to the game when it is time for the player to choose their name:

Code: Select all

$ player_name = renpy.input("Enter name: ").strip()
$ p = Character(player_name, color="#736AFF")
You can change the p to something else if you want. p is the shortcut you use when writing dialog for the character. If you would rather have the short cut be mc or something it is fine.

You can also change the color section to whatever color you want. It determines the color that the name is written in. It doesn't change the dialog color just the name in the text box that shows who is speaking. That particular set of numbers is for a sort of blueish color.


Oh and when a character mentions the MC by name in the game use this in the code:

Code: Select all

%(player_name)s
In the game it will show up as whatever the chosen name is.


I'm not sure if there is another way or not but that is what I've been doing.
Last edited by Googaboga on Tue May 14, 2013 7:41 pm, edited 1 time in total.
In-Progress:
Floret Bond, XOXO Blood Droplets, Our Life
Released:
A Foretold Affair, My Magical Divorce Bureau, XOXO Droplets, Lake of Voices

User avatar
Mimrose
Regular
Posts: 33
Joined: Thu May 02, 2013 1:46 pm
Projects: Bitter Honey (Writer)
Contact:

Re: How to give the option to change default MC's name?

#3 Post by Mimrose » Tue May 14, 2013 7:40 pm

Thank you so much! This is very helpful :D
Image

Need a writer or editor? Check out my recruitment page here! (Currently accepting short edit jobs, but closed as a writer)

Visit my tumblr for reviews about otome games, smexy pixel men, random reblogs, and fanfics! :D [/color]

User avatar
Googaboga
Eileen-Class Veteran
Posts: 1383
Joined: Wed Dec 12, 2012 1:37 pm
Completed: https://gbpatch.itch.io/
Projects: Floret Bond, XOXO Blood Droplets, Our Life
Organization: GB Patch Games
Tumblr: gb-patch
itch: gbpatch
Contact:

Re: How to give the option to change default MC's name?

#4 Post by Googaboga » Tue May 14, 2013 7:42 pm

No problem. Good luck with your game :].
In-Progress:
Floret Bond, XOXO Blood Droplets, Our Life
Released:
A Foretold Affair, My Magical Divorce Bureau, XOXO Droplets, Lake of Voices

Post Reply

Who is online

Users browsing this forum: deltadidirac, Google [Bot], Kia