How to make the titlescreen image change upon route completion?

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
coffeecheesecake
Newbie
Posts: 1
Joined: Sun Feb 25, 2024 11:16 pm
Contact:

How to make the titlescreen image change upon route completion?

#1 Post by coffeecheesecake »

I have a "true ending" defined in my script as persistent.final, and two main menu images in my images folder, main_menu.png and main_menu_true.png.

I want to make it so that if persistent.final is true, the main menu image will change from main_menu to main_menu_true.png.

Here's what I currently have in my script, at the end of the "true ending":

$persistent.final = True
$persistent.main = "gui/main_menu_true.png"


And here's what I currently have in gui.rpy:

## Main and Game Menus #########################################################

## The images used for the main and game menus.
default persistent.main = "gui/main_menu_true.png"
image mainMenu = "[persistent.main]"
define gui.main_menu_background = "main_menu"
define gui.game_menu_background = "gui/game_menu.png"


However, the only image that manifests, regardless of how many endings are unlocked, is main_menu.png. Where am I going wrong?

Thanks!

jeffster
Veteran
Posts: 440
Joined: Wed Feb 03, 2021 9:55 pm
Contact:

Re: How to make the titlescreen image change upon route completion?

#2 Post by jeffster »

The actual place where Main Menu image is set see in "screens.rpy".
"gui.rpy" only sets default values.

In "screens.rpy", the standard script is

Code: Select all

screen main_menu():

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

    add gui.main_menu_background
Make it something like

Code: Select all

    add persistent.main_menu_bg
and in the script

Code: Select all

default persistent.main_menu_bg = gui.main_menu_background

#...
label true_ending_finish:
    $ persistent.main_menu_bg = "gui/main_menu_true.png"
PS. Also note that "define" set something constant. For values that could be changed use "default".
And check the variable names in your code: "mainMenu" is not "main_menu".
If the problem is solved, please edit the original post and add [SOLVED] to the title. 8)

Post Reply

Who is online

Users browsing this forum: No registered users