Field File Section 7: Encounter - niemasd/PyFF7 GitHub Wiki
The Encounter section contains information about encounters by referencing battle IDs and providing probabilities for each type of encounter required. This section always consists of two 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 total table length (including both) is always 48 bytes. This wiki is a useful reference for the Encounter section.
4 bytes: Section Length
- This is a 4-byte unsigned integer denoting the total length (in bytes) of this section
Encounter Table 1
1 byte: Enabled
- The first byte (unsigned integer) 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
1 byte: Rate
- The second byte (unsigned integer) signifies the main encounter rate
- This ranges from
0xFF
= 255 (battles occur infrequently) to0x01
= 1 (battles occur very frequently)- If this table is not enabled (see Enabled), this will be 0 (it causes division by 0)
20 bytes: Encounters
- Next are 10 encounter structures, are divided into 2 groups ("Standard" and "Special")
- There are 6 "Standard" encounters and 4 "Special" encounters
- Each encounter is 2 bytes
- The 6 leftmost (i.e., most-significant) bits denote the probability of the encounter
- This is an unsigned integer: the true probability is simply this integer divided by the total of all encounters in the table
- The 10 rightmost (i.e., least-significant) bits denote the ID of the battle.
- The 6 leftmost (i.e., most-significant) bits denote the probability of the encounter
2 bytes: Padding
- The last 2 bytes of the table are just padding
Encounter Table 2
Encounter Table 2 is identical in structure to Encounter Table 1.