Author Topic: Final Fantasy IV (SNES) Info Request  (Read 4088 times)

Bahamut ZERO

  • Cagnazzo
  • *
  • Posts: 347
  • Gender: Male
  • If ye're takin a beatin, hop in de back row!
    • View Profile
Final Fantasy IV (SNES) Info Request
« on: April 28, 2015, 04:28:50 PM »
I've been wracking my brain trying to come up with a way of allowing players to switch between Dark Knight Cecil and Paladin Cecil without the need for having it be an event, potentially causing one to be SoL in a dungeon (as well as make events a little weird later on).

I was wondering - is it possible to switch actors mid battle? If so, would it be possible to tie this to a command?

Basically, I'd like to give both Cecils a command allowing them to switch back and forth mid-battle freely, sort of like Terra's Morph command if FF6.

I figure since in my project Cid won't have the scan/peep command, I could use it's space for this instead.  If possible, I would have it  blacked out  for Dark Knight Cecil until the flag for the Paladin Transformation event is set, thus enabling it's use for both of them. This flag would be set after the fight with DK Cecil, for safety/sense reasons.

Now the thing is - i've never laid eyes on a hex editor, let alone have experience with one. Are there any reccommended tools or info anyone could point me to in order to tackle this endeavor? 




I update my graphics thread on almost a daily basis, so keep an eye out for new stuff!

JCE3000GT

  • Master of FF4
  • *
  • Posts: 1,425
  • Gender: Male
  • Vladof
    • View Profile
    • BlitzKrieg Innovations
Re: Final Fantasy IV (SNES) Info Request
« Reply #1 on: April 28, 2015, 08:26:17 PM »
I'm not 100% sure the game engine would support this sort of thing without doing some serious assembly work.  So I do not think you will be able to do that in battle very easily if at all.  Outside of battle yea that's easy. 

Let's see what the others say.  :)

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,684
    • View Profile
Re: Final Fantasy IV (SNES) Info Request
« Reply #2 on: April 29, 2015, 08:21:07 PM »
 I would have loved a Dissidia-esque system of switching between Dark Knight and Paladin on the fly, and there may be just a possibility... the game can instantly change the sprite of a character to a Pig, Mini, or Toad on any occasion, then why can't it switch between classes? Especially considering that Pig is a full sprite sheet. I think if we look at how Pig works, we may yet be able to switch sprites on the given. (FFX-2 Dress Spheres, anyone?)

...Alright, I've done a bit of preliminary work and I can say that this idea  will work, observe!

(Pig Dealings)
$02/BFA4   BD 03 20   LDA $2003,x[$7E:2003]   A:0000   X:0000   Y:0000   P:envMxdiZc - Load Character's Status Byte 1.
$02/BFA7   29 08   AND #$08   A:0008   X:0000   Y:0000   P:envMxdizc - Is it Pig?
$02/BFA9   F0 0B   BEQ $0B    [$BFB6]   A:0008   X:0000   Y:0000   P:envMxdizc - Branch if not.
$02/BFAB   B9 35 F2   LDA $F235,y[$7E:F235]   A:0008   X:0000   Y:0000   P:envMxdizc - Load Character's (Internal Sprite).
$02/BFAE   C9 0E   CMP #$0E   A:0008   X:0000   Y:0000   P:envMxdizc - Is it Pig? 
$02/BFB0   F0 2D   BEQ $2D    [$BFDF]   A:0008   X:0000   Y:0000   P:eNvMxdizc - If so, branch.
$02/BFB2   A9 0E   LDA #$0E   A:0008   X:0000   Y:0000   P:eNvMxdizc - Load Character 0E (That green pig...) into A.
$02/BFB4   80 0C   BRA $0C    [$BFC2]   A:0000   X:0000   Y:0000   P:envMxdiZc - Branch always.
$02/BFC2   99 35 F2   STA $F235,y[$7E:F235]   A:0000   X:0000   Y:0000   P:envMxdiZc - Store Pig Graphic into Internal Sprite.

Creating a Custom Routine which does this (as well as using the proper character palette...) shouldn't be too difficult, the issue however is that the game only looks at this in a specific fashion, which I haven't been able to pinpoint, otherwise it would be as easy as just changing 7EF235, but its not. It has to be done in a routine-esque fashion.

But for now we'll assume that we can manipulate it... Yes, we can.

This particular line of code is looked at whenever Any action is taken, if we create a Jump in there that looks beyond Pig Status, we can create a Command that will allow Cecil to transform into a Dark Knight and vice-versa.

First off, we need to highjack the code

Turn the Look for Pig into a JSL

While in this it will first look for Pig and Jump Long back to the normal code if Pig is indeed inflicted.

Otherwise it will look to see what Character Action has been taken.

If it is Dark Wave (for my testing purpose, the final version and the one you could use will be replacing Cid's Crash the game Command

If it is Dark Knight Cecil change the Sprite/Class/Palette to 09 (Paladin Cecil). And change the Character Actor to 0A (Assuming you're using the Shadow Mod)

If it is Paladin Cecil change the Sprite/Class/Palette to 00. And change Character Actor to 01.

This is easily possible, but without my Custom Event Routine, that looks at flags to decide what the next action to skip or play is, you could have a lot of trouble. For your case though you would only need to add an exception for "Is it Dark Knight Cecil?" I can probably go ahead and toss an event flag into the Switch Routine to make this work easier for you.

And I have it just about done, but I will need to throw another matter on top of this... Using the Command alone keeps the command in that character's Data and can cause problems, so I'll throw an exception for that into the routine as well.

However, this is taking more time than I thought. While I have the basics done, it just needs fine tuning. I have the character transformation working fine, but then I need to load their commands into their command area, which is trickier. It may be best at that rate to create a duplicate of the normal way commands are placed at the start of battle, except for only the Dark Knight and Paladin when they switch. I can at least show you this though...

Though if you're fine with the Cecils having their original commands (Dark Wave if the battle was started as Dark Knight Cecil and Cover for the Paladin). Then it is done already.




JCE3000GT

  • Master of FF4
  • *
  • Posts: 1,425
  • Gender: Male
  • Vladof
    • View Profile
    • BlitzKrieg Innovations
Re: Final Fantasy IV (SNES) Info Request
« Reply #3 on: April 29, 2015, 10:13:44 PM »
Wow that's epic.  I completely forgot about the frog/mini/pig statuses!  Great work. 

Bahamut ZERO

  • Cagnazzo
  • *
  • Posts: 347
  • Gender: Male
  • If ye're takin a beatin, hop in de back row!
    • View Profile
Re: Final Fantasy IV (SNES) Info Request
« Reply #4 on: April 30, 2015, 01:35:41 PM »
Holy crap, that's amazing!  :omg: Aweseine work, man!

I actually kind of like the set up, it reminds me of how Cecil transforms in Dissidia.  Hell, if there were some way to turn Cover into another Dark Wave, and give Dk Cecil's Dark Wave an ability to do holy damge once the flag's set, it would mimic Dissiidia 100%!


In anycase, I love it!  I  have just a couple questions in regards on how you have it set up in your tests (with it using Cecil's normal commands)

Does it only allow switching once per battle?

When DK Cecil uses Dark Wave to transform, who takes the health penalty for using it - The Dark Knight or the Paladin?

When Paladin Cecil uses Cover, does he still cover allies after transformation?



Granted, I like the idea of having the command being Cid's Crash the Game command more, I'm just curious.
I update my graphics thread on almost a daily basis, so keep an eye out for new stuff!

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,684
    • View Profile
Re: Final Fantasy IV (SNES) Info Request
« Reply #5 on: April 30, 2015, 03:22:44 PM »
Holy crap, that's amazing!  :omg: Aweseine work, man!

I actually kind of like the set up, it reminds me of how Cecil transforms in Dissidia.  Hell, if there were some way to turn Cover into another Dark Wave, and give Dk Cecil's Dark Wave an ability to do holy damge once the flag's set, it would mimic Dissiidia 100%!


In anycase, I love it!  I  have just a couple questions in regards on how you have it set up in your tests (with it using Cecil's normal commands)

Does it only allow switching once per battle?

When DK Cecil uses Dark Wave to transform, who takes the health penalty for using it - The Dark Knight or the Paladin?

When Paladin Cecil uses Cover, does he still cover allies after transformation?



Granted, I like the idea of having the command being Cid's Crash the Game command more, I'm just curious.

As this is purely an experiment, it is not using what I imagine you would want. That would be using the "Crash the Game" command instead of tying it to Dark Wave.. Which is a very simple switch, and both Cecil's should have that Command for this to work optimally.

You may switch as many times as you like. The game looks to see who is doing the Command, if it is the Paladin it will switch to the Dark Knight if it is the Dark Knight it will switch to the Paladin.

Now I was unaware you wanted the switch to be Complete as in you wanted the Dark Knight from the Shadow Party put into the current portion of the Paladin and vice-versa. All I had done was switch Class, Actor, and two commands, I can see where issues would arise with that though because of equips and the like.

That... will be a bit trickier to accomplish, but it may be worth it.  It will inflate this routine massively though, unless I can somehow jump to the ordinary Shadow Loading routine and force it to load from there.

As it stands though the Dark Knight takes the HP damage since the "look for Pig" happens after every action, not before.

Cover does not actually work if the Dark Knight is present, bizarrely enough and it would only work if the Paladin started the battle (since the game looks to see if the Paladin is present and which slot he's in) Again though, these are both things I have found and are included in FF4kster so if you change the way those are enabled it should work.

There's a couple more things I'll need to know from you before I can proceed further...

How many commands will the Dark Knight Cecil have? If it is somehow 5, it makes things much easier for me. If it's 4 there's a lot more work to do. I know the Paladin will have to have 5 because of Fight, White, Cover, Morph, Item.



« Last Edit: April 30, 2015, 04:39:12 PM by Grimoire LD »

Bahamut ZERO

  • Cagnazzo
  • *
  • Posts: 347
  • Gender: Male
  • If ye're takin a beatin, hop in de back row!
    • View Profile
Re: Final Fantasy IV (SNES) Info Request
« Reply #6 on: May 01, 2015, 01:19:50 PM »
Aha, I see!

As for command layouts, I have Cecil set up like so:

Dark Knight:

Fight
Black
Dark Wave
Item

Paladin:

Fight
White
Cover
Item


So with the morph command added in, they would both end up with five commands. :D

I update my graphics thread on almost a daily basis, so keep an eye out for new stuff!

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,684
    • View Profile
Re: Final Fantasy IV (SNES) Info Request
« Reply #7 on: May 01, 2015, 08:06:44 PM »
Hrm.... I'm sorry Bahamut ZERO, I tried to get the Shadow Slot load from in-battle to read the Dark Knight and a Paladin's stats but everything continued to get really askewed, since it's using Chillyfeez's Shadow Party Mod, I wonder if he could shed some light on how that is done in this? All I would technically need to do at this point is know how he draws allies back since his shadow party hack doesn't appear to include the "To Level Up" exp. so that must be calculated with the routine, but I'm having trouble locating said routine.


 :edit: I do have a plan though which is slightly more ambitious...

 There may be a way to sidestep all of this ugly Shadow Slot business, now that I really think on it it will utilize the 40 unused SRAM Bytes. (14A0-14FF)

I can create a custom jump in the start-of-game info to store Dark Knight Cecil into this unused SRAM. When the Morph command is used, the character's data is temporarily stored to unused RAM and the data at 14A0 placed over the first 40 bytes of the character's data (Commands and everything else will be dealt with separately) and the character in the unused RAM will then be saved to the unused SRam.

This will mean two things... you will need to raise the Dark Knight from Level 10 again, as his stats when Morph will be his default stats (and equipment... but I can actually leave his equipment bare. If you'd like)

I like this idea much more than drawing from the Shadow Slot personally and offers you a little more freedom in how you want this to work, (but I don't think I should be using test roms of my own for this purpose as you are using a rom with many different hacks and it is important that this mesh will with all of them. May I ask you for a copy of your in-progress mod? With that I should be able to transfer the data quickly and try out these experiments in earnest. (This means I should also be able to put together the Morph command for you.)
« Last Edit: May 01, 2015, 10:06:40 PM by Grimoire LD »

Bahamut ZERO

  • Cagnazzo
  • *
  • Posts: 347
  • Gender: Male
  • If ye're takin a beatin, hop in de back row!
    • View Profile
Re: Final Fantasy IV (SNES) Info Request
« Reply #8 on: May 02, 2015, 12:32:34 PM »
The only potential promlem I could see from this is perhaps DK Cecil relearning black magic spells, but if that turns out to be the case, I could always add his spells in stealthily through eventing :D.

Although it would epic if there were a way to access his shadow slot (as that shadow slot would still be gaining exp throughout the game) I'm fine with some releveling. Would he need to be releveled each time he's morphed to?


In any case, PM me your email and I'll happily send you a copy of my project for experimentation.
I update my graphics thread on almost a daily basis, so keep an eye out for new stuff!

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,684
    • View Profile
Re: Final Fantasy IV (SNES) Info Request
« Reply #9 on: May 02, 2015, 02:20:57 PM »
The only potential promlem I could see from this is perhaps DK Cecil relearning black magic spells, but if that turns out to be the case, I could always add his spells in stealthily through eventing :D.

Although it would epic if there were a way to access his shadow slot (as that shadow slot would still be gaining exp throughout the game) I'm fine with some releveling. Would he need to be releveled each time he's morphed to?


In any case, PM me your email and I'll happily send you a copy of my project for experimentation.

The Shadow Slot is a problem because of the limited amount of data stored in it. Meaning that his current HP would not be loaded (on both accounts) and this would have the problem of storing it back into the appropriate Shadow Slots and it would just be a Ton of programming where if I store it in the unused SRAM this allows me to keep a perfect track of the two and use a lot less bytes in the process.

But no, he would not releveled. The game start code will store a copy of Default Dark Knight Cecil into the unused SRAM which will then be accessed eventually by the Paladin's Morph Command who will then trade his spot for the Dark Knight making all changes to the Dark Knight from thereon out, permanent.

I will send you my e-mail and I will get to work on the routine then.

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,684
    • View Profile
Re: Final Fantasy IV (SNES) Info Request
« Reply #10 on: May 07, 2015, 10:20:59 PM »
It is done! I have sent the hack to Bahamut ZERO and it is working to my exactions, nearly exactly what I set out to do which is all too rare for me. I have long desired to put in a Dissidia style of free-switching for the Dark Knight and Paladin, but I knew that none of my hacks would really make use of it and it wasn't ever really requested, while this request really got the creative juices flowing for me.

How it Works:

When you start a new game, custom code saves a copy of Character 1 (with the expectations that this character is Dark Knight Cecil with the Doom Sword) along with the Demon Armor and Doom Sword into unused SRam space at 7E14A0.

The "Crash the Game" command became the Morph Command which uses free space without removing anything by default.

Dark Knight Cecil starts out with the Morph command, but if it is used before the Event Flag FF is triggered...



Ideally this Flag would be triggered somewhere after the Paladin event.

If the flag is on, an animation will play depending on whether Cecil is transforming into a Dark Knight or Paladin.

Then we come to the biggest part of it by far, the code that was spliced into the Status Check routine.

First the game checks whether a byte was activated from the Morph Routine and then checks to see if that character has used the Morph command. If they have it continues on.

It then checks to see whether it is the Dark Knight transforming into a Paladin or vice-versa, implementing proper palette and graphic change. (inadvertently one of my favorite graphic changes are through this. The Dark Knight Cecil glows white for a moment before transforming into a Paladin, almost reminiscent of his event transformation into a Paladin.



The Paladin's palette changes into something else, which looks offsetting, but hey he is absorbing Dark Power after all to revert to a Dark Knight, so it works for me...

Next comes the large part which gave me many headaches trying to line up, but in the end it all worked out... This switches Cecil's commands to his other form, while getting rid of his White and Black Magic command (for code-failure reasoning) and for the initial battle they are morphed they will have a different command in place of that.

The initial character data is placed in unused Ram and the character data in Unused SRam replaces the data in the character's slot with its own. The character data in unused Ram is then saved to the Unused SRam to be drawn at a moment's notice.

Finally the weapons for the new character is stored into their proper hands (yes, just placing it from data is not enough for FFIV, it needs a special section for the hands) and that does it!

While not sounding like a lot of work, it was a Lot of work and is probably my most technologically impressive hack when all is said and done.


I'll be releasing a standalone patch for this down the line. As it is a bit too hefty to go with many of my large-scale hacks.


chillyfeez

  • FF4 Hacker
  • *
  • Posts: 1,281
  • Gender: Male
  • Go ahead, ask me about Angel Feathers!
    • View Profile
Re: Final Fantasy IV (SNES) Info Request
« Reply #11 on: May 07, 2015, 10:32:11 PM »
Hey, guys, I just discovered this topic...

So, Grimoire, does this use the Shadow Hack, too? And if so, what did you do about the stored character stats?
Because honestly, I cannot for the life of me conceive of a feasible way to load a character from my altered shadow slots mid-battle. At least not without a metric ton of new coding...

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,684
    • View Profile
Re: Final Fantasy IV (SNES) Info Request
« Reply #12 on: May 07, 2015, 10:42:00 PM »
It does not rely on the Shadow Hack, at first I tried to conceive of ways to make it work, but there is no way, as you had just said it would have been Extraordinarily complicated. I sidestepped both normal Shadow Slots and your condensed Shadow Slots for two reasons... the first was because I wanted this patch as standalone so anyone could use it without any other patches, but to not interfere with any other patches. The second reason was because... it's impossible. I tried to force the game to load certain things like equipment resetting and the like and the game just goes berserk in the attempt.

What this does is it takes the initial copy of Character 1's data from ROM, puts it into unused SRam (14A0-14FF) it takes the new stats that the character would have (assuming this character will be Cecil with the Doom Sword and Demon gear) as a result.

And it awaits activation from the splice in the status check routine.

JCE3000GT

  • Master of FF4
  • *
  • Posts: 1,425
  • Gender: Male
  • Vladof
    • View Profile
    • BlitzKrieg Innovations
Re: Final Fantasy IV (SNES) Info Request
« Reply #13 on: May 09, 2015, 05:25:52 PM »
Wow this is pretty awesome work.  Think of the possibilities this could open up...

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,684
    • View Profile
Re: Final Fantasy IV (SNES) Info Request
« Reply #14 on: May 11, 2015, 03:45:17 PM »
Wow this is pretty awesome work.  Think of the possibilities this could open up...

It... unfortunately doesn't open that many avenues... if you mean the concept of changing a sprite mid-battle, then yes. But the way this was designed was designed for This purpose, trying to change that purpose would require quite a bit more hacking.

Through this I did find how certain status effects (read - Poison) change certain parts of a character's palette, meaning I can give status glows and such to new statuses or even to some old statuses (Berserk comes distinctly to mind).