Author Topic: Creating Enemies  (Read 9155 times)

darkrandom12

  • *
  • Posts: 12
    • View Profile
Creating Enemies
« on: 2008-03-20 00:03:32 »
Hey.
I have looked through the forums but not really found much in the way of what I'm looking for.
If there is some thread I've overlooked, please direct me  :-)

Right anyway, I've been messing around with Meteor and Highwind etc. and was just wondering
1. Does Meteor show ecounters for Bosses? Because, I don't think it does ;S
2. If it doesn't, what are the ecounter codes for Bosses? I know it might sound totally stupid but I was going to make a sort of room full of bosses from previous parts in the game
3. How do I create enemies/bosses? As I wouldn't mind making the game quite a bit harder and customising it
4. How do I create attacks for enemies/bosses, as raising stats and changing some weaknesses around would just mean levelling up more which I don't find that interesting y'know?

Thanks for any help  :-D

obesebear

  • *
  • Posts: 1389
    • View Profile
Re: Creating Enemies
« Reply #1 on: 2008-03-20 02:48:46 »
You probably want to get ahold of GJOERULV as far as adding bosses is concerned.  If he does tell you how, please convince him to write a tutorial on how it's done.

darkrandom12

  • *
  • Posts: 12
    • View Profile
Re: Creating Enemies
« Reply #2 on: 2008-03-20 03:07:46 »
Thank you, I'll try to  :-)
Can anyone else give me anymore info?

Many Thanks

LJH

  • *
  • Posts: 132
    • View Profile
Re: Creating Enemies
« Reply #3 on: 2008-03-20 06:32:10 »
I've been in contact with him and he said he was going to consider writing a tutorial after he's finished his mod.

darkrandom12

  • *
  • Posts: 12
    • View Profile
Re: Creating Enemies
« Reply #4 on: 2008-03-20 11:18:03 »
 :-D That's brilliant, his mod is the one with the Jumbo Cactuar's etc right?

LJH

  • *
  • Posts: 132
    • View Profile
Re: Creating Enemies
« Reply #5 on: 2008-03-20 12:04:25 »
I've seen at least two different people's Jumbo Cactuars on youtube so... :P

But yes, he does have a Jumbo Cactuar.

gjoerulv

  • *
  • Posts: 1225
  • me
    • View Profile
    • My Youtube
Re: Creating Enemies
« Reply #6 on: 2008-03-21 01:12:23 »
I will write guide NOW!! Ok I'm on Easter vacation now, so why not write the %&#$ guide lol. At least I can start with this post, and try to answer any questions that might pop up. I bet there are many others on this forum can probably answer 'em too. I'm not at home now and didn't bring any files. That means I don't have any of my files available. I'll be back home Tuesday next week.

Before I start, just to make things clear, you need to know that there are a fixed number of battle models in the... uh battle.lgp was it? Anyway they are in the lgp archive where the battle models are stored (It's located in data\battle). Each battle model has it's own ID. That means, unless you want to make your own models, you have to use that is already used by the game.

Anyways...

Lets go through it step by step. In the scene the important sections are:
  • Enemy IDs (Battle model)
  • Enemy Data (skills, items, elements etc)
  • Attack ID list
  • Attack Data (moves enemies have)
  • Attack Names
  • AI
  • Formation


Enemy IDs (Battle model)
To ADD enemies to a scene you have to find a scene that isn't full (has 3 enemies), and then add a ID. This part is the easy part 'cause the IDs is in the very beginning of the scenes. The 6 1st bytes. Which means each ID is 2 bytes long. To begin with, you should find a scene you know where the encounters in the game are. For testing purpose.

Lets say you want to use the MP's battle model. I believe the ID here is 0x0010. Then if ID 1 is XXXX and ID 2 is YYYY then ID 3 will be 0x0010.

Enemy Data (skills, items, elements etc)
The next natural step would be to fill in the enemy data. Information on this is found HERE! To do this easy just use a scene editor. There are some parts of the enemy data that are unknown on the wiki but I'll try to explain 'em.
Code: [Select]
OFFSET    LENGTH    DESCRIPTION
0x0038    16        I call this one "Body Animation" (BM). There are things tied to the attack data too.
                    I think all enemies got 0x03 as the "standard" attack BM, and 0x04 is usually used as
                    the magical and/or secondary etc. attack. Each BM is tied to an attack ID in the same order.
                    That means that the 1st attack ID use the 1st BM.  Each BM is 1 byte, 16 in all.
0x0048    32        This isn't unknown, but the length is wrong (I think). 'Cause each ID is 2 bytes (see wiki).
???????    6        I don't remember where this starts. The 2 1st bytes are the attack ID
                    that the enemy uses under Berserk and Confuse. All 3 IDs will appear in the Manip. menu.
                    I'll find out where it was when I return.
0x00A2   1 or 2    I don't actually know what this byte is, but it might be what attack Odin will use.
                    0xFF10 means normal and 0xFF20 means the lance attack. I haven't tested this though.

Attack ID list
The next step is to to add your enemy's attack IDs in the attack ID list which starts at offset 0x0840 in each scene. Write 'em down in the same order as you did in your enemy's data (Enemy data). It doesn't have to be, but for the reason of order it's best to do this. If this confuses you let me explain a bit deeper:
In the Enemy Data you make the enemy's attack IDs. Those attack IDs should also be in the general attack ID list at offset 0x0840. Each attack that are stored in the scene are above this list, and the order here (Attack data and the ID list) is the important ones. Attacks are given their ID to the corresponding # ID from the ID list. In other words, the 1st attack will be referred to as the 1st ID from the attack ID list in the AI. That means that enemies in the scene can indeed share attacks. In the Enemy data you just set what attack IDs the enemy use. And those IDs appear again in the AI.
And if you got the gist of this you understand that the Attack names are stored in the same order.

Attack Data (moves enemies have)
Next is to add the attacks. Naturally the enemy should have as many attacks as attack IDs (duh). The attack data start at offset 0x04C0, and each attack is 28 bytes long. I'll try to explain every byte.
Code: [Select]
2 of Safer's attacks:

AC: Accuracy
IA: Impact animation
TA: Target Animation
MP: MP cost
IS: Impact sound
CA: Camera movement.
TG: Target
ID: Attack's ID
TD: Type damage. 11 = physical 22 = magical
PW: Attack power.
RT: Restore type. 00 = restore HP 01 = restore MP
SE: Status effect. 3F = 100% cause status 7F = 100% remove status.
AT: Additional targets??
NU: Number of times the attack takes effect in 1 command IF AT = 00. Please note this will not make the enemy perform it more times.
ST: Status Afflictions
EL: Element
SP: Special (reflectable, unblockable etch).

AC|IA|TA|--|-MP--|-IS--|----CA-----|TG|ID|TD|PW|RT|SE|AT|NU|----ST-----|-EL--|-SP--|
FF 0B 00 FF 00 00 E2 00 FF FF FF FF 01 FF 11 18 FF 3F FF FF 00 00 00 06 00 04 FF FF (Physical Wing Attack. Has no name)
FF FF 00 FF 00 00 FF FF FF FF FF FF 05 75 22 19 FF FF FF FF FF FF FF FF 00 00 FF FF Deen

Attack Names
Attack names are easy. Each attack is 32 bytes long. FF text encoding can be found HERE! Or use a tool.

AI
And now for the tedious part: The AI. Each enemy in the game got it's unique AI. The AI script has a number of opcodes and is, well, "stack based". Opcodes can, for instance, push values or addresses on the stack, and then use those to execute commands, create variables, set addresses, check equality etc.

The AI section starts at offset 0x0E80. The 1st 3x2 bytes are the general pointers, which points to each enemy's AI section. 0xFFFF means no section. The 1st pointer will naturally always be 0x0006. As well will the 1st enemy's AI start at offset 0x0E86, 'cause there are 6 bytes of pointers. Each enemy's AI section always starts with 32 bytes of pointers to a specified AI section: Setup, Main, Counter General etc. The pointers hare are also 2 bytes, thus it's 16 pointers in total. An enemy hardly ever use more than 3-4 pointers. 0xFFFF means no section.

The 1st pointer points to the Setup section. (1st 2 bytes)
The 2nd pointer points to the Main section. (next 2 bytes etc)
The 3rd pointer points to the Counter General section.
The 4th pointer points to the Counter Death section.
The 5th pointers points to the Counter Physical section.
The 6th pointer points to the Counter Magical section.
The ?th pointer points to the Pre-Turn section.

I have no clue at the moment what the others are, but they are barely used at all.
For the actual opcodes you'll have to wait 'till I get home (it's funny how I always end up in these situations during holidays lol). It's possible to just copy another enemy's AI, but keep in mind you have that the AI contain the attack ID as well before an attack is executed. Replace those with the current attack IDs.

Formations
Moving on to formations. There are room for max 6 enemies in each formation, and it's 4 formation in each scene. The four different formations starts at offsets 0x0118, 0x0178, 0x01E8 and 0x0238.  Each enemy has 16 bytes each that decides different things.
Code: [Select]
ID = enemy's ID
XX = enemy's X pos
YY = enemy's Y pos
ZZ = enemy's Z pos
RO = enemy's row
bytes:
ID ID X? XX Y? YY Z? ZZ RO ??->
I'm not sure about the rest and X? Y? Z? as wel.

BOSSES?
Now that your enemy is done, you may want to make some bosses too? Well that requires field editing. There are tools for that too.
Well it is easier than it sounds (at least for the PC version I dunno for PlayStation). You kinda have to find some place in the field script that can trigger a "monster-in-a-box", e.g when picking up items etc.
1st you need to know the formation ID you want to trigger. Each scene has 4 formations.
Scene1 has formation ID 0-3
Scene2 has formation ID 4-7... and so on...
And then insert a line in the field script with opcode 0x70. This opcode takes 2 arguments. Mak the 1st 0x00 and the 2nd equal the ID you want in hex. General info 'bout the field is found HERE! Meteor is a great tool for this. The opcode name is BATTLE.

I'm sorry if this was confusing 'but it should at least get you started.

« Last Edit: 2008-09-20 04:51:41 by gjoerulv »

LJH

  • *
  • Posts: 132
    • View Profile
Re: Creating Enemies
« Reply #7 on: 2008-03-21 02:09:35 »
Seems good. :)

Although can I ask how statuses (both in attacks and in enemies themself) are defined?

Also - does immunity to poison status automatically give immunity to poison element? I can't seem to negate Midgar Zolom's immunity to Poison element through any means of editing the elemental data...
« Last Edit: 2008-03-21 05:08:18 by LJH »

LJH

  • *
  • Posts: 132
    • View Profile
Re: Creating Enemies
« Reply #8 on: 2008-03-22 13:33:56 »
Okay, this is even weirder... usually he isn't immune to it, but after editing, he is... >_>

gjoerulv

  • *
  • Posts: 1225
  • me
    • View Profile
    • My Youtube
Re: Creating Enemies
« Reply #9 on: 2008-03-22 21:23:31 »
In attack date the bytes are added. In enemy data they are subtracted. And yes, making it immune to poison effects the element as well.

LJH

  • *
  • Posts: 132
    • View Profile
Re: Creating Enemies
« Reply #10 on: 2008-03-22 23:08:08 »
So there wouldn't be a way to have an enemy immune to Poison status but still vunerable to the element?

(Although that being said, I never added immunity to the status either. Maybe it was a problem with Scenester - when using Hojo to edit from scratch, this problem didn't happen)

Akari

  • *
  • Posts: 766
    • View Profile
Re: Creating Enemies
« Reply #11 on: 2008-03-23 07:47:46 »
Quote
The 1st pointer points to the Setup section. (1st 2 bytes)
The 2nd pointer points to the Main section. (next 2 bytes etc)
The 3rd pointer points to the Counter General section.
The 4th pointer points to the Counter Death section.
The 5th pointers points to the Counter Physical section.
The 6th pointer points to the Counter Magical section.
The ?th pointer points to the Pre-Turn section.

As I see there are only 8 direct called scripts per unit in game (0 - 7).

Script 7 called before any action with priority 1-6 take place. Action with priority 0 will not be activate this. Priority 0 used for counter actions (maybe with something else).

Other scripts can be called manually fron other scripts using Ai Opcode 92 (run cmd) with action 0x22 (usually they use 0x20 whick is enemy attack, 0x24 - play animation). 0x22 seems run script defined with second argument for all entity in battle. Mainly it used for enemy escape from battle. All actions added with this runned script will have priority 0.
« Last Edit: 2008-03-23 07:59:47 by Akari »

gjoerulv

  • *
  • Posts: 1225
  • me
    • View Profile
    • My Youtube
Re: Creating Enemies
« Reply #12 on: 2008-03-24 17:27:05 »
As I see there are only 8 direct called scripts per unit in game (0 - 7).

Script 7 called before any action with priority 1-6 take place. Action with priority 0 will not be activate this. Priority 0 used for counter actions (maybe with something else).

Other scripts can be called manually fron other scripts using Ai Opcode 92 (run cmd) with action 0x22 (usually they use 0x20 whick is enemy attack, 0x24 - play animation). 0x22 seems run script defined with second argument for all entity in battle. Mainly it used for enemy escape from battle. All actions added with this runned script will have priority 0.

Yup there are only 8 used in game. The last counter is used some places, and if I remember correctly Safer use this to remove self. Do you have an example where 0x22 is used?

Akari

  • *
  • Posts: 766
    • View Profile
Re: Creating Enemies
« Reply #13 on: 2008-03-24 20:00:51 »
As I see there are only 8 direct called scripts per unit in game (0 - 7).

Script 7 called before any action with priority 1-6 take place. Action with priority 0 will not be activate this. Priority 0 used for counter actions (maybe with something else).

Other scripts can be called manually fron other scripts using Ai Opcode 92 (run cmd) with action 0x22 (usually they use 0x20 whick is enemy attack, 0x24 - play animation). 0x22 seems run script defined with second argument for all entity in battle. Mainly it used for enemy escape from battle. All actions added with this runned script will have priority 0.

Yup there are only 8 used in game. The last counter is used some places, and if I remember correctly Safer use this to remove self. Do you have an example where 0x22 is used?

I didn't look at ai script directly, but I look at Terence Fergusson enemy mechanics. He note some misterious 0x22 action in enemies like Yuffie, Cactuar, Ultimate Weapon, Diamond Weapon and Sephiroth. Everyone use it to run away from battle. Quick look at 0x22 action function give me idea that it just run given script to all units in battle. I want to look at this script myself, but I dont have enough time. Very busy with reversing sense algorithm and converting FFVII models to Ogre3d format.

gjoerulv

  • *
  • Posts: 1225
  • me
    • View Profile
    • My Youtube
Re: Creating Enemies
« Reply #14 on: 2008-03-25 17:08:28 »
ok thanks! Appreciate it!  :-D