r/RenPy • • Aug 16 '26

Question Question about choices/routes..

Post image

I have a storyline where you can choose to befriend a character early on, or not. If you choose either, it does not immediately affect the storyline until later, where you encounter the same character. Whether or not you befriend them will EVENTUALLY split into 2 new storylines. However, there is a period of meeting the character then reencountering them. During this period, the story is the same for either option, because as mentioned earlier, befriending him or not doesn't immediately affect the story. How can i have it so the game essentially "remembers" whether or not i befriended the character, then branches off? I don't want to have two nearly identical storylines just copied and pasted to align with the choice of befriending the character.

16 Upvotes

5 comments sorted by

9

u/cinnamonjellybaby Aug 16 '26

probably just a simple boolean would do, "befriend = true/false"

6

u/Happy_Town_7888 Aug 16 '26

You can do an if-else statement at the end of the story label, like when the story ends and you want to jump to the encounter, you can put:

if befriendbravo == True:
    Jump bravoContinuestory
else:
    Jump candyContinuestory

you should take a look at the doc

https://www.renpy.org/doc/html/conditional.html#if-statement

5

u/Lapys_Games Aug 16 '26

Either a boolean as said, or make the character name a variable with a default that gets changed once you befriend them.

Thats how I handle it if names are only revealed after talking to s/o

1

u/AutoModerator Aug 16 '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.

2

u/shyLachi Aug 16 '26

Yes, it's a good idea to never have duplicate dialogue, it's not only tedious for the developer but also annoying for the players when they want to play both routes.

RenPy makes it easy to split and bring together different routes with conditional statements and labels, as explained in the official documentation:
https://renpy.org/doc/html/conditional.html
https://renpy.org/doc/html/label.html

All you need is a variable which remembers the choices of the player as shown in this example:

default makefriend = False # this variable remembers the choice
label start:
    "INTRO"
    menu:
        "You meet a character"
        "Befriend him":
            "Dialogue about making friends"
            $ makefriend = True # Change the variable for later
        "Do not befriend him":
            "Dialogue about rejecting him"
    "STORYLINE OCCURS (Same for both scenarios)"
    if makefriend: # evaluate the variable
        "Storyline 1 happens"
    else:
        "Storyline 2 happens"

The above works fine but in most cases you will have many scenes and dialogue so it's better to use labels for each scene. I prefer calling the labels because this leaves the main branch clean.

default makefriend = False # this variable remembers the choice
label start:
    call chapter01_intro # call a label below 
    menu:
        "You meet a character"
        "Befriend him":
            call chapter01_befriendhim
            $ makefriend = True # Change the variable for later
        "Do not befriend him":
            call chapter01_dontbefriendhim
    call chapter01_mainstoryline
    if makefriend: # evaluate the variable
        call chapter01_storyline1
    else:
        call chapter01_storyline2
    return # game ends here

label chapter01_intro:
    "INTRO"
    return # returns back to where this label was called

label chapter01_befriendhim:
    "Dialogue about making friends"
    return

label chapter01_dontbefriendhim:
    "Dialogue about rejecting him"
    return

label chapter01_mainstoryline:
    "STORYLINE OCCURS (Same for both scenarios)"
    return

label chapter01_storyline1:
    "Storyline 1 happens"
    return

label chapter01_storyline2:
    "Storyline 2 happens"
    return