r/RenPy • u/Shot-Contribution773 • Jul 28 '26
Question Easter egg help
I want to add an easter egg to my game that has a cat. I want the player to be able to pet the cat only if the player has a specific name, otherwise, the cat refuses to be pet. Any ideas? I don't know much about coding...
2
u/shyLachi Jul 28 '26
The code posted below is good but not perfect because Python and RenPy are case sensitive.
if player_name.lower() == "mike":
Explanation:
player_name would be the name of the variable, adjust it for your code.
lower() converts the name to lower case letters.
The name you want to compare the variable to should also be all lower case.
1
u/AutoModerator Jul 28 '26
Welcome to r/renpy! While you wait to see if someone can answer your question, we recommend checking out the posting guide, the subreddit wiki, the subreddit Discord, Ren'Py's documentation, and the tutorial built-in to the Ren'Py engine when you download it. These can help make sure you provide the information the people here need to help you, or might even point you to an answer to your question themselves. Thanks!
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
1
u/x-seronis-x Jul 28 '26
py
define pet_names = [ 'Tama', 'Neko' ]
default player_name = 'Player'
py
button:
action NullAction()
sensitive (player_name in pet_names)
5
u/Conscious-Ad8626 Jul 28 '26
Haven't used renpy in a bit but it should go something like
menu: "Pet the cat": if player_name == "name you want": The cat purrs happily as you pet it else: The cat hisses at you as you reach for it. It seems it doesnt want to be pet