Recently I've been hacking the European version of Final Fantasy 4 Advance, and have made notes on its data structures, ASM code and AI scripting as I went along. Since there doesn't seem to be much documentation on this version that I could find, I though I'd share my notes here.
This is a link to my notes, including modules for use with the Nightmare table editing program (not very flexible, but it's dead easy to use). It includes documentation on item,spell and monster data, encounter sets, encounter setting (eg. what music to play, whether some monsters start out hidden), monster AI, chest contents and more; the bulk of my notes are in "ff4a-structs.txt", which was originally based off of notes by PKT Paladin.
I've started putting some of that knowledge to use in a
mod for this game. The purpose of the mod is simply to make the game more challenging and interesting while reducing some of the tedium. It's still incomplete as of this writing but I work on it pretty regularly.
Here is some custom ASM code for the hack I've written that might be helpful or interesting to others:
More variance for encounter RNGIf you've played FF4a before, you probably know how the encounter system is messed up: the same battles tend to occur over and over again, and saving+loading doesn't help. This is mostly due to the fact that the RNG used to determine what you encounter and when is seeded from only one thing: the amount of time you spend on the file loading screen. This tends to produce very similar seeds, leading to the same pattern of encounters recurring.
This code fixes this problem by seeding this RNG with your save file's game clock in addition to the above:
$0827E6: 2188 401A 0F49 6052 3CF0 D3FA 2188 4018
Paste write the above byte sequence to $827E6 in the FF4 Advance (E) ROM.
Allow monsters to use their Magic Defence MultiplierNormally, a monster's MDef Multiplier in the ROM is never written to their RAM battle data. To undo this, make the following change:
$93082: Write 0000
Note that all monsters have zero Magic Evasion by default, so you'd need to give them values yourself.
Back Row functions almost properlyIn the European version, melee weapons have no penalty to Attack or Precision for attacking from the back row, while the actual long-range weapons (Bows, Harps, Boomerangs and Whips) do receive a penalty. To fix:
$8A858: 07D1
$8A868: 00D0
Currently my code fixes this by making your attack Back Row-Ok if you have any long-ranged weapons equipped, which means that Edge with a katana and boomerang can attack at full power from the back row. A more nuanced fix requires more space (and therefore repointing code).
Modular elemental weaknesses from armorBy default, armor that resists Ice or Fire is hardcoded to give a weakness to the opposing element, unless your equipment protects against Fire,Ice and Lightning all at once. This code ties elemental weaknesses to a byte in armor's affinity data instead:
Equipment (including weapons!) can have elemental weaknesses that apply to the actor (byte 0x1 in affinity data):
Start of Battle $9F440: 4178 0023 0B43 A08C 1FF0 A8FC 4178 0B43 A08D 1FF0 A3FC 4178 0B43 E08D 1FF0 9EFC 4178 0B43 208E 1FF0 99FC 4178 0B43 2222 AB54 28E0
During Battle $9DA2E: 4578 B88C 21F0 ADF9 4078 0543 B88D 21F0 A8F9 4078 0543 F88D 21F0 A3F9 4078 0543 388E 21F0 9EF9 4078 0543 2221 7554 29E0 0000
Monsters' basic attacks can be imbued with elements (byte 0x6 in monster elemental data):
(ASM) $7F7000: 5088 A083 9088 2084 9079 6076 3188 7046 0430 0047
(ASM) Link from $93156: 0148 2BF0 12FE 01707F08
Simple- this lets you have Fiery Hounds attack with a Fire element. Handle with care: elemental physical attacks do triple damage when hitting a weakness!
Reworked Boss Bit vs Status systemBy default, enemies with the boss bit show immunity to all status effects in the Bestiary. Normally this is accurate since almost all spells have the boss bit (or rather, don't have the bit that lets them affect bosses), but if you change that, this code will only make a monster's explicit status immunities show on their Bestiary entry.
Updating Bestiary screen:
$121D0: 00000000
That's all I've got for now, but I might have some other things to show at another time.
