How to leave battle music unchanged?

● ARCHIVED · READ-ONLY
Started by fgeorge 6 posts View original ↗
  1. I would like the music upon starting a battle to be the same as the BGM on the map, without any interruption in the song . How can I do this?
  2. You will need a script, this snippet will work:

    module BattleManager #Turns the module into a class so it can be aliased #Need to get rid of the self. on defs, else it will fail class << self alias old_play_battle_bgm play_battle_bgm def play_battle_bgm if($game_switches[21] == true) old_play_battle_bgm end end end endIf you use this, just never turn on switch 21 unless you want the battle music to run. You may want to modify that line 21 to read 101 if you add more scripts though, as I know Yanfly's scripts use a lot of the switches in the 20's and 40's to determine script behavior.

    Edit: This code snippet is courtesy of DoubleandPlantium3's videos on how to code in Ruby, so you should probably credit them if you use it.
  3. Thanks.

    I'm just starting out and am not yet familiar with scripts.

    Another question, along the same lines:

    How do I specify the battle music for each specific troop encounter? Right now I am using the play BGM event command from within the battle for each troop, and have the system battle music set to nothing. However, this creates a pause in the music at the start of the battle, where it says {enemy} appears. I want the specific song for the battle to start immediately at the start of the encounter. How can I do this?
  4. That'll take another script, but the one I have conflicts with the script I posted. I might be able to combine them together, but have one script request ahead of you. Give me a 3 - 5 days and see what I can do on that.

    Edit: If you have visual battlers, you can do the second part without a script. All you do is change the battle BGM, and turn on switch 21 (if you didn't change my code), then spawn the battle. Just turn off switch 21 after the battle if you want it to go back to the map music.
  5. Thanks!

    I'm having a lot of fun making my first game!
  6. Got it done (had a break today, so merged them during the break). I have it set now to switch 101 to avoid conflicting with other scripts out there, but you can change the switch in the editable region. Script is here on pastebin: http://pastebin.com/08EN3JnJ

    Make sure to copy and paste the raw data into your scripts in the materials section, but above main. Terms of use are same as DiamondandPlatium3, as all I did was merge his tutorial code into one script (his terms I posted a web link to in the script).

    Edit: I did discover it will fail to load the music if you have any spaces in the name. To fix that, replace all spaces with _