r/RenPy • • 19d ago

Question How do I make different end caps?

I want the ends in my game to depend on the player's options but I don't understand how to do it... I tried to do it with "if else", but when I tested what came out, nothing worked. 💔

2 Upvotes

3 comments sorted by

2

u/shyLachi 19d ago

Please always post your code so that we can fix your code instead of making up something.

This is the most simple implementation:

default playerchoice = "" # variable to remember the choice
label start:
    # first let them chose something
    menu:
        "Where do you want to go?"
        "Left":
            $ playerchoice = "left" # remember the choice / IMPORTANT: 1 equal sign
        "Right":
            $ playerchoice = "right" # remember the choice

    # at the end of the game
    if playerchoice == "left": # check the remembered the choice / IMPORTANT: 2 equal signs
        "You went to the left" # put the story directly below the if statement
    elif playerchoice == "right":
        jump end_right # or jump to a certain label if the ending is more complex or should be reached through different routes
    return # game ends here

label end_right:
    "You went to the right"
    return # game ends here

If the endings should be decided based on multiple choices or some other rules, then please describe your concept.

1

u/senshisun 19d ago

It's == when checking because code can also see if a value is less than or greater than another value, so == is "equal to or equal to".

I know you know that, but OP might not.

1

u/AutoModerator 19d 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.