Users browsing this thread: 1 Guest(s)
Breaking Raiden - how to add a new Esper

Posts: 729
Threads: 34
Thanks Received: 10
Thanks Given: 41
Joined: Jan 2016
Reputation: 6
Ah, Raiden, the most superfluous Esper in the game. Many modders have wanted to ditch him and transform him into a new summon. And any of you who have tried it know it's a pain in the ass.

At least it was.

Over the weekend several users on the Discord including myself banded together to finally crack this nut, and we succeeded. Gentlemen, Raiden has been broken and is fully moddable, and this is the saga of how we did it (read: how YOU can do it).

Credit for this goes to me, CDude, OS, and the FF6hacking Discord community. I'm not taking credit for anything, I'm just the one typing up the thread, this was a team effort.

Problem 1: Raiden does not play nice with other animations

For those who may not be aware already, the Esper that appears in the summon sequence depends on its Byte 10; doesn't matter the spell index or the animations, Byte 10 determines the Esper sprite. Raiden's Byte 10 is 6B. And it comes with a big hurdle, because Raiden, Odin, and Crusader, do something in their animations that other Espers don't - they use Mode 7, so they can have that effect of them zooming in bigger. To do this, the game loads the three differently, basically enabling Mode 7 for them and then turning it off after the animation. BUT WAIT, that's not all! This not only means that editing Raiden's sprite animation is a pain, editing his loaded animations is a pain; because of the Mode 7 deal, that gradient blue background that Raiden and Odin use doesn't like to be modified. I speak from experience, do ahead and blank out bg1 in usME, that background ain't going anywhere.

So, if we're going to turn Raiden into a "normal" Esper, we need to disable that Mode 7 stuff. And thanks to CDude, we know how this is done - the Byte 10.

; [ Battle Animation Init $6B: True Edge ]

C2/EBFE: 20 2D F0     JSR $F02D            [Set up Mode 7]
C2/EC01: A2 8C 01     LDX #$018C      ; raiden
C2/EC04: DA           PHX 
C2/EC05: 22 00 24 C1  JSL $C12400
C2/EC09: 20 70 FA     JSR $FA70            [Put Esper palette in BG1]
C2/EC0C: 22 C6 9E C1  JSL $C19EC6
C2/EC10: FA           PLX 
C2/EC11: 22 80 24 C1  JSL $C12480     ; load esper graphics (sprite)
C2/EC15: 20 87 FA     JSR $FA87
C2/EC18: EE B0 62     INC $62B0
C2/EC1B: 60           RTS 

Obvious, C2/EBFE needs to be blanked out. But we also need to blank out C2/EC04, C2/EC05, C2/EC0C, and C2/EC10. C2/EC05 and C2/EC0C call subroutines which are also related to Mode 7, C2/EC04 is also related to Mode 7, and C2/EC10 is no longer necessary with these changes,

What you do with C2/EC09 would depend on what you're doing with the Esper; some Espers put themselves in BG1 (Phantom, Golem, Bahamut), some use themselves as sprites (Tritoch, Maduin, Phoenix). I'm no expert on this and it really does depend on what kind of animation you're trying to give the new Esper. There's also additional subroutines you'll want to call up depending on the same. Fortunately noping out the Mode 7-related commands gives you room to add those subroutines without needing to relocate data. Again, what further work to do here depends on what you're doing specifically; for instance, OS had to nope out C2/EC09 to solve some issues with his palettes not being utilized properly.

Point is, with the Mode 7 stuff removed and Raiden ready to be edited, you'll have something that looks like this

C2/EC01: A2 8C 01     LDX #$018C      ; raiden
C2/EC04: EA           NOP 
C2/EC05: EA EA EA     NOP 
C2/EC09: 20 70 FA     JSR $FA70            [Put Esper palette in BG1]
C2/EC10: EA           NOP 
C2/EC11: 22 80 24 C1  JSL $C12480     ; load esper graphics (sprite)
C2/EC15: 20 87 FA     JSR $FA87
C2/EC18: EE B0 62     INC $62B0
C2/EC1B: 60           RTS 

With this done, Raiden can now be loaded into battle and given animations like other Espers. But we're not done yet, there's another problem now...

Problem 2: Raiden isn't a mime

Raiden can be made into a new summon now, but as-is, he's going to need to borrow animations from other Espers to be usable. If you're fine with that, congrats, you're done, you can go now, thanks for reading, don't forget to like and subscribe, etc.

But if you want to go the extra mile and give Raiden his own animations, stick around, because it's time to dive into the D banks. We're gonna give Raiden his own animations by editing other animations. He not only needs animations for BG1 and/or BG3, but you may also want a unique summoning animation for Raiden himself, since originally he didn't have his own, he shares Odin's. So that's two or three new animations we'll need.

To start, make absolutely sure nothing else in your mod uses the animations you remove. The dummied attacks Megazerk, Clear, and Heart Burn, are appealing, but put a pin in those, I have something to say about them later. For other attacks, you could repurpose Quick's animation; though it's a short script (about 25 bytes) you could fit something in there and just give Quick another spell animation. Spiraler is another options, because who's gonna care if THAT animation goes missing? Rippler is particularly appealing because it uses two unique animations (192 and 193) that each take up a chunk of space, so you'll have lots of room to work in them.

But, turning Rippler into a new animation isn't as simple as just copying over code from the D0 disassembly. Why? Because each animation, based on its index, loads something from the graphics in D4 bank. Those graphics will persist regardless of what D0 says. For example, I turned Spiraler into a duplicate of Wind Slash, and here's what I got.

[Image: Z6p0vDN.png]

I'm sure someone will figure out how to take this and turn it into something neat, but me, I wanted that tornado gone. Fortunately, we know how to make that happen. If we wanna get D0 bank working, we need to know how D4 bank interacts with it, and that secret is back in the C1 bank.

Copy 6 bytes from (D4D000 + 6 * "Spell Graphic" pointer) to 7AEA-7AEF

C1/A18B:    C220        REP #$20
C1/A18D:    8A          TXA
C1/A18E:    29FF7F      AND #$7FFF
C1/A191:    0A          ASL A
C1/A192:    8DEA7A      STA $7AEA        (Spell graphic times 2)
C1/A195:    0A          ASL A
C1/A196:    18          CLC
C1/A197:    6DEA7A      ADC $7AEA
C1/A19A:    AA          TAX             (Now X holds the spell graphic pointer times 6)
C1/A19B:    7B          TDC
C1/A19C:    A8          TAY
C1/A19D:    BF00D0D4    LDA $D4D000,X
C1/A1A1:    99EA7A      STA $7AEA,Y
C1/A1A4:    E8          INX
C1/A1A5:    E8          INX
C1/A1A6:    C8          INY
C1/A1A7:    C8          INY
C1/A1A8:    C00600      CPY #$0006
C1/A1AB:    D0F0        BNE $A19D
C1/A1AD:    7B          TDC
C1/A1AE:    E220        SEP #$20
C1/A1B0:    60          RTS

Take the index of the spell you're using for Raiden's new animation and multiply it by 6 (you won't even need to leave Hex mode on your Calculator for this). The result is the six-byte spot in D4/DXXX where the game loads graphics for the animation. Pick a spell you want to base your new animation on, find its spot in D4/DXXX, and copy those six bytes. Now go to the address for the spell you're making into Raiden's and paste those six bytes there. To make it more clear; I wanted my new Esper to have an attack animation based on Wind Slash. Wind Slash's background is $012F. Times 6, that's 71A. Go to D4/D71A, and copy the six bytes there. Now over to Spiraler's address, Spiraler is animation $0070, times six, and we're going to D4/D2A0. Paste the string you copied from Wind Slash, and presto - Spiraler is now loading Wind Slash's data.

Note that there seems to be animation data still clinging to the address; when I used Clear and turned it into the lightning from Flash Rain, I got the lightning from Flash Rain displaying, but it was spinning at ludicrous speed. But for another animation, that kind of effect may be one you want, so you'll have to maybe play a bit with different places to find something agreeable with you.

For whatever animation you use for Raiden itself, I haven't experimented, but I played it safe and copied another Esper's, particularly Phoenix since I know Phoenix's sprite is fairly big and loaded all in one piece, I don't need to turn Raiden into a jigsaw puzzle like Bahamut or Tritoch. That said I'm not 100% sure this is how the game handles drawing pointers for Espers; if I used Carbuncle's D4 data, would Raiden have been shrunk down? I don't know. But even if so, you can see all the Espers, there's lots of big bois like Terrato and Bismarck and Fenrir, you can find one that works.

Once your work in D4 is done, you can go back to D0 and start working on creating your custom animations. There's a disassembly for D0 so you have all you need to work there.

Congratulations again, you've turned Raiden into a new Esper with custom animations! Go into battle and summon him, try him out and make sure he works, and...wait, why did the enemy sprites get sliced apart?

Problem 3: Raiden is a jerk

Yeah, there's one last little hurdle that took me by surprise. At this point I thought I was all done too, but nope - I tried Raiden out and the enemies slice apart, and it had nothing to do with him being assigned that animation in usME.

In a final twist, it turns out that Raiden and Odin are hardcoded to use the slicing death animation, regardless of everything else we've changed. Why did the developers do this? I don't know. Possibly one of them was a prophet, had a vision of this moment 30 years ago, and did it to mock us and is snickering to this day over how confused and angry modders are gonna be with his dirty trick.

Anyway, no worries, this is easy to remove. Thanks to Drakkhen on this one.

[Image: unknown.png]

NOP out C1/B0E4 and C1/B0E6 and Raiden will no longer use the slicing death animation. And now...

Problem 4: There isn't one!

Congratulations, you're done! No, I mean it this time! Raiden is fully moddable and can be turned into a truly unique Esper with his own sprite and summon animations, and no one will ever know he was a 90% clone of Odin. The 27th Esper has been broken and you can reforge the shards into whatever you want.

But remember, you have to make the-Esper-formerly-known-as-Raiden obtainable. The simplest way to accommodate this is to just remove the Ancient Queen event so Odin can't be upgraded, but if you want to retain it, you can make Odin unusable until you get the Queen's tear to power him up. And this is really easy to do, you don't even need to move any event coding.

CC/1ECE: 4B    Display dialogue message $0971, wait for button press (At bottom of screen)
              Odin turned into a
              Magicite shard…
CC/1ED1: 86    Give esper $41 (Odin    ) to party


CC/1F81: 87    Take esper $41 (Odin    ) from party
CC/1F83: F4    Play sound effect 141
CC/1F85: 86    Give esper $42 (Raiden  ) to party

The game gives and takes rare items from the party using event bits. The Rust-Rid is bit DB, the item after it, the Autograph, is perfect. Change CC/1ED1 to D2 DC, and instead of giving the party the Odin magicite, it'll give them the Autograph. Then at CC/1F81 change it to D3 DC to remove the Autograph, and change CC/1F85 to 86 41.

You can now change the dialogue captions to something like "Odin crumbled into a pile of dust" or some such, and the party receives the rare item "Odin remains" or "Dull Magicite", etc. Then the Queen's tear restores his power and Odin is added as an Esper properly.

Finally, find a place to add the-Esper-formerly-known-as-Raiden to obtain. PowerPanda said he added an event to acquire a Magicite from the Dirt Dragon fight, I'm going to have the MagiMaster drop it. There's plenty of places you can add a new Magicite to obtain. Heck, if you wanna get creative, the Hero Ring sold at the Auction in the World of Ruin is a one-time purchase, so you could probably replace it with your new Magicite and make the player pay through the nose for it. It's event editing, do as you please! Laugh

Happy modding everyone!

[-] The following 1 user says Thank You to DrakeyC for this post:
  • C-Dude (10-09-2022)

Posts: 611
Threads: 49
Thanks Received: 0
Thanks Given: 4
Joined: Feb 2017
Reputation: 25
(10-09-2022, 02:29 PM)DrakeyC Wrote: PowerPanda said he added an event to acquire a Magicite from the Dirt Dragon fight

Indeed, I did. If you're going with a mostly-vanilla game progression, it fits really nicely here. The Opera House kind of only exists in the WoR for this one boss battle, and the reward for defeating it, the Magus Rod, doesn't seem like enough for going so out of your way to find it. So, it seemed like the best place to drop in an extra Esper. I chose to move Terrato there, and have my Esper, Leviathn, replace Terrato in Umaro's Cave.

If you want to take my route, it can be difficult to actually FIND the scene you need. It's hidden behind several conditional jumps. The scene you need starts at CA/B6D6. Right at the end, there is a pause and a dialouge box that you can put together, and then replace with a subroutine jump.

EDIT: Attached is a Leviathan sprite that is a modified version of the sprite used in FFV, FFVI Advance, FF Record Keeper, and Pictologia Final Fantasy. The tail is ever-so-slightly shortened so that it fits completely within Raiden's sprite mold. Anyone is welcome to use it if they would like.

Attached Files Image(s)

FFVI: Divergent Paths (Completed) - a complete storyline and gameplay hack of FF6 that adds Leo as a playable character

Posts: 16
Threads: 3
Thanks Received: 0
Thanks Given: 0
Joined: Jun 2011
Reputation: 0
This was a blast to work through. I didn't know enough to know this was a trouble spot before I started, I learned a lot.

Ultros can now stick with the party forever!

I should note that while certain spells don't fit without serious editing like DrakeyC mentioned in the first post, just about anything that fits in Idx 1 will transfer cleanly.

Posts: 370
Threads: 32
Thanks Received: 3
Thanks Given: 3
Joined: Dec 2018
Reputation: 18
I want to thank Everything and L33tSk3tch3r for their extra notes in the C2 bank, which were crucial in understanding the extent of what Byte 10 does for an animation.  My contribution was basically "What if we removed this subroutine?".

Forum Jump:

Users browsing this thread: 1 Guest(s)

Theme by Madsiur2017Custom Graphics by JamesWhite