Spell Customization

From FF5 Hacking Wiki
Jump to navigation Jump to search

By Praetarius5018

Required Tools

  • a hex editor, e.g. HxD
  • noisecross's text editor
  • a backup of your work before any experiments


Beginner: Multi-target Flare

Goal:
allow Flare to hit all enemies with a working spell animation

First we need to modify the spell data itself. It is located at

$110B80 + 8 * SpellId

Flare has a SpellId of $33 so we find our data at $110D18.
You can find the SpellIds e.g. here under 1.8b

The data is:

38 04 00 27 08 00 FE 00

For now we only care about the first byte, it determines the targetting of the spell:

80 Multi-target optional
40 Hits all targets
20 Target selectable
10 Side selectable
08 Target enemy (by default)
04 Roulette
00 caster

Since we want regular flare to be multi-targetable like Fire1/2/3 we change the 38 to B8.

However the default animation of flare is not compatible with multitargetting; the damage will still be done to all targets but it will not look right - or in case of some spells even fry the graphic engine.

Animation headers are located at

$1838EC + 5 * SpellId

so for Flare it is $1839EB with

05 10 1D 88 1D

For simplicity's sake we just replace it with L3 Flare's data:

05 10 A8 00 2B


Advanced: Water spell

Goal:
replace !Time/Drag (or Void) with a water damage spell

To my knowledge there's little to no use of the !Time spell Drag (or Void) so let's replace it.
It has SpellId $36 so the data is located at $110D30.

The effect of the 8 bytes are as follows:

Targeting
???
Misc.
Reflectable ($80 not set) + MP cost
Attack formula
Parameter 1
Parameter 2
Parameter 3

Targetting was explained for Flare, so I'll just say we use B8 as well.

I've honestly not seen an effect of the second parameter but most spells had 04, so we go with that.

Misc should be 0. The only non-0 values I've seen were for Meteo and Cave In the hit count. If we were to use a non-0 value our spell would behave like Meteo in that it doesn't hit the target(s) once each but that it selects out of the targets a random target up to 4 times and performs a single target attack against it; in that case it would also require us to either use either the Meteo or Cave In spell animation as only those are compatible with that effect.
This byte also holds the learnable flag ($40) for blue magic.

For the next byte, if we want our spell to not be reflectable we would set the $80 bit and then add the MP cost to it. E.g. 20 MP not reflectable would be $94. For this example I went with 8 MP and reflectable, so $08.

Then we need to decide what the spell actually does and fill in the 3 parameter for it.
Notable examples:
$06: Offensive magic

1 00
2 Attack power
3 [Element]

08: Pierce defense

1 00
2 Attack power
3 [Element]

0A: Physical magic

1 Hit %
2 Attack power
3 [element]

0C: Pierce defense + HP leak

1 [Element]
2 Attack power
3 Duration/2

12: Status 0 infliction

1 Hit %
2 Duration
3 [Status 0] added

We want to deal normal water damage so $06 is fine. The element is built like:

01 fire
02 ice
04 lightning
08 poison
10 holy
20 earth
40 wind
80 water

For power 50 should be fine, so the final result is something like

B8 04 00 08 06 00 32 80

Next up we have to change the spell animation. Since the spell is SpellId $36 we find our animation data at 1839FA.

The 5 bytes have the following meaning:

sprite
color palette
animation
bonus flags + multitarget/multiplication handling type
sound

We want something watery, so the bubbles from Aqua Rake ($84) could make a good start for our animation: $46
It also gives as a good starting point for the palette: $38
and the sound effect: $22
To mix it up a bit we use the monster attack animation: $94, this won't always work but some trial and error shows it to work well enough here.
Next comes one of the harder parts, finding a good handling type; the $80 flag most of the time speeds up the animation, the $40 flag does something different for most routines or nothing at all, and the remaing $00 to $3F determines the base routine. The actual effect can vary by the base spell animation. It is mostly down to trial and error. For some $22 was OK, for one other it crashed the game.

00 multitarget able, "one iteration"
01 single target only? multiple parallel
02 single target only? multiple delayed
05 same as 00?
07 same as 00?
08 single target only? multiple delayed, directions may vary
0A single target only? "one iteration"
0C special routine? may crash
0E single target only? multiple parallel, lots
0F multitarget able, multiple parallel
11 single target only? multiple delayed, with red background
12 single target only? multiple delayed, can mirror vs party
13 single target only? multiple delayed
14 single target only? multiple parallel
15 single target only? multiple parallel
1F single target only? multiple parallel, tons, laggy
21 multitarget able, multiple delayed (3?)
22 single target only? multiple parallel, tons, laggy
23 nothing shown?
25 single target only? multiple parallel, tons, laggy
26 single target only? multiple delayed, tons, laggy
27 single target only? multiple parallel
28 shows red X
29 same as 00?
2A multitarget able, moves rows of player characters (if enemy1 was hit, player1 moves back/for)
2B same as 00?
2C multitarget able, multiple parallel (2?)
2D single target only? multiple delayed, tons, laggy
2F same as 00?
30 multitarget able, multiple parallel (2?)
31 same as 00?
33 like flood but with current sprite?, x3
34 like breath wing with current sprite?, x3
37 animation attacks a fixed range
38 same as 00?
39 nothing shown?
3A nothing shown?
3B nothing shown?
3C caster falls infinitely???
3D nothing shown?
3E nothing shown?
3F caster falls infinitely???

I think that part is much easier to understand when you play around with the !White Heal spell animation. Normally it is just 3 blue lines that rise from the ground but with that multiplication it can become something like a wall of blue lines and other stuff. $21 and $30 are usually my go-to for multitarget spells.

So as a final animation we get something like

46 38 94 30 22

As a final touch we need to change the spellname from Drag (or Void) to Water.
Open the ROM with noisecross's texteditor, get the template for Skill(M). Open the resulting .csv file with a text editor, NOT with something like Excel, then look for either Drag or Void (the spell names are in the same order as the spells themself) and change it to Water, save the file and inject it via the text editor, done.

Master: Clash

Goal:
summon Gilgamesh
change the battle theme
custom damage formula

Warning: this part requires ASM knowledge

TODO