Author Topic: AI condition flags / AI commands F4,F5  (Read 977 times)

avalanche

  • Mom Bomb
  • *
  • Posts: 122
    • View Profile
AI condition flags / AI commands F4,F5
« on: November 06, 2015, 04:09:48 PM »
Here's a break down of the parameter byte for AI commands F4 and F5 which modify the condition flags.  First, the flags are shared by all monsters, which I didn't realize until just now when I was looking at Dr.Lugae and Balnab.  For some reason I assumed each monster had their own.

Code: [Select]
MMxxxxxx
    MM = mode
         00: add
         01: subtract  (never used)
         10: set
         11: (undefined, would probably behave as 10)
    xxxxxx = 6-bit operand

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,684
    • View Profile
Re: AI condition flags / AI commands F4,F5
« Reply #1 on: November 06, 2015, 05:47:19 PM »
Here's a break down of the parameter byte for AI commands F4 and F5 which modify the condition flags.  First, the flags are shared by all monsters, which I didn't realize until just now when I was looking at Dr.Lugae and Balnab.  For some reason I assumed each monster had their own.

Code: [Select]
MMxxxxxx
    MM = mode
         00: add
         01: subtract  (never used)
         10: set
         11: (undefined, would probably behave as 10)
    xxxxxx = 6-bit operand

I'm... a little bit confused. Granted subtracting conditional flags does have its purpose. But doesn't FF4kster already do this? I may be missing something here.

Kea

  • Vargas
  • *
  • Posts: 94
    • View Profile
Re: AI condition flags / AI commands F4,F5
« Reply #2 on: November 06, 2015, 07:27:07 PM »
I believe avalanche is documenting vanilla commands used by FF4's AI scripts. So FFHackster probably already does this, but figuring out how the command is read by the game code is useful in and of itself.

For me, seeing how the AI script format differs between the SNES and other versions is always intriguing. For instance in the Wonderswan/GBA versions, monsters have their own conditional flags, and adding to or subtracting from the flag byte is not possible - only 'set' is supported. Or at least I haven't seen anything else.

avalanche

  • Mom Bomb
  • *
  • Posts: 122
    • View Profile
Re: AI condition flags / AI commands F4,F5
« Reply #3 on: November 06, 2015, 09:04:30 PM »
I'm... a little bit confused. Granted subtracting conditional flags does have its purpose. But doesn't FF4kster already do this? I may be missing something here.

(Again I feel a little bad to admit that I don't know if FF4kster has it, as I don't use it for my project.)  But in the document by Phoenix called "EAS", it is a little thin in the details about the format of the parameter byte.  I had to fix a bug in my AI interpreter because Dr. Lugae and Balnab weren't behaving correctly.  So I dug into the assembly, found out that my problem was that they share the flags instead of having their own.  But also found out exactly what bits did what and saw the subtraction option that wasn't in the document.  Just wanted to post something more concrete in case it could help anyone.

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,684
    • View Profile
Re: AI condition flags / AI commands F4,F5
« Reply #4 on: November 06, 2015, 09:08:28 PM »
The subtraction part will help people who want bosses to regress into earlier stages without outright setting the conditional so already that has value. Adding that into the editor would be a nice little update, but I don't know the likelihood of that.