[Note: the abbreviation for IA is AI in English, which I start using later on in this post]
I saw the post on the Proud Clod thread recommending that this original thread be used so here we go:
First of all, you need this. It contains a list of the codes that the IA uses to determine things like target, which attack to use, and other things:
http://www.mediafire.com/view/umiqacyau66u9c9/opcode_list.txtI don't know who put that list together, just that I got it from Bosola when he linked Karifean to it on an older thread that I can't find. Keep this document pinned to your Notepad, desktop, etc. It's invaluable when you're getting into IA editing.
The best thing to do is start small and get to grips with the basics of AI editing first and understand what the numbers mean. Kalm Fangs are a good place to start, as they have a very simple AI which consists of only two attacks, one of which has a lower chance of being used than the other.
So this Kalm Fang's Main AI. I've written a basic translation of what each set of numbers mean.
12 2070 - Target Mask
02 20A0 - All Opponent Mask
82 - Random bit (it will select a random single target from the All Opponent mask; if deleted, the target will be All Opponents)
90 - Closes the Target AI part (that's my understanding of it)
[The next part is for selecting an attack for the Kalm Fang to use]
81 - Random MOD (this is for determining the chance of the first attack listed being used)
60 03 (this is the number of probability. So 1/3)
34
52
70 0019 - (Relates to the If/Else string)
60 20 - (This appears before most attacks are listed)
61 0172 - (The attack ID for Bodyblow)
92 - (Closes the attack part, like the 90 did for the targeting)
72 001F (part of the If/Else string, if the Random MOD check misses then it'll use the following attack instead)
60 20 - (same as before)
61 0189 - (The second attack ID, Fang)
92 - (closes the attack part)
So let's do a basic exercise. Let's say you want the Kalm Fang to attack itself. You'd open the IA screen for the scene with the Kalm Fang in it and select it's Main AI (it'll have a star next to it, that means there's code inside it; the rest will be blank as the Kalm Fang doesn't have any other special AI). When you've got the numbers for Kalm Fang's Main AI showing, click on Disassemble. This will translate the code and make it much easier to work with.
So if we want Kalm Fang to attack itself, we need to change it's target AI. If you open your OPcode list and look for 20A0, it'll show you that this is the code for All Opponent Mask. A few entries up from this is another code, 2060, which is called 'Self'. If you change 20A0 in Kalm Fang's AI to 2060, he'll target himself with his attacks instead of a random opponent. To do this, click on the cell that contains the code 20A0 in Kalm Fang's AI and then type 2060. Press the down or up arrow key after doing this to move away from the edited cell (if you hit enter, you'll create a new blank line by accident).
Click 'disassemble' again and it should now read 'Target Mask <- Random Bit (Self)'. The Random Bit is now no longer needed, so we can delete this. Click on the cell containing '82' which should be directly below the code you just edited. Press the 'delete' key (backspace doesn't seem to work) and the line containing 82 will disappear. Click on disassemble again and the line will now read 'Target Mask <- Self'. When finished, click 'Done' to have the editor remember your changes. Then save your scene.bin by clicking 'file' and then 'create scene.bin'.
If you make a mistake, however, then you can click Cancel to revert the AI back to what it was. If you get an error message for whatever reason, then click Continue and then click cancel before trying again.
Next thing we need to go over is copy-pasting AI. This is very useful for quickly constructing new enemies or changing the way in which old enemies behave. If you look at Jenova LIFE's AI, you'll see that she has a Magic Counter. This counter is quite simple: whenever Jenova is hit with magic, the AI will check for two conditions. The first condition checks if Jenova does not have the Reflect Status. The second condition checks if she has enough MP to cast Reflect. If both conditions are met, she will cast the Reflect spell on herself.
You can copy-paste this AI into any other enemy. You could also use it as a Physical Counter or even as Main AI. What you'd then do is edit it so that it triggers different attacks/spells under different conditions. So let's do another exercise and give Materia Keeper a Physical Counter based on Jenova LIFE's magic counter.
First thing to do is open Jenova LIFE's AI and select Magic Counter. Click Copy, and a screen will appear asking you for how much of the AI you want to Copy to the Clipboard. By default, it'll be all of it so click OK. Now go to Materia Keeper's AI. You'll notice that his Physical and Magical Counter AI is empty. Select Physical Counter and then click Paste. This will insert the Copied Jenova LIFE Magic Counter AI. Click Done and go back into Keeper's AI. You'll notice that the Physical Counter you just copied in has vanished. There's a trick to preventing this that I have. Copy the Counter AI back in again. Then select one of the cells, preferably one that's on its own. The '80' in the third row should do. Click on it and then re-type the number 80. This leaves the AI unchanged but now Proud Clod will record the pasted AI when you click Done. So click Done and then go back in, your new Physical Counter AI should be there this time.
So now we need to adjust this new Counter AI. There is no Reflect stored in the Materia Keeper scene so the game will try to reference a move that doesn't exist if this AI is triggered as it is now. Let's first change the attack/spell that this Counter uses to Cure2. If you check the Attack ID of Cure2 in Keeper's Scene, you'll see that it's 0001. Go back into the AI and you'll find that Reflect is just listed as 11 and that there's not enough space to enter 0001. This is because spells that can be used by the player, use 2-digit codes instead of the 4-digit codes you've been working with so far. That means Cure2 is actually just 01 instead of 0001. So replace the two instances of 11 with 01; this will replace Reflect with Cure2.
But now we've got this condition at the top, where the Counter will only be used if Keeper does NOT have the Reflect status. This is actually quite useful as you don't want him accidentally reflecting his Cure2 to the player. But we're going to change it anyway. If you look at the AI, you'll see that it starts with this:
02 2060 - (Self Target Mask)
00 4012 - (Status: Reflect)
80 - (Required)
60 00 (The number the If string will check for)
40 - (determines the mathematical symbol used, in this case: '=='
This translates (roughly) as 'If Materia Keeper does not have the Reflect Status, and he has enough MP, then cast Cure2 on himself'.
'0' in this case means 'doesn't have', but if we change this to '1' then it becomes:
'If Materia Keeper DOES have the Reflect Status, and enough MP, then cast Cure2 on himself'.
But we're going to change things to make this counter attack trigger only if Materia Keeper has been poisoned. So open up the OPcode list and look for 4012. It's listed as relating to the Reflect status. According to this list, we can change Reflect to Poison instead by changing 4012 to 4003. Click the cell containing the 4012 in Keeper's new Counter AI and enter 4003, like you did with the Kalm Fang AI. We also want this to trigger only when Keeper has been poisoned so change the '60 00' below it to '60 01'.
Now he will only use this Counter when he has been:
A) Hit by a Physical Attack
B) Has been Poisoned
C) Has enough MP to cast Cure2
This was a basic example of how to change and adapt old AI. You could turn this Counter into something more aggressive by replacing Cure 2 with Trine and then changing the Target Mask so that it's used against All Opponents instead (swapping 2060 with 20A0).
Once you've got the basics down, you can start to do a lot more with the game's enemies. Before editing AI, though, read up about the enemy first so that you can make better sense of what the code means. For Safer, remember that he has a set pattern of attacks, some of which don't actually do any damage but are used to handle his change in altitude (when he flies up high and prepares to use Supernova for instance, or when he first descends as the fight starts). His death is also an 'attack' which he uses, in his Death Counter AI, to trigger the effect where he explodes and evaporates.
Sorry for the long response, but hopefully it'll get you started.