Anonymous

Changes

From Final Fantasy Inside

FF7/Field/Encounter

5 bytes added, 00:44, 29 March 2014
no edit summary
The encounter section provides encounter data for the field by referencing [[FF7/Battle/Battle_Scenes|battle 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.
<cpp> struct SECTION_ENCOUNTER { u32 section_length; /* 0x30 */ ENC_TABLE tables[2]; };</cpp>
== Encounter Table Structure ==
<cpp> struct ENC_TABLE { u8 enabled; u8 rate; ENCOUNTER enc_standard[6]; ENCOUNTER enc_special[4]; u16 _pad; }</cpp>
The first byte of the table provides a switch to signify whether this table is used or not. If set to ''0'' encounters will not be used, regardless of the table contents; ''1'' signifies the table will be used. The second byte signifies the main encounter rate, and ranges from 0xFF (battles occur infrequently) to 0x01 (battles occur very frequently). 0x00 value causes a division by zero.
== 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;u16 encounter_id = enc_entry & 0x03FF;
< /cpp/ Create from two-byte value u16 enc_entry; /* holds the read value */ u8 prob = enc_entry >>10; u16 encounter_id = enc_entry & 0x03FF;
Each individual two-byte encounter entry is further split into two groups of bits.
Anonymous user