Aslickproductions.org/forum/index.php?PHPSESSID=5f0fck550j2m4m2fpbtkj2vkm1&topic=124.0;prev_next=nexte:/My Web Sites/Slick Productions - FFIV Message Board/slickproductions.org/forum/index58e4.htmldelayedslickproductions.org/forum/index.php?PHPSESSID=5f0fck550j2m4m2fpbtkj2vkm1&topic=124.0e:/My Web Sites/Slick Productions - FFIV Message Board/slickproductions.org/forum/index58e4.html.zx1ag^@>^OKtext/htmlISO-8859-1gzip8:^HTue, 10 Mar 2020 09:59:37 GMT0 0P1ag^^ FF4/FF4A - The Lunar Dragon Code Fail

Author Topic: FF4/FF4A - The Lunar Dragon Code Fail  (Read 1979 times)

Deathlike2

  • Moderator
  • *
  • Posts: 3,538
  • I'm looking at you, bitch!
    • View Profile
FF4/FF4A - The Lunar Dragon Code Fail
« on: March 02, 2012, 07:15:14 PM »
Does anyone watch the AVGN? Where does my rage begin?  :finger:

So, I was working on releasing a hack/patch for those that wanted to integrate Steal and Throw into their code. Of course the problem with working with that code that there's a very limited space in the code to add it in, so I had to create two separate patches. Unfortunately, it would be difficult to demonstrate without those commands available immediately to you, but I don't have the time to make it easy on you. Axing a lot of the useless states (mostly for Rubicante's Fire for Life is a wasted proposition) was needed in my hack...

Anyways, I had to create a headerless patch, since FF4ET by "distribution" seems to come w/o a header. That's an easy fix, so I opened up FF4ET, and apparently I was wrong on that. There were some changes in the section of code I worked with and it makes a lot of sense... FF4ET did change a few things, particularly for the Moon.

I was trying to compare the two and found something different... apparently enemy condition code 16 was changed in FF4ET. I did not even know when it was used, but apparently it was limited to one monster in FF4 (and not FF4ET), the Lunar Dragon. Also, the definition of this code was "if condition flag is 00 and physically attacked by a character". It's generally redundant since condition flag 0 usually implies that the battle is starting, which is its initial state. You can easily work around that... but anyways, the real reason for this thread is because of the Lunar Dragon.

This leads me to enemy attack group set B3, the counter listings for the Lunar Dragon. So, here's a breakdown of this monster battle script (remember, this monster is deployed in a pair):
If condition flag = 1, cast Bio on other random monster in battle.
Otherwise, attack once, cast Flame (target's maxHP fire elemental attack), attack 3 times, Cast Breath on all targets, then repeat.

Counters:
If attacked by Summon magic, heal self.
If condition flag is 0 and physically attacked, Cast Wall/Reflect on all monsters, set condition flag = 1.
If alone, cast Flame.

Pretty simple right? Do you see the flaw in this code?

When the monster is out of Reflect status, they will keep casting Bio on each other. This doesn't hurt in FF4 since their Magic Defense is maxed out. It hurts a lot in FF2 (both versions) since that is reduced. What you end up seeing is that the monsters eventually kill themselves for the most part. The worst part of this is that it "appears" that the sole surviving Lunar Dragon decides to do nothing, but the reality is that there's no other living monster to target! It ends up doing nothing unless you attack it. This includes the act of Stealing (which is kinda surprising, but it shouldn't be).

 :edit: Fixed script.

Well, FF4ET fixes this. I need to verify the code, but it looks a lot like this.
Basic battle behavior:
If alone, Cast Quake (monster ver) twice, Cast Breath, Repeat.
If self has Reflect status, Cast Bio on other random monster
Otherwise, Set condition flag = 1, Cast Flame 4 times, then Cast Breath, Repeat.

Counter:
If attacked by Summon magic, heal self.
If attacked physically and condition flag = 1, Cast Wall/Refect and set condition flag = 0 (this might not be in the counter section)
If attacked magically, Attack.

I need to confirm the condition bits unfortunately, but that's the closest as I was able to get.

 :edit:
So, in FF4ET, it fixes the problems the original had. The monster will run something useful while alone, and it relies on the Reflect status to carry out its Bio attacks. Ingenius right? Unfortunately FF4A didn't copy this.

To be edited in the near future: How FF4A fucks this up and updating the FF4ET info.

 :edit:

This is how FF4A fucks this up...

FF4A Lunar Dragon's battle script:
If alone, cast Flame.
If condition flag = 1, cast Bio on other random monster in battle.
Otherwise, attack once, cast Flame (target's maxHP fire elemental attack), attack 3 times, Cast Breath on all targets, then repeat.

Counters:
If attacked by Summon magic, heal self.
If condition flag is 0 and physically attacked, Cast Wall/Reflect on all monsters, set condition flag = 1.

So now, it looks like we may have fixed said bug. Move it from the counter to being part of the main battle script should fix that right???
I don't think this is the exact code changes, but on paper it should operate close to the original w/o the bugs.

 :finger: Hell no, it's not fixed.

What happens:
The condition that Bio is to be used against the other keeps running. The condition flag is never really unset. The morons who did the port didn't quite figure this out like Square did with FF4ET (use the Reflect status conditional). However... it's worse than that.
Each monster seems to hold the condition variable separately. Why that seems to operate like that is anyone's guess... While one monster is doing Reflect and multi-Bio, the other one is operating on the base script. OK, I guess that's a nuance, but technically that's not what the original did at all. This is not the worst of it.
If you attack the same monster a second time, it manages to lose the ability to heal itself when it encounters Summon magic. I don't know how they are coding this, but my guess is that the condition flag is actually being incremented instead of being set to the value 1 (incrementing the condition flag was possible, the most notable example is the Octomammoth monster). There may have been two conditions where Summon and the condition flag were checked (where it was 0 and 1)... just not anything above 1.

Note: My last point could be wrong, but someone would need to decipher the FF4A battle code first to make better understanding of this fail.

It is truly amazing how the same game truly poops on itself with its own code. I can only aspire to whine at such mediocre port coding and poking fun at the really bad translation of the old battle code to the new one... Who the hell does proper Q&A on this stuff? I guess I'll never know.
« Last Edit: March 03, 2012, 01:30:09 AM by Deathlike2 »
Working on the next Yet To Be Named FF4 "Hardtype" Hack Download Latest: v1.48

Video Demos: #1 #2 #3

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,684
    • View Profile
Re: FF4/FF4A - The Lunar Dragon Code Fail
« Reply #1 on: April 30, 2012, 05:58:35 PM »
That was pretty interesting actually. I don't recall any monster doing those weird actions, are Lunar Dragons unused enemies?

Deathlike2

  • Moderator
  • *
  • Posts: 3,538
  • I'm looking at you, bitch!
    • View Profile
Re: FF4/FF4A - The Lunar Dragon Code Fail
« Reply #2 on: April 30, 2012, 07:19:39 PM »
They are exclusively used in the area of the Lunar Subterrane with the pair of Ribbons.
Working on the next Yet To Be Named FF4 "Hardtype" Hack Download Latest: v1.48

Video Demos: #1 #2 #3

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,684
    • View Profile
Re: FF4/FF4A - The Lunar Dragon Code Fail
« Reply #3 on: April 30, 2012, 09:12:38 PM »
Oh right! Those guys with like 15,000 HP. Count as Undead and go down really easily. I must have never really let them act out all of that stupidity due to how weak they are when you reach them.