Change menu after finish the game

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
maurolcj
Newbie
Posts: 18
Joined: Sat Nov 05, 2016 12:29 am
Contact:

Change menu after finish the game

#1 Post by maurolcj »

Hi, I wanted to know how to do after finishing a novel, change the menu and appear another button that takes you to another story, such as clannad or sepia tears making the myra's diary


http://images.akamai.steamusercontent.c ... 7F13C6C6A/

User avatar
ileikturtles
Regular
Posts: 32
Joined: Sun Nov 23, 2014 7:54 pm
Projects: Adventures of Scottie
Organization: StudioFondue
Tumblr: ileikturtles
Contact:

Re: Change menu after finish the game

#2 Post by ileikturtles »

I would set a variable which controls whether the button is ready to show;

Code: Select all

init:
    $ gameCompleted = False #CAN BE ANYTHING
is just an example. Then in the main menu code I would include:

Code: Select all

    frame:
        style_group "mm"
        xalign .98
        yalign .98

        has vbox

        textbutton _("Start Game") action Start()
        textbutton _("Load Game") action ShowMenu("load")
        textbutton _("Preferences") action ShowMenu("preferences")
        textbutton _("Help") action Help()
        textbutton _("Quit") action Quit(confirm=False)
        
        if gameCompleted == True:
            textbutton _("Myra's Diary") action Jump("Myra Diary") #NAME OF JUMP
NOTE: you need to place the gameCompleted in an init (to happen before the game starts, or will return an error that the variable doesn't yet exist)

The above code adds a button to the existing Main Menu vbox. Change accordingly if it's an imagebutton, or placed outside the vbox.
Last edited by ileikturtles on Fri Mar 24, 2017 1:57 pm, edited 1 time in total.

User avatar
Milkymalk
Miko-Class Veteran
Posts: 753
Joined: Wed Nov 23, 2011 5:30 pm
Completed: Don't Look (AGS game)
Projects: KANPEKI! ★Perfect Play★
Organization: Crappy White Wings
Location: Germany
Contact:

Re: Change menu after finish the game

#3 Post by Milkymalk »

If you want the new button to persist after closing the game, you need persistent data:
https://www.renpy.org/doc/html/persistent.html

It's easy, just call the variable persistent.gameCompleted instead of only gameCompleted. The exact name is irrelevant, of course.
Crappy White Wings (currently quite inactive)
Working on: KANPEKI!
(On Hold: New Eden, Imperial Sea, Pure Light)

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

Re: Change menu after finish the game

#4 Post by Ocelot »

Note: init variables are reset on entering new context. Like main menu. You want persistent variables.

Code: Select all

label start:
    'Game started'
    'Game finished'
    $ persistent.finished = True # This will set persistent variable 'finished', which will retain it value between launches, new and loaded games
    return

# in main menu screen
    # . . . 
    if persistent.finished:  # persistent variables return None if not exist, no need to actually set them beforehand there
        textbutton 'postgame content' . . .
    # . . . 
< < insert Rick Cook quote here > >

maurolcj
Newbie
Posts: 18
Joined: Sat Nov 05, 2016 12:29 am
Contact:

Re: Change menu after finish the game

#5 Post by maurolcj »

Thank you all, I'll try

Post Reply

Who is online

Users browsing this forum: No registered users