Adding a special message after completing the game
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.
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.
-
- Newbie
- Posts: 1
- Joined: Fri Aug 11, 2017 7:59 am
- Tumblr: mimikobophar
- Contact:
Adding a special message after completing the game
Hi there! I want to show a special message after one gets all good endings. But only once and after you end the game and then automatically return to the main menu (not after you restart the game or start a new game). Just like in Cinderella Phenomenon. How can I do this? I know how to deal with persistent and else, but struggling to set it for only one time and at the right place.
- Imperf3kt
- Lemma-Class Veteran
- Posts: 3794
- Joined: Mon Dec 14, 2015 5:05 am
- itch: Imperf3kt
- Location: Your monitor
- Contact:
Re: Adding a special message after completing the game
Well, the simplest way would be to add something before your return() at the end of each route, then check that against itself as well as making sure its not been seen already and if true, show the message and then set the message to seen.
Something like this should do:
Something like this should do:
Code: Select all
init -1:
# Putting this in an init probably isn't necessary, but I like to do it anyway
default persistent.end_1 = False
# This tells Ren'Py that the first ending hasn't been seen yet
default persistent.end_2 = False
# This tells Ren'Py that the second ending hasn't been seen yet
default persistent.end_msg_seen = False
# This tells Ren'Py that the secret message hasn't been seen yet
label start:
"A story"
menu:
"Oh look, an ending.":
jump end_1
"Oh look, a different ending.":
jump end_2
label end_1:
"My story is really short."
$ persistent.end_1 = True
# This tells Ren'Py the first ending has been seen
jump end
label end_2:
"Did I mention my story is short?"
$ persistent.end_2 = True
# This tells Ren'Py the second ending has been seen
jump end
label end:
"The end"
if not persistent.end_msg_seen:
# This checks if the secret message has been seen yet, and if not, show the following
if persistent.end_1 and persistent.end_2:
# This checks if both endings have been seen yet, and if they have, show the following
"Oh look, a secret message"
$ persistent.end_msg_seen = True
# This tells Ren'Py the secret message has been seen
else:
# This is what happens if both endings haven't been seen
pass
# This tells Ren'Py to go to the next statement (return) which allows the player to return to the main menu after finishing one but not all endings
else:
# This is what happens if the end message has been seen
pass
# As above, this tells Ren'Py to go to the next statement without doing anything. This only gets checked if the secret message is seen. You wanted it to show only once, so this tells Ren'Py that it should not show the secret message.
return
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.
Current project: GGD Mentor
Twitter
pro·gram·mer (noun) An organism capable of converting caffeine into code.
Current project: GGD Mentor
Who is online
Users browsing this forum: Ahrefs [Bot], voluorem