Changing the Title Screen's Music Based on Game Progression

Marche100

Villager
Member
Joined
Aug 11, 2013
Messages
13
Reaction score
4
First Language
English
Primarily Uses
Hi, everyone. 

I'd like to request a script that allows you to dynamically change the music that plays on the title screen. I'm going to use another script that I'm currently using to explain my idea:

This is Rachael's Dynamic Title Script. It allows you to change the title screen's background based on the value of a variable. To find the value of that variable it can either check your most recent save or it can check every one of your saves and take the one that has the highest value for the variable.

I would like a similar script that performs the same basic function, but with the title screen's music. I only need to change it once for the game that I'm currently working on (I want to change it when the player unlocks the epilogue, as the title screen's background changes drastically when that happens), but it may be useful to be able to change it as many times as you can, similar to how Rachael's script allows you to change the title screen's background an unlimited number of times (which was good for me in that case, because I need to change the background a bunch of times. Not the music). But I'm not really that picky. I'd simply be more than happy if anyone would take me up on my request. 

And if I had to choose between a script that checks your most recent save or all of your saves, I would use the one that only checks your most recent save. Just in case anyone wants to make the script but doesn't want to accommodate both.

Edit: As an addendum, this script should be compatible with the script I referenced above.

Thanks for any help. Cheers,

Marche100
 
Last edited by a moderator:

Solo

Veteran
Veteran
Joined
Jul 26, 2013
Messages
1,104
Reaction score
154
First Language
English
Primarily Uses
RMVXA
I just want to add that, of course, this script should be compatible with Rachael's title image script, so both can be used at the same time.


This seems like a given, but someone could easily overlook it.
 
Last edited by a moderator:

TygerBurnz

Crouching Monkey, Hidden Trickster
Veteran
Joined
May 4, 2013
Messages
88
Reaction score
12
First Language
English
Primarily Uses
Can't you use an event to swap it out?
 

Marche100

Villager
Member
Joined
Aug 11, 2013
Messages
13
Reaction score
4
First Language
English
Primarily Uses
I just want to add that, of course, this script should be compatible with Rachael's title image script, so both can be used at the same time.

This seems like a given, but someone could easily overlook it.
Yeah, I figured that was a given. But I'll add it to my original post.

Can't you use an event to swap it out?
If you can, I'd sure like to know how!
 

Yato

(aka Racheal)
Veteran
Joined
Mar 17, 2012
Messages
825
Reaction score
346
Primarily Uses
I pretty much just duplicated my previous script and changed it to work with music instead. Pretty lazy on my part, but appears to work as intended. I assumed you weren't changing the music as often as the image, so I tied it to a different variable.

Spoiler




Code:
#==============================================================================
# Dynamic Title Screen Music
# by: Racheal
# Version 1.0
# Created: 22/11/2014
#==============================================================================
# Changes the title screen music based on a variable set in-game.
#==============================================================================
# Instructions:
# * Insert in the Materials section
# * Configure to your liking below
#==============================================================================
# Compatibility:
# This script is for RPG Maker VX Ace
# * Overwrites: Scene_Title: play_title_music
#==============================================================================

#==============================================================================
# Customization
#==============================================================================
module Racheal_Title_Music
  #Set which variable controls the change in the title screen
  TITLE_MUSIC_VARIABLE = 6
  
  #Set whether to check the highest variable in all the save files or
  #just use the most recent save
  CHECK_ALL_SAVES = false
  
  #Set music file info here
  MUSIC_SETTINGS = [#[name, volume, pitch],
                     ["Theme1", 100, 100],
                     ["Theme2", 100, 100]
                   ]
end
#==============================================================================
# End Customization
#==============================================================================

#==============================================================================
# ** DataManager
#==============================================================================

module DataManager
  #--------------------------------------------------------------------------
  # * Create Save Header
  #--------------------------------------------------------------------------
  class << self; alias dynamic_title_music_make_save_header make_save_header; end
  def self.make_save_header
      header = dynamic_title_music_make_save_header
      header[:music] = $game_variables[Racheal_Title_Music::TITLE_MUSIC_VARIABLE]
      header
  end 
end

#==============================================================================
# ** Scene_Title
#==============================================================================

class Scene_Title < Scene_Base
  #--------------------------------------------------------------------------
  # * Play Title Screen Music
  #--------------------------------------------------------------------------
  def play_title_music
    music = get_music
    Audio.bgm_play('Audio/BGM/' + music[0], music[1], music[2])
    RPG::BGS.stop
    RPG::ME.stop
  end
  #--------------------------------------------------------------------------
  # * Get Music Title
  #--------------------------------------------------------------------------
  def get_music
    music = 0
    if Racheal_Title_Music::CHECK_ALL_SAVES
      #Check all saves
      for i in 0...DataManager.savefile_max
        header = DataManager.load_header(i)
        next unless header and header[:music]
        music = [music, header[:music]].max
      end
    else
      #Check latest save
      header = DataManager.load_header(DataManager.latest_savefile_index)
      if header and header[:music]
        music = [music, header[:music]].max
      end
    end
    #---
    return Racheal_Title_Music::MUSIC_SETTINGS[music]
  end
end
 
Last edited by a moderator:

Solo

Veteran
Veteran
Joined
Jul 26, 2013
Messages
1,104
Reaction score
154
First Language
English
Primarily Uses
RMVXA
Wow, it doesn't get much better than getting the script from the one who inspired your request, does it? :)
 

Marche100

Villager
Member
Joined
Aug 11, 2013
Messages
13
Reaction score
4
First Language
English
Primarily Uses
I pretty much just duplicated my previous script and changed it to work with music instead. Pretty lazy on my part, but appears to work as intended. I assumed you weren't changing the music as often as the image, so I tied it to a different variable.

#==============================================================================# Dynamic Title Screen Music# by: Racheal# Version 1.0# Created: 22/11/2014#==============================================================================# Changes the title screen music based on a variable set in-game.#==============================================================================# Instructions:# * Insert in the Materials section# * Configure to your liking below#==============================================================================# Compatibility:# This script is for RPG Maker VX Ace# * Overwrites: Scene_Title: play_title_music#==============================================================================#==============================================================================# Customization#==============================================================================module Racheal_Title_Music #Set which variable controls the change in the title screen TITLE_MUSIC_VARIABLE = 6 #Set whether to check the highest variable in all the save files or #just use the most recent save CHECK_ALL_SAVES = false #Set music file info here MUSIC_SETTINGS = [#[name, volume, pitch], ["Theme1", 100, 100], ["Theme2", 100, 100] ]end#==============================================================================# End Customization#==============================================================================#==============================================================================# ** DataManager#==============================================================================module DataManager #-------------------------------------------------------------------------- # * Create Save Header #-------------------------------------------------------------------------- class << self; alias dynamic_title_music_make_save_header make_save_header; end def self.make_save_header header = dynamic_title_music_make_save_header header[:music] = $game_variables[Racheal_Title_Music::TITLE_MUSIC_VARIABLE] header end end#==============================================================================# ** Scene_Title#==============================================================================class Scene_Title < Scene_Base #-------------------------------------------------------------------------- # * Play Title Screen Music #-------------------------------------------------------------------------- def play_title_music music = get_music Audio.bgm_play('Audio/BGM/' + music[0], music[1], music[2]) RPG::BGS.stop RPG::ME.stop end #-------------------------------------------------------------------------- # * Get Music Title #-------------------------------------------------------------------------- def get_music music = 0 if Racheal_Title_Music::CHECK_ALL_SAVES #Check all saves for i in 0...DataManager.savefile_max header = DataManager.load_header(i) next unless header and header[:music] music = [music, header[:music]].max end else #Check latest save header = DataManager.load_header(DataManager.latest_savefile_index) if header and header[:music] music = [music, header[:music]].max end end #--- return Racheal_Title_Music::MUSIC_SETTINGS[music] endend
Wow, thank you very much!
 

Vpix

Villager
Member
Joined
Nov 10, 2016
Messages
13
Reaction score
2
First Language
English
Primarily Uses
RMMV
Im glad i google this first and i hope its ok if i use this, end credits will include the you in script authors (as should be expected (personal opinion))
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??

Forum statistics

Threads
105,859
Messages
1,017,030
Members
137,566
Latest member
Fl0shVS
Top