[SOLVED] Remembering conditional branches even after the game ends?

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
User avatar
Rinzamakani
Regular
Posts: 74
Joined: Wed Aug 16, 2017 3:23 pm
Completed: Love's Apathy (Ciro route), A Frigid Space, Telechronic Static
Projects: Love's Apathy (Full)
itch: rinzamakani.itch.io
Contact:

[SOLVED] Remembering conditional branches even after the game ends?

#1 Post by Rinzamakani »

Hello. There is a feature I'd like to include in my game. I want it so that if the player gets a certain ending and reloads the game, a completely different event plays out in place of that. For example, character 1 gives the main character an item and then the player gets to the end. But then when they reload and pass through that section again, it jumps to another branch completely and she remembers she had the item in her pocket, unlocking new dialogue and character events. I've tried the if "___" == true but that didn't seem to work. Is there any other way to do this properly?
Last edited by Rinzamakani on Thu Jul 19, 2018 1:24 pm, edited 1 time in total.

mikolajspy
Regular
Posts: 169
Joined: Sun Jun 04, 2017 12:05 pm
Completed: Too many, check signature
Deviantart: mikolajspy
Location: Wrocław, Poland
Contact:

Re: Remembering conditional branches even after the game ends?

#2 Post by mikolajspy »

Sounds like you're on the right track, just use persistent variables - https://www.renpy.org/doc/html/persistent.html
Something like:

Code: Select all

default persistent.firstending = False
#... something happens
$persistent.firstending = True
#-------------------------------
# back to where you want to have branch:
if persistent.firstending == True:
    #what happens if player finished game once

User avatar
Rinzamakani
Regular
Posts: 74
Joined: Wed Aug 16, 2017 3:23 pm
Completed: Love's Apathy (Ciro route), A Frigid Space, Telechronic Static
Projects: Love's Apathy (Full)
itch: rinzamakani.itch.io
Contact:

Re: Remembering conditional branches even after the game ends?

#3 Post by Rinzamakani »

mikolajspy wrote: Tue Jul 17, 2018 1:56 pm Sounds like you're on the right track, just use persistent variables - https://www.renpy.org/doc/html/persistent.html
Something like:

Code: Select all

default persistent.firstending = False
#... something happens
$persistent.firstending = True
#-------------------------------
# back to where you want to have branch:
if persistent.firstending == True:
    #what happens if player finished game once
Thank you! It works. :D Yet is there a way to witness the ending again? And is this set up correct the way? I placed the default persistent.ciroend4 = False above the label start in the script.
Attachments
Screenshot (153).png

mikolajspy
Regular
Posts: 169
Joined: Sun Jun 04, 2017 12:05 pm
Completed: Too many, check signature
Deviantart: mikolajspy
Location: Wrocław, Poland
Contact:

Re: Remembering conditional branches even after the game ends?

#4 Post by mikolajspy »

Looks like it should work. Note: After checking if it's alright, to play game again, in Launcher click "Delete persistent", otherwise variable stays True or value you assigned.
I don't know how your story should work, but I guess that after second ending, you can just set that persistent to "False" again :)

Or maybe you'd want to let player choose which ending they want to see, if they saw both already? Just make use of another persistent value to check if second ending has been reached, and then just before split:

Code: Select all

#blah blah blah
if persistent.ending1 and persistent.ending2:  #you can omit '== True' part and it will still work. If you want to check 'False', then add '== False'
    menu:
        "See first ending":
            jump firstending
        "See second ending":
            jump secondending

User avatar
Rinzamakani
Regular
Posts: 74
Joined: Wed Aug 16, 2017 3:23 pm
Completed: Love's Apathy (Ciro route), A Frigid Space, Telechronic Static
Projects: Love's Apathy (Full)
itch: rinzamakani.itch.io
Contact:

Re: Remembering conditional branches even after the game ends?

#5 Post by Rinzamakani »

mikolajspy wrote: Wed Jul 18, 2018 1:48 pm Looks like it should work. Note: After checking if it's alright, to play game again, in Launcher click "Delete persistent", otherwise variable stays True or value you assigned.
I don't know how your story should work, but I guess that after second ending, you can just set that persistent to "False" again :)

Or maybe you'd want to let player choose which ending they want to see, if they saw both already? Just make use of another persistent value to check if second ending has been reached, and then just before split:

Code: Select all

#blah blah blah
if persistent.ending1 and persistent.ending2:  #you can omit '== True' part and it will still work. If you want to check 'False', then add '== False'
    menu:
        "See first ending":
            jump firstending
        "See second ending":
            jump secondending
I see. Thank you! I figured I'd set it to false at some point. That way, the player could go through a sort of loop with both endings.

Post Reply

Who is online

Users browsing this forum: Ocelot