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.

Continue map BGM during battle

First of all, I know this has been asked 99999 times, but the answers turned up in the search function don't work at all for me.

Code:
class Scene_Map

  def call_battle

    $game_temp.battle_calling = false

    $game_temp.menu_calling = false

    $game_temp.menu_beep = false

    $game_player.make_encounter_count

    $game_temp.map_bgm = $game_system.playing_bgm

    if !$game_switches[10] # Change 10 to the switch for keeping current music

      $game_system.bgm_stop

    end

    $game_system.se_play($data_system.battle_start_se)

    if !$game_switches[10] # Change 10 to the switch for keeping current music

      $game_system.bgm_play($game_system.battle_bgm)

    end

    $game_player.straighten

    $scene = Scene_Battle.new

  end

end

That is the code that seems to work for everyone else, but does nothing for me. I turn the switch ON, yet I get no change in the battle music playing or not. Yes, I've changed the [10] to the switch I'm using, and yes the script is placed above Main. Is there something I'm missing here? I'd have put this in the scripts forum, but the original answers where on this one, so I posted it here. Feel free to move it if it's in the wrong place.
 
I did some testing and it does work in a new project. Looks like I have a script conflict somewhere. I have a lot of custom scripts running, so I'll have to narrow it down. Thanks for the help.
 
Also check the methods that call "call_battle". Use the Cntl-Shift-F key to find all occurances of "call_battle".
(and the methods that set 'battle_calling')

Compare the customized methods in your battle system to the default battle system.
 

Atoa

Member

if you put this code in the bottom of the script editor (right above main), the method would overwrite all other "def call_battle".
But you will lose the effect of other scripts that also overwrite/aliases the call_battle method.
 

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