Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Getting music to carry on from field through to battle...

Ayvuir

Member

...without restarting.

I remembered a script i used to use for my XP game, by Sandgolem, in where one simple switch being turned on or off allowed you to let the BGM carry on in to a Battle Process.

I tried using the samne script for VX but it just comes up with errors.

Is there an updated version of the script at all?? Or any other simple way to do what i'm asking??

Many thanks in advance.
 
You can try this although it was coded on XP it might work in VX, I'm unfamiliar with VX's differences in coding. It takes in certain conditions, like...

If there is no BGM assigned to battle, it'll play map BGM
If the same BGM is playing for battle and map, it won't stop then restart it just continues playing
If the switch assigned is on, it'll carry over map BGM to battle reguardless

Code:
#===============================================================================

# ** Battle : Carry Over Map BGM 2 Battle

#===============================================================================

 

CarryOverMapBGM2Battle = 1 # Switch ID which always carries map BGM to battle

 

#-------------------------------------------------------------------------------

# * SDK Log

#-------------------------------------------------------------------------------

#SDK.log('Battle.CarryOverMapBGM2Battle?', 'Kain Nobel ©', 2.5, '12.10.2008')

#-------------------------------------------------------------------------------

# * SDK Enabled Test : BEGIN

#-------------------------------------------------------------------------------

#if SDK.enabled?('Battle.CarryOverMapBGM2Battle?')

 

#===============================================================================

# ** Game_Temp

#===============================================================================

 

class Game_Temp

  #-----------------------------------------------------------------------------

  # * Public Instance Variables

  #-----------------------------------------------------------------------------

  attr_accessor :battle_bgm_test

  #-----------------------------------------------------------------------------

  # * Alias Listings

  #-----------------------------------------------------------------------------

  alias_method :btlcrryovermapbgm_gmtemp_initialize, :initialize

  #-----------------------------------------------------------------------------

  # * Object Initialization

  #-----------------------------------------------------------------------------

  def initialize

    btlcrryovermapbgm_gmtemp_initialize

    @battle_bgm_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

  #-----------------------------------------------------------------------------

  # * 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

  #-----------------------------------------------------------------------------

  # * Carry Over BGM

  #-----------------------------------------------------------------------------

  def carry_map_bgm_2_battle?

    return false if $game_temp.nil?

    return false unless $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 < SDK::Scene_Base

  #-----------------------------------------------------------------------------

  # * Alias Listings

  #-----------------------------------------------------------------------------

  alias_method :btlcrryovermapbgm_scnmap_callbattle, :call_battle

  #-----------------------------------------------------------------------------

  # * Call Battle

  #-----------------------------------------------------------------------------

  def call_battle

    $game_temp.battle_bgm_test = true

    btlcrryovermapbgm_scnmap_callbattle

    $game_temp.battle_bgm_test = false

  end

end

 

#-------------------------------------------------------------------------------

# * SDK Enabled Test : END

#-------------------------------------------------------------------------------

#end

PM me if you have any problems with it.
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top