Author Topic: Encounter, AI and Model Problems  (Read 4418 times)

Karifean

  • *
  • Posts: 65
    • View Profile
Encounter, AI and Model Problems
« on: 2009-07-10 15:05:40 »
Hello there, I'm new at this forum, and I'm new to FF7-Modding, too. My first goal was to create a monster called "Omega Weapon", which is stronger than Ruby and Emerald, has four million HP and must be fought in order to get KotR-materia. Of course, if I had known it'd be so much work to do that, I'd surely have given it up fast...

I started by downloading a bunch of modding-programs; Proud Clod, Hojo, Scenester (which doesn't work, by the way), Meteor, Teioh, WallMarket, Loveless, Kimera, PCreator, Gast and Jenova.

Using Hojo, I managed to find a free space for my Omega Weapon. I did all normal things: setting HP/EXP/AP/Gil/Items Dropped/Status and Elemental Immunities. The first program came up here - there were no spells to set.
So I started Proud Clod. I found my Omega Weapon (which mysteriously moves 1 file between Hojo and Proud Clod) and set up some spells, such as Level 3 Death.
Next problem: I couldn't set it up, so Omega Weapon would use Level 3 Death only when the battle starts. And that was where the 'disaster' started. I nearly had a shock when I looked at "Edit AI" :?. I'd have never thought it'd be so complicated - and in hex-code. I searched for a tutorial for this, but everything I looked at only got me more confused. Ex.: On one page I found different actions with Opcodes, like 92 for RunCmd. Though I was able to type 92 into Opcode column, but typing anything into argument would result in an error... I now understand that the "Attack IDs" are very important. But so far, I gave up on that.

Next problem: I couldn't figure out, how to trigger the battle vs Omega Weapon just when picking up the KotR-Materia. I couldn't do it with Meteor or any other programs... I'm afraid, that's hex-code again. I also searched for help, but couldn't find any that solved my problem.

Last problem: At the beginning, I had the plan of making Omega Weapon look like in FF8, and I figured the model of "Doorbull" would be the best, if I could just make it bigger and change its color. I downloaded a few model-editors for this, but now I don't come any further. Where's the Doorbull-model? I could never find out the answer to that question.

I'd like to have a solution to all these questions and the only way I've found was to register in this forum and ask you all myself. If possible I'd also like a link to a good and easily understandable guide for enemy AI-editing. By the way, I've downloaded HxD, but I think Proud Clod is more understandable than that...

Can you help me?

nfitc1

  • *
  • Posts: 3011
  • I just don't know what went wrong.
    • View Profile
    • WM/PrC Blog
Re: Encounter, AI and Model Problems
« Reply #1 on: 2009-07-10 16:02:40 »
First of all, hello and welcome! New modders are certainly encouraged to ask questions so feel free to lay them on us. I haven't even been here a full 10 months and already I'm very well versed in everything battle-related. ;)

Let me try to answer some of your questions:

1. Hojo vs Proud Clod: I don't want Proud Clod to depreciate Hojo like what WallMarket did to Teioh. Squall has done good work with Hojo and I'm just picking up the pieces and filling in some of the blanks. Yes, the scene numbers are off. This is more Squall's choice, but the game refers to them as 0 - 255 so that's how PrC (the abbreviation for Proud Clod) is referencing them. PrC isn't very pretty yet. There's still a lot of labels to be made. BUT, it's the easiest way to edit AI and battle data. I'm not bragging, it's just fact at the moment. Keep up with it too. It's still a WIP. WM's almost done, though. Almost all that's left is fixing bugs and finding values for currently unknown things.

2. Edit AI: Yes, this is complicated. If you've played around with FF3USME (which is where I stole the idea from), it's nothing like that. It does require some basic programming/logical-level thinking. There is some good info in WallMarket's readme about how to write it as well as some examples including how to use most of the opcodes. Just keep in mind that the disassembling isn't always 100% accurate. Compilers know some tricks to turn script into oddly written code that makes it more efficient. When this happens, there's almost no way of returning it to its original code without knowing all these tricks. If you're stuck with how to do a particular thing just ask. Most of the modders (at least the ones that have made enemies) are able to help.
To get your weapon to start out with Level 3 Death there are several things you need to do.
#1. Create the attack data in the scene: Take a blank attack and give it the data that resembles Level 5 Death (use WM to compare), but make the Hit% a 3 instead of 5.
#2. Give the attack a unique ID number. PrC can give you a list of IDs that aren't being used anywhere in the scene.bin, but it would probably only need to be unique to that particular scene. Just make sure it's above 100h or the game will use the attack data from the KERNEL.BIN.
#3. Assign the animation. This is what the animations/formations button is for. Tell your monster that you want it to use animation index ## for this attack. Most enemies have at least four animations, many have more. Idle*, Death*, Damage*, Attack, Magics, Special Movements, etc. (*they'll need these at least).
#4. Write it into the AI. This is where it starts getting hard. You'll need to look up the usages of all the codes before you write it. Also, you might want to keep the ProudClod.dat file open so you can see the addresses that are used for particular functions. This script would go in the Pre-Battle:
Code: [Select]
12  2070
02  20A0
90
60  20
61  ####
92
That will cause the enemy to perform whatever attack has the index of #### on all if its enemies (all the player characters) when the battle begins.
Most of the features of PrC are in the topic about it. The animation assignment is particularly important. Don't give an attack to an enemy without giving it an animation.

3. Scenester works in conjunction with SceneReader. SceneReader can separate all the scenes in scene.bin and write them back together. This is a requirement for Scenester and SceneEdit, but PrC doesn't have such dependency. It works with the scene.bin directly and update the KERNEL.BIN.

4. Just as a suggestion. As most people suggest actually using KoR on Ruby/Emerald, it doesn't make a lot of sense to make it a requirement to fight something stronger before you get it. Maybe something to fight as you leave the cave AFTER you pick it up would be more appropriate.

As a first goal you set your sights high. Not to say it can't be done. It can. But it's likely going to take some effort.

Xelane

  • *
  • Posts: 477
    • View Profile
Re: Encounter, AI and Model Problems
« Reply #2 on: 2009-07-10 22:29:07 »
You may disagree with me on this BUt couldn't you just take ultima weapon's model as a base and make it more epic?

oh and do something like replace ultima beam's animation for the laser that the boss on the elevator in shinra corp? (it's red where as ultima beam is blue)

edit: and as for when to fight omega weapon, maybe you could have it set so that it happens after emerald and ruby have been defeated? my idea is that if possible maybe after you beat the 2 ultima weapon reappears BUt this time it's changed into omega weapon.

like make it's skin color white, maybe if it's possible you could import ff8 or ffX's omega weapon and use him instead.

maybe you could even add some text so that they say something reffering to how they've fought ultima before.


those are just some of my ideas, good luck on your enemy mod.
« Last Edit: 2009-07-10 22:34:18 by Xelane »

Karifean

  • *
  • Posts: 65
    • View Profile
Re: Encounter, AI and Model Problems
« Reply #3 on: 2009-07-11 14:19:49 »
Thanks for your answers!

To NFITC1:

1. I think Hojo and PrC work well in conjunction with each other, as Hojo can do things PrC can't and vice versa.
2. Is FF3USME for FF3? I've only played VII, VIII, X, X-2, X-2 International and XII. Thanks for your tutorial!
As for #1, I already made that spell. Making Omega Weapon use it was the problem.
#2 Thanks, I did so and gave it the attack ID 03C1.
#3 Since I don't have a model for Omega Weapon yet - I don't know how to give certain enemies certain models, as neither Hojo nor PrC seem to be able to do that. Therefore, the animation lost priority. Thanks, though, for telling me that it is important.
#4 Thanks for the code! After writing it in, I started trying to understand it. Here are my results:

12 2070     This seems to store "TargetMask".
02 20A0     This seems to store "AllActiveOpponentMask".

So we got Target and All Active Opponents. However, they aren't combined yet. This is what probably happens next:

90

This stores the value from the first "pop" at the "battle address" from the second "pop". As far as I understood it, it simply puts those together. The next line I don't understand:

60 20

As there is no entry in ProudClod.dat for argument 20, I don't really understand this. According to WMHelp, it pushes the value of the 20 (byte) as a byte-value to the stack. I'm not sure what is meant by that. Maybe it puts the target-choosing from above and the ID-choosing from below together. The next command is similar, but that one pushes the attack ID.

61 03C1

This is similar to the one above. The difference between 60 and 61 seems to be, that 60 pushes the value of a byte as a byte-value (type 01), while 61 pushes the value of a word (two byte) as a word-value (type 02). It practically stores the attack ID.

92

This is executing the attack. The first pop is attack index, the second the ComIndex to perform the attack under.

I think I understood it halfway. If possible I'd like a better explanation than my own...

3. Thanks for the information, but do I need Scenester when having Hojo and PrC after all?
4. Well, as I'm not good with Meteor, I don't really know how to do that. I suppose you have to put the entity of Omega Weapon at the exit and make it visible when KotR is picked up. But I don't even know how to make additional encounters. How to do that after all? I know both of the weapons become a little weaker without KotR (see Enemy Mechanics Guide on gamefaqs), but they aren't that easy to beat that way. Besides I was going to make an even harder weapon than Omega (should be Sapphire).

To Xelane:

I was actually rebuilding FFVIII's Omega Weapon. I'm changing its attacks, but the Doorbull model looks just so alike. When changing its size and color, I think it really could look like Omega from FF8. As for your idea when to fight him, it's interesting. I might just consider doing that. But the problem is, I don't even know how to assign models to enemies or make additional encounters during the game! I hope someone can tell me.

As for some other problems:

Whenever I'm trying to change the Attack Strength of Level 3 Death, it sets it back to 255. I think the problem is, whenever I try saving PrC, a message appears: "Scene lookup in KERNEL.BIN detected to be incorrect. Attempt to correct?" There is no difference whether I choose Yes or No.
By the way, what are each of the settings Impact Anim., Target Anim., Anim. ID, Impact Sound exactly?

nfitc1

  • *
  • Posts: 3011
  • I just don't know what went wrong.
    • View Profile
    • WM/PrC Blog
Re: Encounter, AI and Model Problems
« Reply #4 on: 2009-07-11 16:05:02 »
1. This is correct and the point of PrC. So yes. :)

2. Also correct, but you really need to read in the WM readme about the stack and its importance to other functions. Many commands don't take arguments, but rather they take values off the stack to perform certain things. If you don't understand the stack, how to work it, and how other functions manipulate it your AI will be very bad.

3. I guess not. :)

4. Uh...can't respond to that since I never did any field editing.

other problems: I'm having no problems assigning the attack strength of any attack, and it doesn't have to do with that save message. Look at what the importance of the KERNEL.BIN scene lookup is. If it's wrong the game won't respond correctly. PrC is offering to make you a corrected KERNEL.BIN named KERNEL.BINtest that will need to be renamed to replace the existing KERNEL.BIN. That's honestly something I need to document better or not do the rename thing (actually, does it still do that? secondadvent and I worked out the problems with it). That doesn't affect anything in the scene.bin at all. Pretty much, you should always answer yes to it.
For the functions of those other things see the Attack Tab entry in the WM readme.

Karifean

  • *
  • Posts: 65
    • View Profile
Re: Encounter, AI and Model Problems
« Reply #5 on: 2009-07-11 17:06:59 »
Okay, i must admit, after looking at it a bit, AI-editing isn't quite as hard as I thought it was.  :-D
I now understand the stack and all the commands used till now. The 60 is the command index to perform the action under. First I though "wtf?", but I left out the important part. "For an enemy, it is always 20h to perform a command." That explains a lot. I guess TargetMask is a two-byte-address, while AllActiveOpponentMask is a two-byte-value. But AllActiveOpponentMask still needs an address. It seems to be important that TargetMask is added first, so AllActiveOpponentMask is on the top of the stack. The next command, 90, works with that. 90 assigns the address TargetMask to AllActiveOpponentMask. Here it is very importnat that AllActiveOpponentMask is the top of the stack and TargetMask is directly below. The next part, which I didn't understand at first, is 60 20, is required for the attack-executing at 92. For enemies, the argument (value) for it is always 20. What 60 indicates is, that it puts the following value - the 20 - ontop of the stack. Next, we use 61 to put the attack ID of the attack which shall be done ontop of the stack. I guess an attack ID is a two-byte value (as are all 4-lettered datas?), so we use 61 instead of 60. Next, we use 92, which is similar to 90. It uses the attack ID which must be stored ontop of the stack. As it is an enemy who attacks, there must be a 20 stored below it. I guess when a char attacks this number may vary.

I hope I can be relieved by a confirmation that my theory is correct. If so, I'll move on to IF/THEN/ELSE and Variables, else I guess I'll do more research on it.  :-)

Also - thanks NFITC1, I've solved the PrC saving error - at least so far^^

Edit: Okay, now I've read through the WM Help Guide, but a thing I don't know is - how to put in a random number between 2 numbers? Like "Value = (Rnd3..7)"?

Edit2: By the way, I'm gone for a week now - on vacation. :-)
« Last Edit: 2009-07-11 19:41:14 by Karifean »

Xelane

  • *
  • Posts: 477
    • View Profile
Re: Encounter, AI and Model Problems
« Reply #6 on: 2009-07-11 22:21:15 »
for the whole field thing you would have to use a program made here called meteor.

nfitc1

  • *
  • Posts: 3011
  • I just don't know what went wrong.
    • View Profile
    • WM/PrC Blog
Re: Encounter, AI and Model Problems
« Reply #7 on: 2009-07-11 23:25:32 »
You're missing some key concepts between values and addresses. Read the tutorials at the bottom of the readme for applications of these concepts (except that X3 really references a three-byte value. That's another mistake I need to correct).

how to put in a random number between 2 numbers? Like "Value = (Rnd3..7)"?

You don't. You create the random number then manipulate it to your fancy.

60  03
60  05
81         create RANDOM number
34         RANDOM number MOD 5
30         result Plus 3

This disassembles into (RAND Mod 5) + 3. This will generate a number between 3 and 7.