Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

Renpy: Selective choice showing up

A topic by LunarMoonStudios created Jan 28, 2024 Views: 329 Replies: 2
Viewing posts 1 to 3
(1 edit)

Hello everyone! So in the game that I'm currently working on, I want there to be a feature where if you make a certain choice earlier in the game then the set of next choice will be slightly different

So for example: Bunny goes to the store. She has two choices: buy milk or buy carrots. If she chooses carrots then in the next scene she gets three choices:  talk to a friend, text on her phone or steal the carrots. But if she had chosen the 'buy milk' option the same next scene would only offer her two choices: talk to a friend or text on her phone. I hope you understand what I mean

Also how do you hide a choice after you've selected it once?

If anyone knows how to do this in Renpy, please let me know. Thank you!

Moderator moved this topic to General Development

So I think the what you are looking for is to make menu choices conditional.  You can do this for both your milk and carrots and hiding choices later on. There are ways of doing this with using arrays or object attributes but for the sake of simplicity, lets just use variables. (Sorry for my lack of proper indenting, but you should get the idea)

create a variable to track if a player has made the choice or not.

default choice1 = False

make the display of the menu choice conditional to the variable (in this case only show the choice if it's the default of False

menu:

"choice 1" if choice1 == False:

Then when the player picks that choice, make sure to switch the flag of the variable to show they have picked that choice and it will not show the next time they run that menu script.

$ choice1 = True

Or in the case of milk or carrots

default  milk = False

default carrots = False

menu:

"Buy milk":

$ milk = True

"Buy carrots":

$carrots = True

menu:

"Drink milk" if milk == True:

n "You drink milk."

"Steal milk" if milk == False:

n "Since you didn't buy milk, you decided to steal it."

"Eat carrots" if carrots == True:

n "You eat carrots."

FYI if you have Renpy questions you might want to try the reddit or official forums.

https://www.reddit.com/r/RenPy/

https://lemmasoft.renai.us/

Thank you. It was very helpful :)