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

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,676
    • View Profile
Re: Developing a comprehensive editor for FF4
« Reply #180 on: January 01, 2013, 11:28:13 AM »
So, did this turn out to be related to the dancer/dress thing? Or does something similar happen with other NPCs as well?

Yes, as it turns out there's something odd going on here, changing NPC's seems to be fairly unstable but now that I think on it... is it possible that maps have "sprite limits"? In that you can only have so many NPC's of differing types before the game chooses what it will and won't load? Maybe that's what's going on here... However for Baron Town, every NPC that wanders around has a different sprite from one another, so that's likely not it.

Another thought is that do different event calls have different hex lengths? For instance if I were to switch the normal guard in front of the Training Room from Message 1 to... for fun, Zeromus Event (doesn't even work on Overworld map and comes up with a completely different formation) does that alter any lengths that may be throwing off the proceeding Placement spot? I'll have to continue to test  to get to the bottom of this.



:edit: Oh, how interesting. I was wondering why there appeared to be "incorrect" values and so many mentions of Tellah Joining at the Watery Cave, but now I see that's because it's loading an NPC, not an object that is Unique to that particular map, turns out I was looking at Tellah.

Good work deciphering that PinkPuff. Maybe that's what always confused me about NPC's, I never realized that it was in a different format, so to speak from other event matters.

Quote
I have to be perfectly honest... I have no idea what you mean here...

I should have been clearer here... I had only meant to say that I did not realize that Placement Spots are just that, placement spots for NPC values. As I thought that the NPC's were tied to that spot in data. Not elsewhere in data and so when you come across a Party Member Placement Spot, they will often if not always have their "You talked directly to them" events. Tied to their NPC themselves rather than anything dealing with their position in the map. That's all I meant by it.



:edit: 3 Is this a preview of the Text Editor portion PinkPuff? If so it looks pretty good!

Quote
:whoa: Ah I forgot to disable it! Oh well that's fine, I guess it'll serve as a little teaser for what's in store in the hopefully near future!
The previews seem to be mostly working (the combat ones aren't displaying things like name references correctly yet), so I need to fix up those a little, and then I'll be working on creating a component for entering multiline text such as the regular game dialogue on the map. It'll probably be similar to the existing "small" text input except with a visible, moveable cursor and a much larger box, and the ability to insert references to things such as character names or song-playing commands.

That's good to see, because one of the obvious issues I saw with it was the inability to move the cursor.

Oh yes, one more suggestion. Could you input the name table for Sprite Numbers? Since the list we have is in Hex and the one you input was numerical it gets a little confusing telling which sprite is which without some calculation on part of the user.


 :edit: Yes, there appears to be something quite wrong here. I changed only the Placement 3 NPC's Message 0 to "Finding Odin before Land of Summon Monsters" and it was clear that things weren't quite right. The old man who talks about the Sword of the Dark Side vanished and the Lock on the Old Waterway was also gone. The Lock on the Waterway is the first Placement while the old man is the 4th placement. Trying to change it back causes another host of problems.

To see the problem for yourself I suggest changing the 3rd Placement's NPC Message 0 event to another event and see what occurs.
« Last Edit: January 01, 2013, 11:47:15 AM by Grimoire LD »

Pinkpuff

  • Flan Princess
  • *
  • Posts: 923
  • Find a Megalixir in Unprecedented Crisis!
    • View Profile
Re: Developing a comprehensive editor for FF4
« Reply #181 on: January 02, 2013, 04:54:33 AM »
Oh yes, one more suggestion. Could you input the name table for Sprite Numbers? Since the list we have is in Hex and the one you input was numerical it gets a little confusing telling which sprite is which without some calculation on part of the user.

I'm planning on creating a config file for naming the sprites, NPCs (though probably not the placements), and flags.

:edit: Yes, there appears to be something quite wrong here. I changed only the Placement 3 NPC's Message 0 to "Finding Odin before Land of Summon Monsters" and it was clear that things weren't quite right. The old man who talks about the Sword of the Dark Side vanished and the Lock on the Old Waterway was also gone. The Lock on the Waterway is the first Placement while the old man is the 4th placement. Trying to change it back causes another host of problems.

To see the problem for yourself I suggest changing the 3rd Placement's NPC Message 0 event to another event and see what occurs.

I did exactly what you suggested and it worked perfectly. I talked to the buddy and the screen flashed and Cecil was like "... your majesty?" and the event played out just like it should and no one disappeared.

Are you sure you're using a headered 1.1 rom?
Let's dance!

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,676
    • View Profile
Re: Developing a comprehensive editor for FF4
« Reply #182 on: January 02, 2013, 10:22:53 AM »
Hmm, I'm using the Rom I've been using all of this time... maybe it's just a bit too dirty now? Let me try on a clean 1.1 Headered Rom.

Bah, what a shame. It seemed it was my Rom. Which means all the work I had done is now rendered obsolete, since there's no way I can tell when the corruption started or what had caused it.

I had recalculated everyone's levels and stats as well as altered all equipment, but alas. Looks like I have to start fresh.

 :edit: For a test I restored the original first dancer's dance. Looks like all they did was change the initial sprite to the dancer and made the Dress sprite into a blank sprite, pretty much as Dragonsbrethren suggested.

 :edit: 2 Since it seems that we're getting into the nitty gritty of the game's system. I think I'll list a number of non-essential events that can be safely replaced which are not important to the story as well as sprites that bear little on the game. I will also list their Trigger number and location for touch events.

Behemoth Battle 51 (Trigger 4 in Bahamut's Cave 2F)
Behemoth Battle 52 (Trigger 1 in Bahamut's Cave Bahamut's Floor)
Hummingways
Namingway
OUCH!
Cecil's Maid
Item Selection - Soft
Finding Odin before Feymarch (Trigger 1 in Baron Castle Odin's Room)
Devil's Road is sealed  (Trigger 2 in Baron Devil's Road)
Staying at a 50 GP Inn (You could honestly only have one, all same  have the screen go black, let the music play and reappear in front of Innkeeper the rest of it is just little niceties which aren't really necessary)
Staying at a 800 GP Inn
The current is too strong for us to get in! (Not necessary)
Giott: Open the Door! (I don't believe this is even used in its normal event)
Fallen soldier in Damcyan's basement (sad, but not necessary)
Staying at a 100 GP Inn
WA! (Not sure where this is even used)
Being poisoned by bartender in Mysidia (Mysidia events, while amusing, aren't necessary)
Staying at a 200 GP Inn
Speaking to White Mage in Mysidia
Being turned into a Toad by a Black Mage
Resting for free in Fabul (Trigger 3 in Fabul King's Room) (The Cecil bed can be used for that)
Staying at a 400 GP Inn
HP Restoring Pot
MP Restoring Pot
Being turned Mini in Baron's Classroom
Staying at a 1600 GP Inn
Staying at a 3200 GP Inn
Staying at a 6400 GP Inn
Staying at a 12800 GP Inn
Baron Dancer's Dance
Kaipo Dancer's Dance
Fabul Dancer's Dance
Agart Dancer's Dance
Mysidia Dancer's Dance
Baron Dancer's Dancer after killing Cagnazzo
Mythril 3 Dancer's Dance
Toroia Dance Troupe's Dance
Dwarf Castle Dancer's Dance
Reading the Magazine
Obtaining the Magazine
Obtaining a Grimoire 6C
Obtaining a Grimoire 6D
Trading the Pink Tail for Adamant Armor
Do you have a pass?
Watery Pass - North exiting message (Trigger 7 in Watery Pass 5F)
Behemoth Battle 50 (Trigger 0 in Bahamut's Cave Bahamut's Floor)
Obtaining a Grimoire 91
Viewing the Moon through the telescope


There may be a few more, but that should free up quite an amount of new events for people to use.



 :edit: 3 Oh here's something interesting! It seems as if at one time Tomra NPC's were meant to have more than one line of text, since they have 3 events (like the Baron NPC's) but their unused message banks appear to be blank.

Here's a real oddity, Kainazzo's sprite is apparently in Tomra, but invisible  at X 28/Y 22, how bizarre and if this is to be believed there's an untriggered shop inside of Tomra's main map apparently with the sprite of a Woman shopkeeper.


Wait a second... I think the Underworld is screwed up. Everything seems off slightly. For instance... there is no Baron Dancer in Tomra's Inn or a host other oddities that seem to crop up in the Underworld triggers.

 :edit: 4 It does appear that there are some serious problems with adding and removing Placements. Adding is fine, except it seems it will take some Placements from other maps (I have no idea how that works or why it works like that) however even on a clean rom it will cause the issues I referred to in my previous post.

 :edit: 5 Well this is probably obvious but it is news to me. The "objects" that are activated/deactivated according to events are actually the NPC number. If you go to Mist Events and Pg Dn to the end you'll see a Deactivate Object 200, which is deactivating Rydia's Dead Mother NPC which is NPC 200. That solves that mystery (for me at least).
« Last Edit: January 03, 2013, 12:52:51 AM by Grimoire LD »

Pinkpuff

  • Flan Princess
  • *
  • Posts: 923
  • Find a Megalixir in Unprecedented Crisis!
    • View Profile
Re: Developing a comprehensive editor for FF4
« Reply #183 on: January 03, 2013, 07:04:10 AM »
Bah, what a shame. It seemed it was my Rom. Which means all the work I had done is now rendered obsolete, since there's no way I can tell when the corruption started or what had caused it.

I had recalculated everyone's levels and stats as well as altered all equipment, but alas. Looks like I have to start fresh.

Sorry about that, but with an editor-in-development you gotta expect that kind of thing to happen from time to time. I'd try not to commit too heavily to anything until it's a little more stable. Actually what I've been doing is just sort of jotting down ideas for what I want to do with a hack that will show off all the capabilities of the editor once it's done, and then once it's "done" (a version number starting with 1 instead of 0) I'll start actually committing to making the hack. While the editor is in development I'll just be testing various corner cases here and there.

:edit: 2 Since it seems that we're getting into the nitty gritty of the game's system. I think I'll list a number of non-essential events that can be safely replaced which are not important to the story as well as sprites that bear little on the game. I will also list their Trigger number and location for touch events.

Thanks! This will definitely be useful for people wanting to add to the events.

Wait a second... I think the Underworld is screwed up. Everything seems off slightly. For instance... there is no Baron Dancer in Tomra's Inn or a host other oddities that seem to crop up in the Underworld triggers.

You're right, the underworld does appear to be messed up. What's even stranger is that the messed up data does seem to match what's in Phoenix's doc, and what's in the hex code in the rom!!
I have no idea what to do with this right now...  :sad:

:edit: 4 It does appear that there are some serious problems with adding and removing Placements. Adding is fine, except it seems it will take some Placements from other maps (I have no idea how that works or why it works like that) however even on a clean rom it will cause the issues I referred to in my previous post.

Do you mean guys disappearing, like the old man and the locked door? If so, that isn't happening for me. I deleted someone from Baron Town and it didn't affect anything else in Baron Town; I then loaded a save near Kaipo and it didn't affect anyone there either as far as I could tell. In addition I tried adding an NPC to Baron Town and, while the NPC I added failed to appear ( :edit: I tried adding a different NPC and it appeared correctly; probably the other one needed to be "activated"?), it did not seem to affect any other maps. What exactly did you change and what maps did it affect?

:edit: 5 Well this is probably obvious but it is news to me. The "objects" that are activated/deactivated according to events are actually the NPC number. If you go to Mist Events and Pg Dn to the end you'll see a Deactivate Object 200, which is deactivating Rydia's Dead Mother NPC which is NPC 200. That solves that mystery (for me at least).

Good catch, thanks! I'll update the config file and once I've created a config file for NPC labels I'll add it to the event editor.
Let's dance!

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,676
    • View Profile
Re: Developing a comprehensive editor for FF4
« Reply #184 on: January 03, 2013, 11:46:01 AM »

Sorry about that, but with an editor-in-development you gotta expect that kind of thing to happen from time to time. I'd try not to commit too heavily to anything until it's a little more stable. Actually what I've been doing is just sort of jotting down ideas for what I want to do with a hack that will show off all the capabilities of the editor once it's done, and then once it's "done" (a version number starting with 1 instead of 0) I'll start actually committing to making the hack. While the editor is in development I'll just be testing various corner cases here and there.

That's not a bad idea. Yeah I got over ambitious, it's likely best to just write down what I want to do in a broad aspect before committing to it with an in-progress editor. Ah yes, I was curious to know if Overworld triggers were going to be added eventually? They seem to be the one thing missing from this as of now, in terms of triggers.


Wait a second... I think the Underworld is screwed up. Everything seems off slightly. For instance... there is no Baron Dancer in Tomra's Inn or a host other oddities that seem to crop up in the Underworld triggers.

You're right, the underworld does appear to be messed up. What's even stranger is that the messed up data does seem to match what's in Phoenix's doc, and what's in the hex code in the rom!!
I have no idea what to do with this right now...  :sad:

It honestly seems like everything is off by just a little bit, maybe only a byte or two. I have no idea what bearing that has. Exactly where is this data in ROM? I could hunt it down and see what the values should read.


Do you mean guys disappearing, like the old man and the locked door? If so, that isn't happening for me. I deleted someone from Baron Town and it didn't affect anything else in Baron Town; I then loaded a save near Kaipo and it didn't affect anyone there either as far as I could tell. In addition I tried adding an NPC to Baron Town and, while the NPC I added failed to appear ( :edit: I tried adding a different NPC and it appeared correctly; probably the other one needed to be "activated"?), it did not seem to affect any other maps. What exactly did you change and what maps did it affect?

I added a White Mage to Baron as Placement 12, and then went to Mist and saw that all of the NPC's were gone except for one and the shopkeepers were missing. Since I warped into Mist before Mist events this included Rydia and her mother not being there either. I can't recall the NPC number I set though, but I believe they only had one event attached to them. Then I deleted the Placement and many of the NPC's in Baron disappeared.

:edit: 5 Well this is probably obvious but it is news to me. The "objects" that are activated/deactivated according to events are actually the NPC number. If you go to Mist Events and Pg Dn to the end you'll see a Deactivate Object 200, which is deactivating Rydia's Dead Mother NPC which is NPC 200. That solves that mystery (for me at least).

Good catch, thanks! I'll update the config file and once I've created a config file for NPC labels I'll add it to the event editor.

Ah very nice. That will help keep track of which NPC belongs to which events and all of that.
« Last Edit: January 03, 2013, 12:43:46 PM by Grimoire LD »

Pinkpuff

  • Flan Princess
  • *
  • Posts: 923
  • Find a Megalixir in Unprecedented Crisis!
    • View Profile
Re: Developing a comprehensive editor for FF4
« Reply #185 on: January 03, 2013, 03:23:08 PM »
That's not a bad idea. Yeah I got over ambitious, it's likely best to just write down what I want to do in a broad aspect before committing to it with an in-progress editor. Ah yes, I was curious to know if Overworld triggers were going to be added eventually? They seem to be the one thing missing from this as of now, in terms of triggers.

I know some people were talking about that but I don't have a doc on it. If I can figure it out enough from the forum posts to be able to get it working then it's definitely something I'd like to include!

It honestly seems like everything is off by just a little bit, maybe only a byte or two. I have no idea what bearing that has. Exactly where is this data in ROM? I could hunt it down and see what the values should read.

I'm sure this doc is already here somewhere but I'll attach it for convenience anyway. It explains how to read the data, and lists it all.

I added a White Mage to Baron as Placement 12, and then went to Mist and saw that all of the NPC's were gone except for one and the shopkeepers were missing. Since I warped into Mist before Mist events this included Rydia and her mother not being there either. I can't recall the NPC number I set though, but I believe they only had one event attached to them. Then I deleted the Placement and many of the NPC's in Baron disappeared.

Ok, I added a new NPC placement (Placement 12) to Baron Town, it worked just fine. I then walked to Mist (didn't teleport) and the Mist events played out correctly. I then redirected the teleporter in Kaipo that would normally take you to the training room to instead take you to Mist. It worked fine, everyone was there and seemed to behave/speak correctly. I deleted the extra placement and everything still worked correctly. No one disappeared, and Mist was still unaffected.

Unfortunately I can't fix a bug if I can't reproduce it... perhaps someone else can try it and report what happens?
Let's dance!

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,676
    • View Profile
Re: Developing a comprehensive editor for FF4
« Reply #186 on: January 03, 2013, 04:27:05 PM »
That's not a bad idea. Yeah I got over ambitious, it's likely best to just write down what I want to do in a broad aspect before committing to it with an in-progress editor. Ah yes, I was curious to know if Overworld triggers were going to be added eventually? They seem to be the one thing missing from this as of now, in terms of triggers.
I know some people were talking about that but I don't have a doc on it. If I can figure it out enough from the forum posts to be able to get it working then it's definitely something I'd like to include!

 Hmm, I might take a look over the course of the next week, but by all means go ahead with the search.

It honestly seems like everything is off by just a little bit, maybe only a byte or two. I have no idea what bearing that has. Exactly where is this data in ROM? I could hunt it down and see what the values should read.

I'm sure this doc is already here somewhere but I'll attach it for convenience anyway. It explains how to read the data, and lists it all.

Thanks. No, looks like there are no miscalculations in that documentsbut there's one thing I noticed while browsing through NPC's... The Underworld events aren't there. As with everything else it seems there's a separate index for Underworld NPCs. That would appear to be the one and only issue in that regard.



I added a White Mage to Baron as Placement 12, and then went to Mist and saw that all of the NPC's were gone except for one and the shopkeepers were missing. Since I warped into Mist before Mist events this included Rydia and her mother not being there either. I can't recall the NPC number I set though, but I believe they only had one event attached to them. Then I deleted the Placement and many of the NPC's in Baron disappeared.

Ok, I added a new NPC placement (Placement 12) to Baron Town, it worked just fine. I then walked to Mist (didn't teleport) and the Mist events played out correctly. I then redirected the teleporter in Kaipo that would normally take you to the training room to instead take you to Mist. It worked fine, everyone was there and seemed to behave/speak correctly. I deleted the extra placement and everything still worked correctly. No one disappeared, and Mist was still unaffected.

Unfortunately I can't fix a bug if I can't reproduce it... perhaps someone else can try it and report what happens?

Yes, I have no clue what could be causing this. Obviously we have the same version since the NPC Placement notes took me to the exact same values, so I'm still unsure what is causing this, or if it's something I'm doing wrong, hmm...

Dragonsbrethren

  • Forum Overlord
  • *
  • Posts: 1,820
    • View Profile
    • Dragonsbrethren Industries
Re: Developing a comprehensive editor for FF4
« Reply #187 on: January 03, 2013, 07:50:03 PM »
I'm having missing NPC issues as well. No reproduction steps yet; I'll start fresh with a clean ROM and see if I can figure something out.

Dragonsbrethren

  • Forum Overlord
  • *
  • Posts: 1,820
    • View Profile
    • Dragonsbrethren Industries
Re: Developing a comprehensive editor for FF4
« Reply #188 on: January 04, 2013, 12:20:20 PM »
Okay, it seems just opening the ROM in the editor is enough to cause this corruption. Do the following:

1. Open a clean headered FF2 1.1 ROM.
2. Hit the save ROM option without doing anything else in the editor.
3. Start a new game, observe the results. They become most apparent as Baigan walks Cecil through Baron Castle.

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,676
    • View Profile
Re: Developing a comprehensive editor for FF4
« Reply #189 on: January 04, 2013, 12:45:21 PM »
Wow, you're right. What's even stranger is in the Mysidia flashback, Cecil puts Back the Crystal of Water while an invisible Elder questions him.

The guard that opens the door for Cecil is absent.

Whoa. Um... Stoned Porom statue, Yang In the Doorway leading to the Throne Room. Blue colored officer already in front of the door.

 Yang in the middle of the Throne Room.

Cagnazzo sitting on the throne with the King as well.

Wow, yeah some things are really screwed up here. Now that I think on it though it does seem mainly to involve Active vs. Inactive NPC's. As evidenced by Cecil putting back the Water Crystal.

Pinkpuff

  • Flan Princess
  • *
  • Posts: 923
  • Find a Megalixir in Unprecedented Crisis!
    • View Profile
Re: Developing a comprehensive editor for FF4
« Reply #190 on: January 05, 2013, 06:32:46 AM »
Aha, starting a new game did the trick! I'm also getting the messed up intro. Prior to this I had been loading a save file after the intro in order to save time; it never occurred to me that there might be something in the opening causing it.

This is most interesting... presumably something is likely wrong with the NPC placement saving routine. I have a couple of plausible hypotheses:
  • It could be that the list is being padded/bloated somehow and inadvertently bleeding into another data area  :edit: It's not
  • There are some "unknown" bits in the NPC placements that I might be writing incorrectly.  :edit: There was something wrong here but I fixed it and it still didn't fix the problem

Anyway I'll toy with it and let you know if I make any progress...

 :edit:
After comparing the unmodified rom with the load-immediately-save rom side by side in a hex editor, the only difference in the NPC placement area that I can tell is with the dark world placements. Even then, although the data is not in the same order as it was in the original rom, the pointers have been modified to compensate and are correct as far as I can tell (and logically shouldn't be relevant, as the intro takes place entirely in upper-world maps if I'm not mistaken, which come before the underworld maps). I'm going to try a few more experiments to see if I can narrow down the source of the behaviour.

 :edit:
Ok I found the problem; it wasn't with the placements at all. There's a matrix encoding the initial visibility of each individual NPC which was being written incorrectly. It appears to be working now. I made a fresh copy of the rom, loaded it in ff4kster, saved, started a new game, everything appeared as it should; elder, crystal, porom, yang, everything was as it should be. Anyway the fixed version is up on the timecave so feel free to redownload.
« Last Edit: January 05, 2013, 07:32:53 AM by Pinkpuff »
Let's dance!

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,676
    • View Profile
Re: Developing a comprehensive editor for FF4
« Reply #191 on: January 05, 2013, 10:38:42 AM »
Wonderful! What ever you did you also fixed my original project rom! So everything seemed to work fine, I even included another NPC to Baron and flew to Mist and all of the proper NPC's showed up there as well (once the Mist events had taken place). Looks like that did the trick.

Now my next question is do you have any leads to the NPC location of the Underworld NPC's? I would imagine they would follow right after the Overworld NPC's. But I'm not entirely sure where that is located itself.

Pinkpuff

  • Flan Princess
  • *
  • Posts: 923
  • Find a Megalixir in Unprecedented Crisis!
    • View Profile
Re: Developing a comprehensive editor for FF4
« Reply #192 on: January 05, 2013, 12:31:00 PM »
Ok I fixed the problem with the underground NPCs being previewed as overworld ones. Re-download and let me know if there are still problems.
Let's dance!

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,676
    • View Profile
Re: Developing a comprehensive editor for FF4
« Reply #193 on: January 06, 2013, 01:42:23 PM »
Just got home from prior business, I am curious to know if all 255 NPC slots for the Underworld are used...

 :edit: Hmm, this is interesting. I know this isn't an issue with the editor, but there are a lot of Placements with NPC's without messages in the Smithy's House (outside) map. They all appear to be House of Wishes NPC's, but I can't figure out why they would have no message attached to them, or why they are considered to be in the Smith's House outside map. Something with the Zeromus battle, maybe?

« Last Edit: January 06, 2013, 01:58:25 PM by Grimoire LD »

Dragonsbrethren

  • Forum Overlord
  • *
  • Posts: 1,820
    • View Profile
    • Dragonsbrethren Industries
Re: Developing a comprehensive editor for FF4
« Reply #194 on: January 06, 2013, 03:58:09 PM »
Yeah, those look like the NPCs used in the ending. The ones for the other scenes are stored on other underworld maps.