Battle Music Editing

P3P

P4G

P5R

Table of contents
  1. Introduction
  2. BGME documentation
  3. Examples of BGME’s features
    1. Randomized Battle Music (Normal Battles)
    2. Changing Music for Specific Encounters
    3. Setting Normal, Advantage, and Disadvantage Battle Music
  4. Editing ENCOUNT.TBL

Introduction

Changing battle music beyond what is provided in the stock games is possible for the PC releases of P3P, P4G, and P5R using the BGME Framework. To allow for advanced BGM changing, this mod must be downloaded and set as a dependency for your mod.

BGME provides a convenient scripting language that can be used to add new battle music or change how existing battle music is called, etc. To use this, create a new folder in your mod directory called BGME. In this folder, create a new text file called (script name).pme, where (script name) can be replaced with a name of your choice. This can be done in the same file used for custom event music if desired.

When the game is booted, a (script name).project file is generated. This can be loaded into Phos Music Manager. More information can be found here.

BGME documentation

The BGME Framework has its own, detailed documentation that can be found here. It is highly recommended to use this documentation to learn how to use BGME’s features. This page will include a few examples of what BGME is capable of.

Examples of BGME’s features

Randomized Battle Music (Normal Battles)

Random battle music can be set using random_song(minID, maxID), which will play randomized music in a range between (and including) minID and maxID.

encounter["Normal Battles"]:
  music = random_song(minID, maxID)
end

Changing Music for Specific Encounters

Unique music for specific encounters can be set by setting the desired music ID to play for that battle.

encounter[encounterID]
  music = songID
end

A list of premade BGME IDs referred to as collections can be found here. Encounter IDs can be found on the Amicitia wiki for Persona 3 Portable, Persona 4 Golden, and Persona 5 Royal.

Setting Normal, Advantage, and Disadvantage Battle Music

BGME can set unique music for normal battles, player advantage battles, and enemy advantage battles. This functionality is already seen in stock Persona 4 Golden (Reach Out To The Truth for player advantage, Time To Make History for normal/enemy advantage) and Persona 5 Royal (Take Over for player advantage, Last Surprise for normal/enemy advantage), but BGME expands on it.

encounter["Normal Battles"]:
	music = battle_bgm(normalID, advantageID, disadvantageID)
end

normalID plays the chosen song ID for a normal battle, advantageID plays the chosen song ID for a player advantage battle, and disadvantageID plays the chosen song ID for an enemy advantage battle.

Alternatively, these calls can be used individually:

encounter["Normal Battles"]:
	victory_music = songID_1
	normal_bgm = songID_2
	victory_normal_bgm = songID_3
	advantage_bgm = songID_4
	victory_advantage_bgm = songID_5
	disadvantage_bgm = songID_6
	victory_disadvantage_bgm = songID_7
end

Editing ENCOUNT.TBL

For most cases, BGME should be used instead. Ignore this unless you know what you’re doing!

If you want to manually edit battle music calls without using BGME, you can edit ENCOUNT.TBL. for Persona 3 FES, Persona 4, Persona 3 Portable, and Persona 4 Golden is stored in init_free.bin/battle/ENCOUNT.TBL. Editing this file requires the use of 010 Editor and several templates designed for file types supported by the Persona games. Extract these templates to a separate folder.

Extract ENCOUNT.TBL using Amicitia or Persona Editor, then open it in 010 Editor. By running a template on it, we can use a more readable format. Open a template by clicking the Run Template button, then the Open Template button, or press Ctrl + F5.

Open your 010 templates folder and select the correct template. For example, P4G’s TBL template is located in /templates/p4g_tbl.bt. This will run the template on the file you have open and present it in a more readable format as shown below.

Expanding the drop downs shows the following data:

  • Enemy Encounters[x]: x represents the encounter ID. A list of encounter IDs can be found on Amicitia wiki.
  • Music: the selected battle music.
  • u16 Field04: Set to 1 to enable BGME, so that different music plays in a given encounter.

The default selection of battle BGM is shown below.