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.
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
"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:
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...
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.
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