Author Topic: Developing FF4kster: a comprehensive editor for FF4  (Read 235607 times)

Pinkpuff

  • Flan Princess
  • *
  • Posts: 923
  • Find a Megalixir in Unprecedented Crisis!
    • View Profile
Re: Developing a comprehensive editor for FF4
« Reply #510 on: November 05, 2013, 04:18:32 AM »
Well, diving into the ROM, the hex code appears to say exactly what the editor says it's saying according to my information.

A004B: 00 07 00 01 00 0B 00 0B FF

00 07 = Cast spell 7 (Slow)
00 01 = Cast spell 1 (Hold)
00 0B = Cast spell 11 (White)
00 0B = Cast spell 11 (White)
FF = End script

A005D: 00 2F 00 0C FF

00 2F = Cast spell 31 (Meteo)
00 0C = Cast spell 12 (Dummy / Dispel)
FF = End script

Unless there's something special about those indexes, it's being parsed correctly.

 :edit: Wait I see what's happening now. It's writing over Golbez' script code. It doesn't know how to read the Golbez scripts and doesn't even acknowledge their existence and just goes ahead and computes what it thinks is the correct place to put the "next" autobattle, which is right over top of where the Golbez script should be. Ok at least I know what to do now.
Let's dance!

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,682
    • View Profile
Re: Developing a comprehensive editor for FF4
« Reply #511 on: November 05, 2013, 05:04:45 AM »
Ah, so it is Golbez who initiates the Twin sequence, the Twin command routine makes that very unclear and says that either can be used to cast W. Meteo.

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,682
    • View Profile
Re: Developing a comprehensive editor for FF4
« Reply #512 on: November 05, 2013, 06:33:34 PM »

I'll take it slowly, as I don't want to overwhelm you with information, please tell me if this manner looks proper to work with.

Fight

Basic Attack Option, including Elemental Damage, Weak-Creature Resist/Weapon Damage, Status Infliction
  • Elemental Hit Damage Modifier
    • Elemental Hit - Very Weak: 1C863
    • Elemental Hit - Weakness: 1C872
    • Elemental Hit - Immunity: 1C881
    • Elemental Hit - Resistance: 1C890

  • Creature Weak to Weapon/Resist Armor
    • Monster Weakness Weapon Hit: 1C8A5
    • Monster Resistance Armor Hit: 1C8B8


Caster's Stat Subtracted from Target's Stat equals Chance to Inflict Status.
  • Status Infliction Formula
    • Caster's Stat: 1CA43
    • Target's Stat: 1CA46

Note in Regards to Command: The Elemental/Creature Hits are translated in this manner.

00: Always 1 Damage
01: x1/2 Damage
02: Normal Damage
03: x1.5 Damage
04: x2 Damage
05: x2.5 Damage
06: x3 Damage
07: x3.5 Damage
08: x4 Damage



Pinkpuff

  • Flan Princess
  • *
  • Posts: 923
  • Find a Megalixir in Unprecedented Crisis!
    • View Profile
Re: Developing a comprehensive editor for FF4
« Reply #513 on: November 06, 2013, 03:46:41 AM »
Yes it is! Thank you so much!

The elemental hit damage modifier and creature weak to weapon/resist armor addresses all seem to be off by one though (they all point to A9s).
Let's dance!

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,682
    • View Profile
Re: Developing a comprehensive editor for FF4
« Reply #514 on: November 06, 2013, 10:29:28 AM »
Eh heh, yes. That's because that's the start of the Instruction "A9 XX" Load XX into A, is what I was basing off of for the start of it. Not that changing A9 to anything else would ever work on its own without additional hacking.

vivify93

  • Liquid Flame
  • *
  • Posts: 303
  • Gender: Male
  • White Wizard
    • View Profile
Re: Developing a comprehensive editor for FF4
« Reply #515 on: November 17, 2013, 06:44:42 PM »
 :edit: Aaand you were just talking about the auto-battle Zemus vs. Fusoya and Golbez problem. I guess I should've read before panicking.

So, I once again ask for help--do you guys have any idea what I should do? Because I am doing the last thing I have to do before I release this, which is the final boss and the ending events.

 :edit: Never mind! I fixed it myself!!! :whoa:

You've taught me well, sensei. *bows humbly*
« Last Edit: November 17, 2013, 07:06:01 PM by vivify93 »
Hacking is hard. :sad:

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,682
    • View Profile
Re: Developing a comprehensive editor for FF4
« Reply #516 on: November 17, 2013, 07:45:08 PM »
Oh, it's nearly complete? That's fantastic! I'm looking forward to playing this through when you release it.

vivify93

  • Liquid Flame
  • *
  • Posts: 303
  • Gender: Male
  • White Wizard
    • View Profile
Re: Developing a comprehensive editor for FF4
« Reply #517 on: November 17, 2013, 07:48:57 PM »
Oh, it's nearly complete? That's fantastic! I'm looking forward to playing this through when you release it.
I have to ask--you've seen a bit of my script so far, right? What do you think of it?
Hacking is hard. :sad:

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,682
    • View Profile
Re: Developing a comprehensive editor for FF4
« Reply #518 on: November 17, 2013, 08:34:46 PM »
Heh, embarassingly I just zipped right through the text, mainly so I wouldn't spoil the experience for myself. I do recall some of the ending script and I think Edge's affection for Rydia comes on a little too strong, mainly because the After Years basically says that the two didn't maintain anything but a friendship for the last 17 years. Other than that everything seemed fine as far as I can recall.

vivify93

  • Liquid Flame
  • *
  • Posts: 303
  • Gender: Male
  • White Wizard
    • View Profile
Re: Developing a comprehensive editor for FF4
« Reply #519 on: November 17, 2013, 09:00:32 PM »
Heh, embarassingly I just zipped right through the text, mainly so I wouldn't spoil the experience for myself. I do recall some of the ending script and I think Edge's affection for Rydia comes on a little too strong, mainly because the After Years basically says that the two didn't maintain anything but a friendship for the last 17 years. Other than that everything seemed fine as far as I can recall.
That's alright; I thought I'd ask since you're the only person who's really been exposed to it, other than some friends who helped me early on in the script.

Regarding the part of Edge's affection for Rydia, I haven't played The After Years, and so Project II doesn't take it into account. I tote the DS / smartphone versions wholly over Project II as the ultimate Final Fantasy IV experience, anyway! It's official and canon, therefore better by default. Project II's script is mostly for those who do want to play a (mostly) uncut version of FFIV for SNES, but don't want to play J2e's mess of a script / hacking job. (A hack-job hacking job? Ha! OK, OK, no more puns from me.)
Hacking is hard. :sad:

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,682
    • View Profile
Re: Developing a comprehensive editor for FF4
« Reply #520 on: November 17, 2013, 09:40:02 PM »
Heh, that is well understood. I'll be able to give a more detailed approach when I play through the game itself.

Displacer

  • FF4 Hacker
  • *
  • Posts: 27
    • View Profile
Re: Developing a comprehensive editor for FF4
« Reply #521 on: November 21, 2013, 11:42:03 AM »
Well, diving into the ROM, the hex code appears to say exactly what the editor says it's saying according to my information.

A004B: 00 07 00 01 00 0B 00 0B FF

00 07 = Cast spell 7 (Slow)
00 01 = Cast spell 1 (Hold)
00 0B = Cast spell 11 (White)
00 0B = Cast spell 11 (White)
FF = End script

A005D: 00 2F 00 0C FF

00 2F = Cast spell 31 (Meteo)
00 0C = Cast spell 12 (Dummy / Dispel)
FF = End script

Unless there's something special about those indexes, it's being parsed correctly.

 :edit: Wait I see what's happening now. It's writing over Golbez' script code. It doesn't know how to read the Golbez scripts and doesn't even acknowledge their existence and just goes ahead and computes what it thinks is the correct place to put the "next" autobattle, which is right over top of where the Golbez script should be. Ok at least I know what to do now.


These are 2 part scripts of some sort. The code accesses the last two auto battle scripts in 2 parts separated by a terminator (FF) and stores the first part starting at address $388C, and the second part starting at address $389A. Here's the relevant code:

Code: [Select]
03/8985: B7 80        LDA [$80],Y   ;Load auto battle script
03/8987: 9D 8C 38     STA $388C,X   ;And save
03/898A: C8           INY
03/898B: E8           INX
03/898C: C9 FF        CMP #$FF      ;End of script?
03/898E: D0 F5        BNE $8985     ;No, branch
03/8990: A5 84        LDA $84       ;Script number
03/8992: C9 0C        CMP #$0C      ;Next to last?
03/8994: F0 04        BEQ $899A     ;Yes, branch
03/8996: C9 0E        CMP #$0E      ;Last?
03/8998: D0 15        BNE $89AF     ;No, branch
03/899A: 7B           TDC
03/899B: AA           TAX
03/899C: B7 80        LDA [$80],Y   ;Continue on past the first FF byte
03/899E: 9D 9A 38     STA $389A,X
03/89A1: C8           INY
03/89A2: E8           INX
03/89A3: C9 FF        CMP #$FF      ;Second terminator reached?
03/89A5: D0 F5        BNE $899C     ;No, branch

I believe the script parser is at 03/8ED6 although I haven't gotten to that yet...

 :edit:

My mistake, I believe the parser is at 03/A4E9
« Last Edit: November 21, 2013, 12:35:15 PM by Displacer »

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,682
    • View Profile
Re: Developing a comprehensive editor for FF4
« Reply #522 on: November 21, 2013, 03:46:40 PM »
Hey Displacer! It has been a while since I've seen you around, welcome back. It seems you have that AI business well in hand.

Displacer

  • FF4 Hacker
  • *
  • Posts: 27
    • View Profile
Re: Developing a comprehensive editor for FF4
« Reply #523 on: November 23, 2013, 08:36:49 AM »
Yea, had a lot going on with that pesky real life stuff.

Unfortunately the power went out yesterday at my house and I've lost 3 days worth of work on this. I've since added a auto backup plugin to notepad++, that will keep it safe from here on but my changes for the last 3 days (and there were a lot) are lost, and it was a lot of work too.

Let that be a lesson for all of you. Get the backup plugin. There is a auto save plugin but seeing how reverse engineering is all about guesses, then verifying them, making changes, then making them again several times, just the auto save may cause you issues too. The auto backup saves individual copies of your work with timestamps so you can go back to any point. The one you want is Autosave2 in the plugin manager. Set the backup directory to a different one than the default directory then you'll have backups of backups, etc.

At any rate I was going to post a whole bunch of findings, but not now :(

Now if you'll excuse me, I'm going to go lay down in a dark corner and cry

LordGarmonde

  • Baigan
  • *
  • Posts: 271
  • Gender: Male
  • "Power only breeds war..."
    • View Profile
Re: Developing a comprehensive editor for FF4
« Reply #524 on: November 24, 2013, 10:51:24 AM »
Hi. Go easy on me this is my first time...

First off: You are all my heroes. I love FF4 and I've picked at it over the years but this site and the editors and research you've done rivals the work of every scientist I've ever worked with.

That said I hope to keep on with my own projects because it's so much fun breathing life anew into this game. Hopefully this is a new contribution and if not please point my noobness in the right direction. I've been working with Yousei's map editor and PinkPuff's (amazing!) program to mess around with the events surrounding Mist; particularly in regard to how it changes the world map. Going from Yousei's  documentation I found:

AC8FA-      (15C6FA-      ) Routine that alters overworld map depending on events

With that in mind I looked at the events (Phoenix rocks!) and found:

FD 04           Play visual effect 04

This is obviously the earthquake cutscene. I wouldn't have thought that in there was the call that changes the overworld and I was right. You can take that call out (and remove the toggle fade to black because that's a counter to a built in fade to black in play VE 4) and the map still changes. It's tied into the later:

F2 0E           Set event flag 0E

This is the kill event for Mist which makes sense and I verified by trial and error and through checking the triggers in ff4kster (last trigger in Mist). That would say to me that just like the Mist trigger there is something in the overworld code that looks for flag 0E but I can't find it. I took a whole sections from AC8FA to B6D53 replacing every 0E with 0D and checking if killing the Mist Dragon changed the map instead: no good.

I'm going to keep looking, because what I want in the end if for the map to change but not into just mountains: I want a pass to run north to south. I'm sure I'll find it eventually through innovation or more likely through time and sheer force of will; but I'm certainly interested to hear any insights people have. Also of note is there is a similar call associated with Event Flag 30 being toggled on/off to set the hole to the underworld - I'm investigating that as well.  :cybez:
« Last Edit: November 24, 2013, 11:16:42 AM by LordGarmonde »
"Now I know; and knowing makes it even more confusing..."