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.
So right the player can choose his MC name in-game, but I got a few requests if they can change it again (later) and want to add this feature to main menu. I saw a few games that offer that.
Can anybody suggest any topic on this? Or a guide? (only a beginner at renpy)
Do I use the same code as below? But how do I use it? When a player clicks on the menu where do I send them?
if not persistent.player_name:
label nameYourCharacter:
$ player_name = renpy.input("What would you like to be called? If leave this blank, your secret name will be {b}Steven{/b}.")
$ player_name = player_name.strip()
if not player_name:
$ player_name = "Steven"
$ persistent.player_name = player_name
"Great! Lets get started, [persistent.player_name]"
jump afterNaming
else:
"Your name is {b}[persistent.player_name]{/b}. Do you want to keep this name?"
menu:
"Keep the name {b}[persistent.player_name] ":
"All will know you as {b}[persistent.player_name]{/b}."
jump afterNaming
"Change the name {b}[persistent.player_name]{/b}":
"Ok, {b}[persistent.player_name]{/b}."
jump nameYourCharacter
label afterNaming:
label _name_changer:
$ player_name = renpy.input("What would you like to be called? If leave this blank, your secret name will be {b}Steven{/b}.")
$ player_name = player_name.strip()
if not player_name:
$ player_name = "Steven"
$ persistent.player_name = player_name
return
label name_changer:
if not persistent.player_name:
call _name_changer
"Great! Lets get started, [persistent.player_name]"
else:
"Your name is {b}[persistent.player_name]{/b}. Do you want to keep this name?"
menu:
"Keep the name {b}[persistent.player_name] ":
"All will know you as {b}[persistent.player_name]{/b}."
"Change the name {b}[persistent.player_name]{/b}":
"Ok, {b}[persistent.player_name]{/b}."
call _name_changer
return
You can alter your code and make it look like this, then in the main menu, the button that will trigger the name change, use the action Start("name_changer").
Eg.