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.

Map to battle music

I know for XP there was a script by Sandgolem and/or others that allowed an old RM2k tech to make it so that whatever map music was playing it could continue into battle with out restarting or whatever, now I'm wondering if anyone has a script like this for VX or can help point me in the right direction of doing it myself? Either would be grateful. Thanks.
 
Go into Scene_Map, and find this:
Code:
  #--------------------------------------------------------------------------
  # * Switch to Battle Screen
  #--------------------------------------------------------------------------
  def call_battle
    @spriteset.update
    Graphics.update
    $game_player.make_encounter_count
    $game_player.straighten
    $game_temp.map_bgm = RPG::BGM.last
    $game_temp.map_bgs = RPG::BGS.last
    RPG::BGM.stop
    RPG::BGS.stop
    Sound.play_battle_start
    $game_system.battle_bgm.play
    $game_temp.next_scene = nil
    $scene = Scene_Battle.new
  end

Replace it with
Code:
  #--------------------------------------------------------------------------
  # * Switch to Battle Screen
  #--------------------------------------------------------------------------
  def call_battle
    @spriteset.update
    Graphics.update
    $game_player.make_encounter_count
    $game_player.straighten
    Sound.play_battle_start
    $game_temp.next_scene = nil
    $scene = Scene_Battle.new
  end

Go into Scene_Battle. Find
Code:
  #--------------------------------------------------------------------------
  # * End Battle
  #     result : Results (0: win, 1: escape, 2:lose)
  #--------------------------------------------------------------------------
  def battle_end(result)
    if result == 2 and not $game_troop.can_lose
      call_gameover
    else
      $game_party.clear_actions
      $game_party.remove_states_battle
      $game_troop.clear
      if $game_temp.battle_proc != nil
        $game_temp.battle_proc.call(result)
        $game_temp.battle_proc = nil
      end
      unless $BTEST
        $game_temp.map_bgm.play
        $game_temp.map_bgs.play
      end
      $scene = Scene_Map.new
      @message_window.clear
      Graphics.fadeout(30)
    end
    $game_temp.in_battle = false
  end

Replace with:
Code:
  #--------------------------------------------------------------------------
  # * End Battle
  #     result : Results (0: win, 1: escape, 2:lose)
  #--------------------------------------------------------------------------
  def battle_end(result)
    if result == 2 and not $game_troop.can_lose
      call_gameover
    else
      $game_party.clear_actions
      $game_party.remove_states_battle
      $game_troop.clear
      if $game_temp.battle_proc != nil
        $game_temp.battle_proc.call(result)
        $game_temp.battle_proc = nil
      end
      unless $BTEST
      end
      $scene = Scene_Map.new
      @message_window.clear
      Graphics.fadeout(30)
    end
    $game_temp.in_battle = false
  end

That should do the trick. :)
 
Works great but, perhaps this was my mistake but, now the battle theme won't work only the maps theme. Reading over my original post, I don't believe I pointed this part out. I want to be able to use the normal battle theme but in certain times I want to have the map theme be the battle theme, for example, a big battle where your running from fight to fight, rather then having a song restart over and over, it just plays out until the whole thing is done, map and battles.

Did that seem clear enough?
 
I think what *works* in XP works in ?VX?...

Just, before the battle,put "Change Battle Background Music" to the maps background music. the loop will be gone after that.
I've used XP for this before but have not YET tried in VX, but it should work. no scripting involved. Don't forget to change the "Battle Background Music" back to the one you want, after the battles and stuff like that are done. It's like making a boss battle.
 

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