Changing Main Menu Music

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
User avatar
SpagootBoi
Regular
Posts: 25
Joined: Sun Mar 22, 2020 12:02 am
Completed: Infatuation (Visual Novel Adaptation), Kimbark Street
Projects: Canyonlands: American Folklore, True Two Heart (Restoration Project)
Tumblr: plant324
itch: plantmama
Contact:

Changing Main Menu Music

#1 Post by SpagootBoi »

Hello! I wanted to know if it was possible to change the main menu music through the use of persistent variables? Thanks to any help I get!
Image


User avatar
hell_oh_world
Miko-Class Veteran
Posts: 777
Joined: Fri Jul 12, 2019 5:21 am
Contact:

Re: Changing Main Menu Music

#2 Post by hell_oh_world »

You can, just configure the config.main_menu_music during init time.

Code: Select all

init python:
  if persistent.unlocked_item_1:
    config.main_menu_music = "alternative_music_1.mp3"
  elif persistent.unlocked_item_2:
    config.main_menu_music = "alternative_music_2.mp3"
or

Code: Select all

init python:
  if not persistent.main_menu_music:
     persistent.main_menu_music = "default_music.mp3"
     
  config.main_menu_music = persistent.main_menu_music

User avatar
Imperf3kt
Lemma-Class Veteran
Posts: 3794
Joined: Mon Dec 14, 2015 5:05 am
itch: Imperf3kt
Location: Your monitor
Contact:

Re: Changing Main Menu Music

#3 Post by Imperf3kt »

A simpler way would be to play the music when the main menu screen shows and adjust it there - no need to mess with init
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

Post Reply

Who is online

Users browsing this forum: No registered users