øAslickproductions.org/forum/index.php?PHPSESSID=5f0fck550j2m4m2fpbtkj2vkm1&topic=580.msg4737e:/My Web Sites/Slick Productions - FFIV Message Board/slickproductions.org/forum/index893e.htmlslickproductions.org/forum/index.php?PHPSESSID=5f0fck550j2m4m2fpbtkj2vkm1&topic=580.0e:/My Web Sites/Slick Productions - FFIV Message Board/slickproductions.org/forum/index893e.html.zx)†g^ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÈÐÊlOKtext/htmlISO-8859-1gzip0|ÖÊlÿÿÿÿÿÿÿÿTue, 10 Mar 2020 12:37:19 GMT0ó°° ®0®P®€§²ð®(†g^ÿÿÿÿÿÿÿÿ·/Êl FF2 Battle Script That's Different Than FF4

Author Topic: FF2 Battle Script That's Different Than FF4  (Read 9695 times)

Deathlike2

  • Moderator
  • *
  • Posts: 3,538
  • I'm looking at you, bitch!
    • View Profile
FF2 Battle Script That's Different Than FF4
« on: June 02, 2008, 04:07:57 PM »
Believe it or not, most people have an ill-concieved notion that FF2's battle script is radically different than FF4 (I'll have a separate thread on FF4ET's battle scripts, just to point it out), but that's simply not the case. However, there is only one script that I know of that is actually different than the original game.

Check out the Last Arm's battle script:

FF2 and FF4ET:

Battle script 0x6F:
Code: [Select]
Always
    Cast Search ($90)
    (End of Turn)
    Cast Magnet ($81)
    (End of Turn)
    Cast Search ($90)
    (End of Turn)
    Cast Beam ($94)

Counter script 0xFB:
Code: [Select]
If Receives a Damage Counter
    Battle Message $76
    Cast Slap ($63)

Note: The parsed counter script is wrong.

It's more like this:
If current HP is lower than 1/8 (aka 2/16) of MaxHP, then cast Fission (this suicide attack that hits all targets equally the amount of HP left). In FF4A, Fission is changed to more of a single targeted Explode attack (someone fucking neutered this for some stupid reason). Amazing eh?

FF4 has it slightly different.

FF4:

Battle script 0x6F:
Code: [Select]
Always
    Cast タ-ゲッティング ($90)
    (End of Turn)
    Cast でんじば ($81)

Counter script 0xFB:
Code: [Select]
If Receives a Damage Counter
    Battle Message $76
    Cast ひらてうち ($63)

Note: The counter script is the same as the original (still parsed wrong, so it's the same reaction).

The only difference is the attack script, which doesn't do the extra targeting and Beam attack.

It's minor, and that's the only change AFAIK. In any case, 99% of the battle code is the same.
Working on the next Yet To Be Named FF4 "Hardtype" Hack Download Latest: v1.48

Video Demos: #1 #2 #3

Phoenix

  • FF4 Hacker
  • *
  • Posts: 456
    • View Profile
    • Phoenix Hacks
Re: FF2 Battle Script That's Different Than FF4
« Reply #1 on: June 02, 2008, 05:30:13 PM »
Quote
If current HP is lower than 1/8 (aka 2/16) of MaxHP

To be exact, the reaction script is "if takes HP damage and HP is less than 1,000, cast Fission."

That's really the only battle script that's changed? That's kind of amazing, considering all the other changes they made. I guess there's no reason why they had to change the scripts, I just assumed they had changed more. What about changing the value of or completely removing a script, like Milon Z.'s Dullsong counter to fire spells?

Deathlike2

  • Moderator
  • *
  • Posts: 3,538
  • I'm looking at you, bitch!
    • View Profile
Re: FF2 Battle Script That's Different Than FF4
« Reply #2 on: June 02, 2008, 05:35:49 PM »
Quote
If current HP is lower than 1/8 (aka 2/16) of MaxHP

Quote
To be exact, the reaction script is "if takes HP damage and HP is less than 1,000, cast Fission."

I don't think it's 1000.. I believe it's MaxHP proportional based, but I could be totally wrong (I will have to test this out to be sure. There's whole series of them in the Octomammoth battle and I really doubt they would use such a fixed number to test against.

3rd Edit: Hmm.. I've tested this against Kainazzo/Cagnazzo in FF4 and it does seem to use the hardcored HP number. Hmm.. I wonder if they made a separate one for Octomammoth...

Quote
That's really the only battle script that's changed? That's kind of amazing, considering all the other changes they made. I guess there's no reason why they had to change the scripts, I just assumed they had changed more. What about changing the value of or completely removing a script, like Milon Z.'s Dullsong counter to fire spells?

Ah, I forgot about that. Let's go Bio!

Edit: I'd say if there are any actual changes to the battle script, it would be subtle like the Milon-Z/Scamaglione battle.. though I dunno why Slow would dramatically change the outcome of the battle (even though it's the most effective spell, but it makes Poison significantly less effective).

2nd Edit: It looks like the counter script was intentionally omitted for this battle.
« Last Edit: June 02, 2008, 06:10:18 PM by Deathlike2 »
Working on the next Yet To Be Named FF4 "Hardtype" Hack Download Latest: v1.48

Video Demos: #1 #2 #3

Phoenix

  • FF4 Hacker
  • *
  • Posts: 456
    • View Profile
    • Phoenix Hacks
Re: FF2 Battle Script That's Different Than FF4
« Reply #3 on: June 02, 2008, 08:16:52 PM »
Quote
I don't think it's 1000.. I believe it's MaxHP proportional based, but I could be totally wrong (I will have to test this out to be sure. There's whole series of them in the Octomammoth battle and I really doubt they would use such a fixed number to test against.

3rd Edit: Hmm.. I've tested this against Kainazzo/Cagnazzo in FF4 and it does seem to use the hardcored HP number. Hmm.. I wonder if they made a separate one for Octomammoth...

I thought the same thing when I was testing last week, but I performed the same tests against Kainazzo and found the same thing. I then found the hex data to support this. All the HP limits are exact number based. Octomamm is actually a special case with no HP checks at all. His attack script is just to attack, it's his reaction script that's interesting. Here's how it works:

Code: [Select]
if HP damage and condition flag is 02
Change to form 05, set speed to index 09, increment condition flag by 01
else if HP damage and condition flag is 04
Change to form 06, set speed to index 08, increment condition flag by 01
else if HP damage and condition flag is 06
Change to form 07, set speed to index 07, increment condition flag by 01
else if HP damage and condition flag is 08
Change to form 08, set speed to index 06, increment condition flag by 01
else if HP damage and condition flag is 0A
Change to form 09, set speed to index 05, increment condition flag by 01
else if HP damage and condition flag is 0C
Change to form 0A, set speed to index 04, increment condition flag by 01, display messages 48 and 49
else if HP damage and condition flag is 0E
Change to form 0B, set speed to index 03, increment condition flag by 01
else if HP damage
Increment condition flag by 01

So basically, Octomamm changes forms every two times he takes HP damage.

Quote
Edit: I'd say if there are any actual changes to the battle script, it would be subtle like the Milon-Z/Scamaglione battle.. though I dunno why Slow would dramatically change the outcome of the battle (even though it's the most effective spell, but it makes Poison significantly less effective).
2nd Edit: It looks like the counter script was intentionally omitted for this battle.

I'm sure it was intentionally omitted, to make the battle easier. As it is, all Milon Z. does is attack. Seems like one of the elemental battles should have a bit more complexity than this.  :finger: If you want to restore the DullSong counter, you can change the data at 73392 to DC0001004200001F8096. I had to sacrifice a byte, though, so I took out his elemental weaknesses. Makes the battle a bit more difficult; though there's no reason to attack with Fire now, it does execute the counter properly. You could remove his spell power byte instead, but I'm not sure how that would impact casting DullSong. Anyway, just a little fix for anyone that's interested.

Deathlike2

  • Moderator
  • *
  • Posts: 3,538
  • I'm looking at you, bitch!
    • View Profile
Re: FF2 Battle Script That's Different Than FF4
« Reply #4 on: June 02, 2008, 08:31:36 PM »
Quote
I don't think it's 1000.. I believe it's MaxHP proportional based, but I could be totally wrong (I will have to test this out to be sure. There's whole series of them in the Octomammoth battle and I really doubt they would use such a fixed number to test against.

3rd Edit: Hmm.. I've tested this against Kainazzo/Cagnazzo in FF4 and it does seem to use the hardcored HP number. Hmm.. I wonder if they made a separate one for Octomammoth...

I thought the same thing when I was testing last week, but I performed the same tests against Kainazzo and found the same thing. I then found the hex data to support this. All the HP limits are exact number based. Octomamm is actually a special case with no HP checks at all. His attack script is just to attack, it's his reaction script that's interesting. Here's how it works:

Code: [Select]
if HP damage and condition flag is 02
Change to form 05, set speed to index 09, increment condition flag by 01
else if HP damage and condition flag is 04
Change to form 06, set speed to index 08, increment condition flag by 01
else if HP damage and condition flag is 06
Change to form 07, set speed to index 07, increment condition flag by 01
else if HP damage and condition flag is 08
Change to form 08, set speed to index 06, increment condition flag by 01
else if HP damage and condition flag is 0A
Change to form 09, set speed to index 05, increment condition flag by 01
else if HP damage and condition flag is 0C
Change to form 0A, set speed to index 04, increment condition flag by 01, display messages 48 and 49
else if HP damage and condition flag is 0E
Change to form 0B, set speed to index 03, increment condition flag by 01
else if HP damage
Increment condition flag by 01

So basically, Octomamm changes forms every two times he takes HP damage.

Hmm, that actually makes some sense.

Quote
Quote
Edit: I'd say if there are any actual changes to the battle script, it would be subtle like the Milon-Z/Scamaglione battle.. though I dunno why Slow would dramatically change the outcome of the battle (even though it's the most effective spell, but it makes Poison significantly less effective).
2nd Edit: It looks like the counter script was intentionally omitted for this battle.

I'm sure it was intentionally omitted, to make the battle easier. As it is, all Milon Z. does is attack. Seems like one of the elemental battles should have a bit more complexity than this.  :finger: If you want to restore the DullSong counter, you can change the data at 73392 to DC0001004200001F8096. I had to sacrifice a byte, though, so I took out his elemental weaknesses. Makes the battle a bit more difficult; though there's no reason to attack with Fire now, it does execute the counter properly. You could remove his spell power byte instead, but I'm not sure how that would impact casting DullSong. Anyway, just a little fix for anyone that's interested.

Well, given that Slow benefits with with the Spell Multiplier, if his spell multiplier is at least greater than 2 (the highest magic defense multiplier  most characters) have at this time is 1x, it always succeeds (he has a spell multiplier of 8, so it's overkill). Killing it gives a decent chance of evasion.. but it will fail a lot more since everyone is targeted... (I'm trying to recall some spell success rules)... I believe now it's a little different between characters and enemies.
« Last Edit: June 02, 2008, 08:44:12 PM by Deathlike2 »
Working on the next Yet To Be Named FF4 "Hardtype" Hack Download Latest: v1.48

Video Demos: #1 #2 #3

bond697

  • FF4 Archivist
  • *
  • Posts: 624
  • Gender: Male
  • is NOT a spoony bard!
    • View Profile
    • The FF4 Reference Book
Re: FF2 Battle Script That's Different Than FF4
« Reply #5 on: June 03, 2008, 02:08:35 AM »
if you guys don't mind me asking, HOW did you come up with these battle scripts? was it through interpreting the hex code? or did you disassemble the rom(or parts thereof?) and use the asm? if it's some kind of disassembly, could i get a look at it?

i know it's probably a dumb question, but i'm still learning about this rom hacking thing, and i can't help but wonder. i was also wondering the same thing before about how you discovered yang's oddball battle script that had to do with the pictures i posted on gamefaqs.

if you could explain it a lil bit, or maybe point me to a document that could, i'd really appreciate it. i've been working hard over here reading, etc, and practicing hacking with my hex editor and all the docs i can find, but i'd love to get to the level that you guys are at one day. so, i wanted to know how you do what it is that you're doing.

anyway, thanks in advance either way.
The FF4 Reference Book - Now with new hosting!

Deathlike2

  • Moderator
  • *
  • Posts: 3,538
  • I'm looking at you, bitch!
    • View Profile
Re: FF2 Battle Script That's Different Than FF4
« Reply #6 on: June 03, 2008, 02:23:07 AM »
if you guys don't mind me asking, HOW did you come up with these battle scripts? was it through interpreting the hex code? or did you disassemble the rom(or parts thereof?) and use the asm? if it's some kind of disassembly, could i get a look at it?

Someone did the bulk of the analysis before I did. However, there are some areas that simply make no sense, which the common watching and see mode comes into play.

Quote
i know it's probably a dumb question, but i'm still learning about this rom hacking thing, and i can't help but wonder. i was also wondering the same thing before about how you discovered yang's oddball battle script that had to do with the pictures i posted on gamefaqs.

if you could explain it a lil bit, or maybe point me to a document that could, i'd really appreciate it. i've been working hard over here reading, etc, and practicing hacking with my hex editor and all the docs i can find, but i'd love to get to the level that you guys are at one day. so, i wanted to know how you do what it is that you're doing.

anyway, thanks in advance either way.

Try the links section.
Working on the next Yet To Be Named FF4 "Hardtype" Hack Download Latest: v1.48

Video Demos: #1 #2 #3

bond697

  • FF4 Archivist
  • *
  • Posts: 624
  • Gender: Male
  • is NOT a spoony bard!
    • View Profile
    • The FF4 Reference Book
Re: FF2 Battle Script That's Different Than FF4
« Reply #7 on: June 03, 2008, 02:32:54 AM »

Try the links section.

thanks for the responses.

if i understand you right, then something like this...

Quote
if HP damage and condition flag is 02
   Change to form 05, set speed to index 09, increment condition flag by 01
else if HP damage and condition flag is 04
   Change to form 06, set speed to index 08, increment condition flag by 01
else if HP damage and condition flag is 06
   Change to form 07, set speed to index 07, increment condition flag by 01
else if HP damage and condition flag is 08
   Change to form 08, set speed to index 06, increment condition flag by 01
else if HP damage and condition flag is 0A
   Change to form 09, set speed to index 05, increment condition flag by 01
else if HP damage and condition flag is 0C
   Change to form 0A, set speed to index 04, increment condition flag by 01, display messages 48 and 49
else if HP damage and condition flag is 0E
   Change to form 0B, set speed to index 03, increment condition flag by 01
else if HP damage
   Increment condition flag by 01

was just done through observation, not some method that i'm just not grasping yet?  i guess that i keep thinking that it's more complicated than it is.

edit: i know that i ask what seem to you like dumb questions sometimes(well, usually :) ), but i really do appreciate the time you take to help me out.
« Last Edit: June 03, 2008, 02:42:06 AM by bond697 »
The FF4 Reference Book - Now with new hosting!

Deathlike2

  • Moderator
  • *
  • Posts: 3,538
  • I'm looking at you, bitch!
    • View Profile
Re: FF2 Battle Script That's Different Than FF4
« Reply #8 on: June 03, 2008, 02:48:24 AM »
if i understand you right, then something like this...

Quote
if HP damage and condition flag is 02
   Change to form 05, set speed to index 09, increment condition flag by 01
else if HP damage and condition flag is 04
   Change to form 06, set speed to index 08, increment condition flag by 01
else if HP damage and condition flag is 06
   Change to form 07, set speed to index 07, increment condition flag by 01
else if HP damage and condition flag is 08
   Change to form 08, set speed to index 06, increment condition flag by 01
else if HP damage and condition flag is 0A
   Change to form 09, set speed to index 05, increment condition flag by 01
else if HP damage and condition flag is 0C
   Change to form 0A, set speed to index 04, increment condition flag by 01, display messages 48 and 49
else if HP damage and condition flag is 0E
   Change to form 0B, set speed to index 03, increment condition flag by 01
else if HP damage
   Increment condition flag by 01

was just done through observation, not some method that i'm just not grasping yet?  i guess that i keep thinking that it's more complicated than it is.

The changing of forms is actually common to the monster. The Agility is hinted, but you would need to know the internal table to how much much slower the monster gets.

Testing this though.. apparently it takes 3 HP damaging attacks to change the monster's mode initally, and then it works every 2 attacks.. strange. I get the feeling the flag initially starts at 0xFF or the whole system isn't quite a direct if/else if type of mode...
« Last Edit: June 03, 2008, 03:25:53 AM by Deathlike2 »
Working on the next Yet To Be Named FF4 "Hardtype" Hack Download Latest: v1.48

Video Demos: #1 #2 #3

bond697

  • FF4 Archivist
  • *
  • Posts: 624
  • Gender: Male
  • is NOT a spoony bard!
    • View Profile
    • The FF4 Reference Book
Re: FF2 Battle Script That's Different Than FF4
« Reply #9 on: June 03, 2008, 03:26:05 AM »
ok, I'm following you so far. Last question for tonight: how would you know about that table? A hacker having found/ shared it? And then using it, you'd compare the dmg/ speed(agility), etc and the number of turns it takes to advance the octomamm battle?
The FF4 Reference Book - Now with new hosting!

Phoenix

  • FF4 Hacker
  • *
  • Posts: 456
    • View Profile
    • Phoenix Hacks
Re: FF2 Battle Script That's Different Than FF4
« Reply #10 on: June 03, 2008, 03:30:23 AM »
Quote from: bond697
if you guys don't mind me asking, HOW did you come up with these battle scripts? was it through interpreting the hex code? or did you disassemble the rom(or parts thereof?) and use the asm? if it's some kind of disassembly, could i get a look at it?

I study the battle scripts through the hex code. Someone else (I'm not sure who, originally) worked out what the attack script bytes meant. The condition bytes (the "if...then" statements) I worked through most of myself before I realized Zyrthofar had already done it. I got a few of the interpretations from his editor, and now I have a complete set of what the bytes mean. I just read the hex data and piece it together, then write it out if I'm going to comment on it here. I can post the formatted hex data and the meanings for the attack and condition bytes if you'd like. Let me get them pulled together tonight, and I'll attach them to this thread.

Deathlike2

  • Moderator
  • *
  • Posts: 3,538
  • I'm looking at you, bitch!
    • View Profile
Re: FF2 Battle Script That's Different Than FF4
« Reply #11 on: June 03, 2008, 03:32:50 AM »
Edit: Never mind. Brain trauma due to lack of sleep is clouding any logical thoughts.
« Last Edit: June 03, 2008, 03:39:41 AM by Deathlike2 »
Working on the next Yet To Be Named FF4 "Hardtype" Hack Download Latest: v1.48

Video Demos: #1 #2 #3

Phoenix

  • FF4 Hacker
  • *
  • Posts: 456
    • View Profile
    • Phoenix Hacks
Re: FF2 Battle Script That's Different Than FF4
« Reply #12 on: June 03, 2008, 05:13:36 AM »
Quote from: Deathlike2
Testing this though.. apparently it takes 3 HP damaging attacks to change the monster's mode initally, and then it works every 2 attacks.. strange

This works with the script. The flag starts at 00, and the reactions go like this:

1. Attack the first: condition flag is incremented to 01.
2. Attack the second: condition flag is incremented to 02.
3. Attack the third: the condition flag is at 02 and there is HP damage, so Octomamm's form changes and the flag is incremented to 03.

After that, it only takes two times:

4. Attack the fourth: the condition flag is incremented to 04.
5. Attack the fifth: the condition flag is at 04 and there is HP damage, so Octomamm's form changes and the flag is incremented to 05.
6. And so on, and so forth

Phoenix

  • FF4 Hacker
  • *
  • Posts: 456
    • View Profile
    • Phoenix Hacks
Re: FF2 Battle Script That's Different Than FF4
« Reply #13 on: June 03, 2008, 06:08:15 AM »
Quote from: bond697
i know it's probably a dumb question, but i'm still learning about this rom hacking thing, and i can't help but wonder. i was also wondering the same thing before about how you discovered yang's oddball battle script that had to do with the pictures i posted on gamefaqs.

if you could explain it a lil bit, or maybe point me to a document that could, i'd really appreciate it. i've been working hard over here reading, etc, and practicing hacking with my hex editor and all the docs i can find, but i'd love to get to the level that you guys are at one day. so, i wanted to know how you do what it is that you're doing.

I'm always glad to be of help, as are the other people on this board. Ask as many questions as you need -- the more you understand the better your hacks will be, and I look forward to seeing what you'll produce. For the enemy attack sequences, you should download the Tower of Bab-il documents (they can be found in Deathlike2's "Useful Links" thread). There's a document in there describing where the data is and what is means. Once you understand that, you can use the three documents I've attached to this thread.

1. First, look up the enemy attack group. It's the 9th of the 10 bytes in the enemy stats data (another Tower of Bab-il document explains this).
2. Once you have this hex number, you can look it up in the Enemy Attack Group document. This will give you a series of 2-byte sets: first is the condition index, then the attack sequence index.
3. Look up the condition index(es) in the Enemy Condition Indices document. This tells you the condition for the following attack sequence byte.
4. Look up the attack sequence index(es) in the Enemy Attack Sequences document. This will give you a series of commands the enemy performs under the previous condition.

Here's an easy example: the Imp. If you look up it's attack group number, it's 00 (in hex). Look this up in the Enemy Attack Group document, and the data there is "55 00 01 02 00 01 FF." This gives you three 2-byte sets. Using the conditions document and the sequences document, you can tell the following:

55 00: Condition 55 is "if self is an egg". Sequence 00 is "E1 FF" which means "do nothing."
01 02: Condition 01 is "if charmed". Sequence 02 is "F9 24 C0 FF" which means "target a random enemy and attack."
00 01: Condition 00 is "no condition" (i.e. "otherwise). Sequence 01 is "C0 FF" which means "attack."

Let me know if the formatting in the documents is funky. I work on a Mac, so I'm not sure how it'll turn up in other OS's.

Edit: I don't think my interpretation of "F2" in the attack sequences is correct. It displays the dialogue, but doesn't do it while performing the next attack. Not sure what the difference is between "F1" and "F2". If anyone knows or figures it out, please share.
« Last Edit: June 03, 2008, 06:39:34 PM by Phoenix »

bond697

  • FF4 Archivist
  • *
  • Posts: 624
  • Gender: Male
  • is NOT a spoony bard!
    • View Profile
    • The FF4 Reference Book
Re: FF2 Battle Script That's Different Than FF4
« Reply #14 on: June 03, 2008, 01:20:32 PM »
thanks for this. i do actually have the tower of babel docs. ever since i've found this place, i've been going through topics archiving any ff2/4/4et/4a data that i can find, so with these 3 text files, i've got quite a bit.

btw, i've been in love with ff2/4 since 91 when it came out (i'm 23 now), so having access to all this data is super-exciting. i've been trying to come up with a good idea for a hack as of late. i have all of this data, and nothing to do with it. :)

edit: i've actually been using zythofar's editor today to look over the battle scripts, now that i realized that you can do that. it's really making things a ton clearer for me. :)
« Last Edit: June 03, 2008, 01:32:01 PM by bond697 »
The FF4 Reference Book - Now with new hosting!