Map Music - pk-hack/CoilSnake GitHub Wiki

[!IMPORTANT] If you came here looking for instructions on how to edit the music itself, check out Music Directory and EBMusEd. This page details how to control what music plays in each area of the game.

The music that plays on the overworld is a property of each sector. However, in the map editor, the value you input in the relevant field isn't directly a song ID. Instead, it's a reference to a little chain of flag logic that determines what song should play. This lets the song change depending on in-game events. It's like a kind of playlist.

If you're using EBME, read on. If you're not, scroll down to find the old way.

When you've selected a/some sector(s), you'll notice that the Music field has an "edit" button next to it. This'll take you to an editor for the music-changing logic. This editor is a graphical representation of map_music.yml.

image

Each entry here contains a list of tracks and the conditions under which they'll play. Starting from the first track, if the condition is true, the specified song will be played. Otherwise, it'll check the next condition, and so on. The final track should check for flag 0, which will make it always play if no other conditions are true.

The condition is an event flag in the game. If it is marked as inverted, it will check for the flag being clear. If it is not marked as inverted, it will check for the flag being set.

If multiple conditions are true, then the first one that is found to be true will be used. For this reason, you can select a track and use the buttons to move it up or down. You can also add and remove tracks.

Finally, you'll notice that the songs have names included. If you've got your own names for songs, you can import metadata that EBMusEd saves about song names to change them here.

Old way

[!IMPORTANT] This information is for if you're not using EBME.

Each block in map_music.yml represents a set of background music tracks which can be played back by EarthBound at certain locations. The IDs for these entries are used in map_sectors.yml (which you should not edit manually, but instead use the EB Project Editor to edit). Let's look at map music entry 35:

35:
- Event Flag: 0x8216
  Music: 87
- Event Flag: 0x8049
  Music: 93
- Event Flag: 0x8217
  Music: 77
- Event Flag: 0x8047
  Music: 129
- Event Flag: 0x0
  Music: 45

This is a list of possible background tracks. The one which is actually played will depend on the Event Flags which are currently set in the game. EarthBound checks them in order: if it is set, play the specified Music (as listed in the Music Editor); otherwise, go to the next one. The last option should always have Event Flag: 0x0, so that it is always true if all others are false.

Note: 0x8___ flags are the reverse of 0x___ flags; if one is set, the other is unset.