How to make a route available after certain number of routes cleared

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
Showakun
Newbie
Posts: 19
Joined: Tue Sep 04, 2018 1:04 pm
Contact:

How to make a route available after certain number of routes cleared

#1 Post by Showakun » Tue Mar 30, 2021 4:50 am

Some people ask about how to make a route available after clearing some point in the story and it's very easy but my question is about something more difficult - how to make a route available after a certain NUMBER of routes cleared, regardless of WHAT those routes are?

Let's say we have six routes and I want one available after clearing ANY three. Now that I mention it, I am a newbie and I understand that this requires understanding and implementing the concept of what "clearing" is in first place, in other words, some manipulations with persistent data which I am not sure are my level now.

But I'd still like to know! Please give the most detailed answer possible because I think it's time for me to learn this stuff.

Thank you in advance!

Showakun
Newbie
Posts: 19
Joined: Tue Sep 04, 2018 1:04 pm
Contact:

Re: How to make a route available after certain number of routes cleared

#2 Post by Showakun » Tue Mar 30, 2021 5:36 am

Sorry for overly bumping this, but I just remembered something: "clearing" is, of course, means that changes that were made during your first playthrough are preserved in your second, and changes that are made in first and second are preserved in third, etc. It will be a pain in the ass to test, haha. But still, tell me how to do it!

User avatar
Ocelot
Eileen-Class Veteran
Posts: 1883
Joined: Tue Aug 23, 2016 10:35 am
Github: MiiNiPaa
Discord: MiiNiPaa#4384
Contact:

Re: How to make a route available after certain number of routes cleared

#3 Post by Ocelot » Tue Mar 30, 2021 6:40 am

Well, one way to do it:

Code: Select all

init python:
    if persistent.endings is None:
        persistent.endings = set()
label start:

    menu:
        "where do you want to go?"

        "movies":
            jump movies
        "cafe":
            jump cafe
        "park":
            jump park
        "those are boring, lets just spend time together" if (len(persistent.endings) >= 2):
            jump secret
    return

label movies:
    "You went to the movies"
    if ("movies" in persistent.endings):
        "Even thought you were there before"
    $ persistent.endings.add("movies")
    return

label cafe:
    if ("cafe" in persistent.endings):
        "Even thought you were there before"
    "You went to the cafe"
    $ persistent.endings.add("cafe")
    return

label park:
    if ("park" in persistent.endings):
        "Even thought you were there before"
    "You went to the park"
    $ persistent.endings.add("park")
    return

label secret:
    "You decided to spend time in company of each other"
    $ persistent.endings.add("secret")
    return
Game will remember if you already cleared one route, and, if you cleared at least 2, unlocks fourth route.
< < insert Rick Cook quote here > >

Showakun
Newbie
Posts: 19
Joined: Tue Sep 04, 2018 1:04 pm
Contact:

Re: How to make a route available after certain number of routes cleared

#4 Post by Showakun » Tue Mar 30, 2021 7:46 am

Thank you! That's exactly what I needed!

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot], _ticlock_