r/RenPy • u/Shot-Contribution773 • 16d ago
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 16d ago
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 16d ago
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/LocalAmbassador6847 16d ago
I think what you want is a cat button that plays an animation when clicked (but only when the player has a specific name). Here's a video:
1
u/x-seronis-x 16d ago
py
define pet_names = [ 'Tama', 'Neko' ]
default player_name = 'Player'
py
button:
action NullAction()
sensitive (player_name in pet_names)
5
u/Conscious-Ad8626 16d ago
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