Qhimm.com Forums

Miscellaneous Forums => Scripting and Reverse Engineering => Topic started by: Gingercat on 2012-06-30 01:21:49

Title: Fixing the Jersey Bug (FF7): An Idea
Post by: Gingercat on 2012-06-30 01:21:49
I've always been puzzled as to precisely why the Jersey enemy never switches back and forth between its forms. It's always been described as "a bug", never specifically WHAT bug. Reading the AI code recently on the wiki, I saw exactly what the bug is:

AI: Counter - Magical {

    If (Jersey's IdleAnim == Flinch (Lean-to-Left)) Then
    {

(etc)

Whereas the "Physical" counter above it specifies:
AI: Counter - Physical {

    If (Jersey's IdleAnim == Lean-to-Right) Then
    {

(etc)

So the "bug" is evidently the programmer having a Homer moment and putting "Flinch" in there where it doesn't belong.

Is there an easy way to patch this in the enemy AI scripts so that this enemy behaves as intended, and is a bit more of a challenge? :) (I've been reading some of the AI coding topics but it looks like knowledge of direct memory patching is required, unless I'm having a Homer moment myself...)
Title: Re: Fixing the Jersey Bug (FF7): An Idea
Post by: Bosola on 2012-06-30 16:56:52
Quote
So the "bug" is evidently the programmer having a Homer moment and putting "Flinch" in there where it doesn't belong

Ish, but a bit of a simplification. The bug is that the Counter:MagicCounter script is looking for an idle animation index of 0x08 when the physical counter sets an index of 0x08 only on the flinch animation  - the idle animation is set to 0x07 instead. The developer probably just got the two numbers confused. Chances are, he was working in assembler rather than a high-level language, in which case he didn't really "put a flinch in there" because there was likely no high level language (like that reverse you posted) to begin with.

You can fix the AI by changing the contents of the SCENE.BIN resource. NFITC1's Proud Clod tool makes it relatively simple. Go to Jersey's Counter:MagicCounter and replace the contents of 0x007 (60 , 08) with (60, 07).

Also, I see FFWiki are wholesale copying Terrence Fergusson's scripts from his Enemy Mechanics guide. I do hope they're crediting him somewhere.
Title: Re: Fixing the Jersey Bug (FF7): An Idea
Post by: DLPB_ on 2012-07-01 02:13:13
ffwiki's maintainers are an arrogant bunch.  They refused to credit me for something trivial so I doubt they are crediting him.
Title: Re: Fixing the Jersey Bug (FF7): An Idea
Post by: Gingercat on 2012-07-01 02:20:34
Bosola: An oversimplification by me, I admit, but your reply is exactly what I'm looking for. You and the team are geniuses!

Thanks for the quick reply.
Title: Re: Fixing the Jersey Bug (FF7): An Idea
Post by: Bosola on 2012-07-01 18:53:52
Not a problem. Do let us know if you have any further trouble.