Making Unlockable Extra Scenes

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
MisterHarold
Regular
Posts: 51
Joined: Tue Jul 17, 2018 10:32 am
Location: Philippines
Contact:

Making Unlockable Extra Scenes

#1 Post by MisterHarold »

Hello. I want to make a scene gallery where the player can play through unlockable scenes after completing a specific ending. My problem is, how do I lock that scene?
I already have a button on my main menu that goes to the extras screen with scene buttons.
I used the code here https://www.renpy.org/doc/html/rooms.html#replay

Code: Select all

     "And finally, I met the wizard himself."

label meaning_of_life:

     scene

    "Mage" "What is the meaning of life, you say?"

    "Mage" "I've thought about it long and hard. A long time, I've
            spent pondering that very thing."

    "Mage" "And I'll say - the answer - the meaning of life
            itself..."

    "Mage" "Is forty-three."

    $ renpy.end_replay()

    "Mage" "Something like that, anyway."
For the button, I used Start instead of Replay because I don't want to revisit a certain point that I read through the story. I want to read a hidden/secret scene which can be unlocked after getting an ending:

Code: Select all

textbutton "The meaning of life" action Start("meaning_of_life")
The player needs to complete an ending first before unlocking that scene. How do I do that? Any kind of help would be greatly appreciated.
Last edited by MisterHarold on Wed Jul 18, 2018 6:53 am, edited 1 time in total.

User avatar
Remix
Eileen-Class Veteran
Posts: 1628
Joined: Tue May 30, 2017 6:10 am
Completed: None... yet (as I'm still looking for an artist)
Projects: An un-named anime based trainer game
Contact:

Re: Making Unlockable Extra Scenes

#2 Post by Remix »

You need to use the Replay() action, not Start, then use the locked attribute

action Replay( "meaning_of_life", locked=True ) # only clickable if meaning_of_life has been played through at least once.

Alternatively, if you insist on using Start or Jump or whatever you will need to implement a locking system of your own then control the context that the labels are replayed in so as to restrict altering of any variables or call stack during the replay...
Frameworks & Scriptlets:

MisterHarold
Regular
Posts: 51
Joined: Tue Jul 17, 2018 10:32 am
Location: Philippines
Contact:

Re: Making Unlockable Extra Scenes

#3 Post by MisterHarold »

Remix wrote: Wed Jul 18, 2018 6:39 am You need to use the Replay() action, not Start, then use the locked attribute

action Replay( "meaning_of_life", locked=True ) # only clickable if meaning_of_life has been played through at least once
Hmm. Sorry if I forgot to specify on my post but, what I meant was playing an unlockable scene after getting an ending. Not replaying a point that you read through in the main story. :D

User avatar
Remix
Eileen-Class Veteran
Posts: 1628
Joined: Tue May 30, 2017 6:10 am
Completed: None... yet (as I'm still looking for an artist)
Projects: An un-named anime based trainer game
Contact:

Re: Making Unlockable Extra Scenes

#4 Post by Remix »

I'd just create a list and have it store a set of 'accessible' values then open them at end and access labels if unlocked...

Code: Select all

default accessible_extras = [ False ] * 5 # 5 endings here - expands to [False, False, False etc ]

label ending_0:
    "words"
    $ accessible_extras[0] = True

label extra_content_0:
    "extra words"

screen extra_content():
    fixed:
        for k in accessible_extras:
            textbutton "Extra Scene [k]":
                sensitive accessible_extras[k]
                action Jump( "extra_content_{}".format( k ) ) # jumps to extra_content_0 etc
Note: If the game actually hits a final return (going back to the main menu) you might want to use a persistent list so it works across different playthroughs
Frameworks & Scriptlets:

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot]