Help - Search - Members - Calendar
Full Version: Music help
RPG RPG Revolution Forums > Game Engines > RPG Maker XP Discussion
pickthree
is there a script for music that plays out of battle to continue once battle starts?
Also how do install a script?
brewmeister
Here's one from Kain Noble...

CODE
#===============================================================================
# ** Battle : Carry Over Map BGM 2 Battle
#===============================================================================

# This is the number of the switch you use to turn this function ON / OFF
# i.e. Switch 1 = ON (carry map music to battle). Switch 1 = OFF (Use separate Battle BGM)

CarryOverMapBGM2Battle = 1

#===============================================================================
# ** Game_Temp
#===============================================================================

class Game_Temp
  #-----------------------------------------------------------------------------
  # * Public Instance Variables
  #-----------------------------------------------------------------------------
  attr_accessor :battle_bgm_test
  attr_accessor :battle_me_test
  #-----------------------------------------------------------------------------
  # * Alias Listings
  #-----------------------------------------------------------------------------
  alias_method :btlcrryovermapbgm_gmtemp_initialize, :initialize
  #-----------------------------------------------------------------------------
  # * Object Initialization
  #-----------------------------------------------------------------------------
  def initialize
    btlcrryovermapbgm_gmtemp_initialize
    @battle_bgm_test = false
    @battle_me_test  = false
  end
end

#===============================================================================
# ** Game_System
#===============================================================================

class Game_System
  #-----------------------------------------------------------------------------
  # * Alias Listing
  #-----------------------------------------------------------------------------
  alias_method :btlcrryovermapbgm_gmsystem_bgmstop, :bgm_stop
  alias_method :btlcrryovermapbgm_gmsystem_bgmplay, :bgm_play
  alias_method :btlcrryovermapbgm_gmsystem_meplay,  :me_play
  #-----------------------------------------------------------------------------
  # * BGM Stop
  #-----------------------------------------------------------------------------
  def bgm_stop
    unless carry_map_bgm_2_battle?
      btlcrryovermapbgm_gmsystem_bgmstop
    end
  end
  #-----------------------------------------------------------------------------
  # * BGM Play
  #-----------------------------------------------------------------------------
  def bgm_play(bgm)
    unless carry_map_bgm_2_battle?
      btlcrryovermapbgm_gmsystem_bgmplay(bgm)
    end
  end
  #-----------------------------------------------------------------------------
  # * ME Play
  #-----------------------------------------------------------------------------
  def me_play(me)
    unless $game_temp.battle_me_test
      btlcrryovermapbgm_gmsystem_meplay(me)
    end
    $game_temp.battle_me_test = false
  end
  #-----------------------------------------------------------------------------
  # * Carry Over BGM
  #-----------------------------------------------------------------------------
  def carry_map_bgm_2_battle?
    return false if $game_temp.nil?
    return false if !$game_temp.battle_bgm_test
    return false if playing_bgm.nil?
    return false if playing_bgm.name   == ""
    return false if playing_bgm.volume == 0
    return true if battle_bgm.name     == ""
    return true if playing_bgm == battle_bgm
    return true if $game_switches[CarryOverMapBGM2Battle]
    return false
  end
end

#===============================================================================
# ** Scene_Map
#===============================================================================

class Scene_Map
  #-----------------------------------------------------------------------------
  # * Alias Listings
  #-----------------------------------------------------------------------------
  alias_method :btlcrryovermapbgm_scnmap_callbattle, :call_battle
  #-----------------------------------------------------------------------------
  # * Call Battle
  #-----------------------------------------------------------------------------
  def call_battle
    $game_temp.battle_bgm_test = true
    $game_temp.battle_me_test  = true
    btlcrryovermapbgm_scnmap_callbattle
    $game_temp.battle_bgm_test = false
  end
end


To install, Open the Script Editor
Scroll to the bottom of the Script list, and select "Main".
Right-click --> Insert
Enter a "Name" (e.g. Skip Battle BGM)
Paste the above code into the editor window

Test (Remember to turn switch 1 ON before battle)
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2013 Invision Power Services, Inc.