Changes
From Final Fantasy Inside
1,260 bytes added,
17:08, 1 February 2007
=== Section 7 (provides encounter data for the field by referencing [[User:Terence FergussonFF7/Battle/Battle_Scenes|Terence Fergussonbattle IDs]]) ===and providing probabilites for each type of encounter required. The section consists of two ''encounter tables'' that hold sets of these battle configurations; these tables may be switched between using field scripting. The two encounter tables are contiguous and follow directly after the section's length description; due to the presence of the two encounter tables regardless of whether they are used or not, the section length is always 48 bytes.
As stated, Section 7 is the Encounter listing, and is generally 48 bytes long (not including the Length dword). I've not even started to decrpyt what the other bytes mean around there... I suspect encounter rates and other things. Each encounter is stored something like: xxxxxxxx yyyyyyxx, where the 'x's are the standard Battle ID we're familiar with, and the 'y's are something connected to that specific encounter. Encounters where you can get ambushed appear to be held seperately from the others, too, starting at... what... 0x14? Unsure.<cpp>struct SECTION_ENCOUNTER{ u32 section_length; /* 0x30 */ ENC_TABLE tables[2];};</cpp>
First, every Field file's Encounter section is 48 bytes long (52 if you include the size). It's then split into definite partitions:
0x00: == Encounter Data 1, possibly enounter Table Structure == <cpp>struct ENC_TABLE{ u8 enabled; u8 rate in 2nd bytes? (2 bytes); ENCOUNTER enc_standard[6]; ENCOUNTER enc_special[4]; u16 _pad;}</cpp> 0x02-0x0D: Encounter+Chance(?) bytes, as stated before. The total first byte of the table provides a switch to signify whether this table is used or not. If set to ''0'Chance(?)' bytes for this part always adds up to 64 if encounters are possible.0x0E-0x17: Secondary encounters. Sometimes blankwill not be used, sometimes gapsregardless of the table contents; ''1'' signifies the table will be used. No clue on The second byte signifies the chance bytesmain encounter rate, or how it relates and ranges from 0xFE (battles occur infrequently) to previous data0x01 (battles occur very frequently).0x18: Encounter Data 2Following these are the ten encounter structures; these are divided into two groups of six and four, same setup as Encounter Data 1detailed below. Very often blankThere is also a further two-byte "padding" value, no idea what this data is used foralignment. 0x1A == Encounter Structure == <cpp>struct ENCOUNTER /* pseudo */{ bit prob[6]; bit encounter_id[10];} // Create from two-byte valueu16 enc_entry; /* holds the read value */u8 prob = enc_entry >> 10;u8 encounter_id = enc_entry & 0x03FF; </cpp> Each individual two-0x25: Encounter+Chance(?) bytes for Encounter Data 2. Again, adds up to 64byte encounter entry is further split into two groups of bits. 0x26-0x2F: Secondary The first six bits denote the probability for this encounter; the sum of all the probabilites for the standard encounters is 64, though this is not the case for Encounter Data 2the special battles. AgainFor further information on how encounter probabilities are used and calculated, no idea what itTerence Fergusson's used [http://db.gamefaqs.com/console/psx/file/final_fantasy_vii_enemy_mech.txt Battle Mechanics Guide] contains detailed information. The second ten bits denote the [[FF7/Battle/Battle_Scenes|ID]] of the battle. == Battle Entry Types == The set of ten battles is split into two groups. The first six battles are generic battles, intended forgeneral use, and whose probabilities must total 64.The final four battles are intended to be used in the following order: * Back Attack 1* Back Attack 2* Pre-Emptive Attack* Attack From Both Sides