[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: 55
Joined: Wed Aug 16, 2017 3:23 pm
Completed: Love's Apathy (Demo)
Projects: Love's Apathy (Full), A Frigid Space
itch: rinzamakani.itch.io
Contact:

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

#1 Post by Rinzamakani » Tue Jul 17, 2018 12:45 pm

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.
I've created an amino dedicated to learning Ren'py and finding resources. We need more members. Feel free to check it out!
http://aminoapps.com/invite/GLQD3S588Z

mikolajspy
Regular
Posts: 169
Joined: Sun Jun 04, 2017 12:05 pm
Completed: Jake's Love Story, NEKOKORO
Projects: Courage for a Kiss
Deviantart: mikolajspy
Location: Wrocław, Poland
Contact:

Re: Remembering conditional branches even after the game ends?

#2 Post by mikolajspy » 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
ImageImageImage

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

Re: Remembering conditional branches even after the game ends?

#3 Post by Rinzamakani » Wed Jul 18, 2018 10:28 am

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
I've created an amino dedicated to learning Ren'py and finding resources. We need more members. Feel free to check it out!
http://aminoapps.com/invite/GLQD3S588Z

mikolajspy
Regular
Posts: 169
Joined: Sun Jun 04, 2017 12:05 pm
Completed: Jake's Love Story, NEKOKORO
Projects: Courage for a Kiss
Deviantart: mikolajspy
Location: Wrocław, Poland
Contact:

Re: Remembering conditional branches even after the game ends?

#4 Post by mikolajspy » 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
ImageImageImage

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

Re: Remembering conditional branches even after the game ends?

#5 Post by Rinzamakani » Thu Jul 19, 2018 1:23 pm

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.
I've created an amino dedicated to learning Ren'py and finding resources. We need more members. Feel free to check it out!
http://aminoapps.com/invite/GLQD3S588Z

Post Reply

Who is online

Users browsing this forum: Draite, Google [Bot], Imperf3kt