Overwrite Game BGM with Global BGM

This guide is mostly intended for more advanced code music mods, although the first section covers a basic example of randomizing a song.

Requirements

The Basics

global_bgm["Period"]:
  music = random_song(1, 10)
end

Should be easy to understand by this point:

  • The block is a global_bgm block.
  • The song we're changing is Period.
  • Now whenever the game tries to play Period, it'll instead play a Random Song between BGM IDs 1 to 10.

That's it for the basic use. Not too useful outside of randomizing songs.

The Advanced Stuff

But when you combine it with a code mod that takes advantage of BGME Framework's live updating...

While largely untested, in theory it's fairly simple. Hook a game function then update your mod's music script depending on the incoming data. Combine with global_bgm to replace the game's music based on whatever you want.

General Ideas
  • Use custom battle themes depending on costumes, weapons, items, etc.
  • Add new overworld music by checking the date and overwriting the overworld songs.
  • Change other mod's music.