Author Topic: Editing the monsters' AI in FFVII  (Read 2664 times)

Armorvil

  • *
  • Posts: 621
  • Working on : FFVII Total Grudge
    • View Profile
Editing the monsters' AI in FFVII
« on: 2006-08-21 21:19:11 »
Unfortunately, there's nothing about the AI Data when you click on the 'structures and upcode' link, in the QhimmWiki. But I refuse to believe that nothing is known, considering that Terence Fergusson did manage to write the Enemy Mechanics FAQ, with all monsters' AI scripts and all.

I was naive enough earlier to think that, in order to make Jenova:BIRTH use 'Comet' instead of 'Stop', I just had to replace the Stop data in his Attack Data with Comet's (mighty thanks to L.Spiro's FF7 Stuff file, by the way), and switch the first 15h byte at offset EFF with 2Dh (because, according to the AttacksHacks document, Cure should appear as 00h, Stop 15h and Comet 2Dh), but the battle froze while Jenova was casting Gas. Also, according to the listing of status inflictions caused by enemy attacks (that you can find in The Skillster's post here), Stop is the status effect '00 04 00 00'. But strangely enough, this value is nowhere to be found in Jenova:BIRTH's script (even though it should, as it uses certain spells if characters are stopped). It looks like status effects appear as completely different values when in the AI data.

Another funny thing, is when I tried replacing 15h by 2Dh at offset F17 (the second 15h value). This message popped up while fighting Jenova :

Data error
Scene: 488/Code 32
Push L1+R1+Select for Reset


And the message just repeated itself endlessly. Fun. Looks like the programmers foresaw my weak attempt at hacking their code  :-D

My goal : just changing the spells casted by enemies, for now. It's obvious the key lies in their AI script, but I don't know which values to edit. I could just run a lot of tests, but I thought I'd ask here first, in case someone's got informations...

I have a little experience with the way the monsters' AI works in FFVI, and I'm sure it works the same way here. Meaning that there should be a byte introducing the "If" supposition, and a byte to end this supposition. If we could just narrow these bytes down, this would help us a whole lot (as I'm sure I'm not the only one interested in this ^__^).

Oh, and one other thing : another solution to make enemies use other spells would be to modify KERNEL.BIN, but the file is compressed. Is there any way to unpack the archive, and then repack it once changes have been made ?

And final note : Terence mentioned the Adamantaimai bug, in his FAQ. Straight from his words : "If you manage to inflict Barrier and MBarrier on an Adamantaimai before it takes its first turn, it will try to cast Cure.  Since Cure is not in its Attack List, the game will freeze or crash." But then, the spells in the monsters' Attack Lists don't seem to be relevant, as modifying their 28 bytes bears no consequence to the spells' behaviors in-game. I could replace the 28 bytes of each spells by only FFh in SCENE.BIN, and the spells would still work. Is the missing attack data really at cause, for the Adamantaimai bug ? ...Not that I dare question Terence's knowledge in this area, mind you.  :wink: I just want to know where the game loads the data for the magics casted by enemies.

I have very little knowledge about hacking and programming, but I'm ready to put a lot of time and effort into it. I'll keep an eye on this topic while I run some other tests. I'll give updates if I find out anything related to the monsters' AI script.

Thanks in advance for your contribution  :-)

EDIT:

Actually, the game froze because the game doesn't want Gas to target all allies... I gotta retry my method.
Oh, and I managed to have Jenova cast Stop at the beginning of battle ! And on all allies (just change 20 to 1F, at offset F07) !  :-D It seems the targeting byte of the AI script is perfectly functional. Now, I just have to find it.
« Last Edit: 2006-08-21 22:05:23 by Armorvil »

Vehek

  • *
  • Posts: 215
    • View Profile
Re: Editing the monsters' AI in FFVII
« Reply #1 on: 2006-08-21 23:16:15 »
This is very important: if a wrong Attack ID is used that the scene.bin doesn't have data for, the game will crash... and vice versa (Adamantaimai is the perfect example for this, since it's possible to get its AI to use Cure which isn't in the Adamantaimai's Attack IDs)
Missing attack data isn't the problem.

Armorvil

  • *
  • Posts: 621
  • Working on : FFVII Total Grudge
    • View Profile
Re: Editing the monsters' AI in FFVII
« Reply #2 on: 2006-08-22 18:47:15 »
I see, thanks.