[SOLVED] altering main menu when certain route/end has been reached in 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
+ ali3nn +
Regular
Posts: 32
Joined: Wed Aug 14, 2019 3:08 pm
Contact:

[SOLVED] altering main menu when certain route/end has been reached in game

#1 Post by + ali3nn + » Tue Aug 20, 2019 4:24 am

straight to the point, if i were to make a vn with several different endings [ ex: 5 ] how would i be able to alter the main menu after any ending/a route has been reached?
i tried looking but most of the information was outdated/from 2 years ago.
anything helps, thank you!
Last edited by + ali3nn + on Sat Aug 24, 2019 8:40 pm, edited 1 time in total.

User avatar
Angelo Seraphim
Newbie
Posts: 17
Joined: Tue May 21, 2019 8:00 am
Projects: Current: DCXVI: Charagma. Planned: Fall of Order, Teens After School, Jasmine and the Rascal Six
Organization: GLSUoA
Deviantart: glsuoa
itch: glsuoa
Location: London, UK
Contact:

Re: altering main menu when certain route/end has been reached in game

#2 Post by Angelo Seraphim » Tue Aug 20, 2019 7:34 am

Under the screen 'main_menu()' in screens.rpy you can do this:

Code: Select all

# default story_ending = " "
default persistent.story_ending = " " # If you want the bg to remain as is through every startup, use the 'persistent' variable.

screen main_menu():

    ## This ensures that any other menu screen is replaced.
    tag menu

    style_prefix "main_menu"
        if persistent.story_ending == "Good A": # Using the 'persistent' variable will make it consistent upon every startup so it won't default to your default menu bg.
            add "bg_image_1.jpg"
        elif persistent.story_ending == "Good B":
            add "bg_image_2.jpg"
        elif persistent.story_ending == "Good C":
            add "bg_image_3.jpg"
        else:
            add gui.main_menu_background
        # etc

    frame:
        pass

    ## The use statement includes another screen inside this one. The actual
    ## contents of the main menu are in the navigation screen.
    use navigation
And then near the end of the script or chapter:

Code: Select all

label ending: # Just for testing
    menu:
        "Testing endings"
        "Good ending A":
            $ persistent.story_ending = "Good A"
        "Good ending B":
            $ persistent.story_ending = "Good B"
        "Good ending C":
            $ persistent.story_ending = "Good C"

    return
Hope this will point you in the right direction. :)
Working my VN : "DCXVI: Charagma"
Website: http://grandlivingsoul.com


+ ali3nn +
Regular
Posts: 32
Joined: Wed Aug 14, 2019 3:08 pm
Contact:

Re: altering main menu when certain route/end has been reached in game

#4 Post by + ali3nn + » Tue Aug 20, 2019 4:41 pm

is there anyway to add main menu buttons/change the main menu music after certain endings?
sorry if i'm asking for too much.

User avatar
hell_oh_world
Regular
Posts: 175
Joined: Fri Jul 12, 2019 5:21 am
Projects: Pathfinding
Organization: NILA
Contact:

Re: altering main menu when certain route/end has been reached in game

#5 Post by hell_oh_world » Sat Aug 24, 2019 4:41 pm

+ ali3nn + wrote:
Tue Aug 20, 2019 4:41 pm
is there anyway to add main menu buttons/change the main menu music after certain endings?
sorry if i'm asking for too much.

Yes. Its also possible, just like the code of Angelo Seraphim. You can change the music by using the configuration variables.

Code: Select all

  # default story_ending = " "
default persistent.story_ending = " " # If you want the bg to remain as is through every startup, use the 'persistent' variable.

screen main_menu():

    ## This ensures that any other menu screen is replaced.
    tag menu

    style_prefix "main_menu"
        if persistent.story_ending == "Good A": # Using the 'persistent' variable will make it consistent upon every startup so it won't default to your default menu bg.
            add "bg_image_1.jpg"
            $ config.main_menu_music = "music1.mp3"
        elif persistent.story_ending == "Good B":
            add "bg_image_2.jpg"
            $ config.main_menu_music = "music2.mp3"
        elif persistent.story_ending == "Good C":
            add "bg_image_3.jpg"
            $ config.main_menu_music = "music3.mp3"
        else:
            add gui.main_menu_background
            $ config.main_menu_music = "music4.mp3"
        # etc

    frame:
        pass

    ## The use statement includes another screen inside this one. The actual
    ## contents of the main menu are in the navigation screen.
    use navigation   
With buttons though, you need to go to another screen the navigation() screen there you can do the same thing through conditions youll be able to show a specific button when an ending is reached.

You can learn more about configuration variables here....
https://www.renpy.org/doc/html/config.h ... menu_music

+ ali3nn +
Regular
Posts: 32
Joined: Wed Aug 14, 2019 3:08 pm
Contact:

Re: altering main menu when certain route/end has been reached in game

#6 Post by + ali3nn + » Sat Aug 24, 2019 8:40 pm

thank you again!!

Post Reply

Who is online

Users browsing this forum: Google [Bot], rayminator