Anonymous

Changes

From Final Fantasy Inside

FF7/Battle/Battle scenes

3,717 bytes added, 05:11, 23 May 2019
m
84 revisions imported
We have 1024 possible battle numbers: 0 - 1023. Each group of *4* Battle Numbers refers to a
particular Scene file: for instance, Battles 0-3 refer to File 0 in Scene.bin, Battles 4-7 refer to File 1 in Scene.bin, and so forth.
 
 
====Japanese format====
 
In the japanese scene.bin, ennemies names and attacks names have a size of 16 bytes, instead of 32 bytes.
 
===General file format===
| 0x0298
| 184 bytes
| Enemy Data 1 ([[#Enemy_data_format|format explainationexplanation]])
|-
| 0x0350
| 0x04C0
| 32 * 28 bytes
| Attack Data (32 records) ([[FF7/Attack_data|format explanation]])
|-
| 0x0840
|-
| 0x0C80
| 512 2 bytes| FFh PaddingFormation 1 AI Script Offset|-| 0x0C82| 2 bytes| Formation 2 AI Script Offset|-| 0x0C84| 2 bytes| Formation 3 AI Script Offset|-| 0x0C86| 2 bytes| Formation 4 AI Script Offset|-| 0x0C88| 0 - 504 bytes| Beginning of Formation AI Data ([[#AI_Data|format explanation]])
|-
| 0x0E80
|-
| 0x0E86
| varies0 - 4090 bytes| Beginning of AI Data ([[#AI_Data|format explainationexplanation]])
|}
==== Battle Formation Data ====
4 Possible battle formations per scene, maximum of 6 monsters enemies per battle. Each monster enemy entry contains the following data:
{| border="1" cellspacing="1" cellpadding="3" style="border: 1px solid black; border-collapse: collapse;"
! style="background:rgb(204,204,204)" align="center" | Offset
! style="background:rgb(204,204,204)" align="center" | Length
! style="background:rgb(204,204,204)" align="center" colspan="2" | Description
|-
| 0x00
| 2 bytes
| Monster colspan="2" | Enemy ID
|-
| 0x030x02
| 2 bytes
| colspan="2" | position X
|-
| 0x04
| 2 bytes
| colspan="2" | position Y
|-
| 0x06
| 2 bytes
| colspan="2" | position Z
|-
| 0x08
| 2 bytes
| colspan="2" | Row
|-
| 0x0A
| 2 bytes
| Contains information likely related to rowcolspan="2" | [[#Binary_"Cover_Flags"|Binary "Cover flags"]]
|-
| 0x0C
| 4 bytes
| Gets mapped to battle unit structure 4020colspan="2" | Initial condition flags. Only last 5 bits are considered.|-| style="background:rgb(204,204,255)" colspan ="2" rowspan="5" || 0x0001| Visible|-| 0x0002| Indicates initial direction facing if players get a side attack.|-403F and contains flags | style="background:rgb(255,255,204)" | 0x0004| style="background:rgb(details pending255,255,204)" | Unknown|-|0x0008| Targetable|-|0x0010| Main Script Active
|}
| 0x0028
| 8 bytes
| Element types (8 records):<br>00h - Fire<br>01h - Ice<br>02h - Bolt<br>03h - Earth<br>04h - Bio<br>05h - Gravity<br>06h - Water<br>07h - Wind<br>08h - Holy<br>09h - Health<br>0Ah - Cut<br>0Bh - Hit<br>0Ch - Punch<br>0Dh - Shoot<br>0Eh - Scream<br>0Fh - HIDDEN<br>10h-1Fh - No Effect<br>20h-3Fh - [[FF7/Battle/Status Effects|Statuses]] (Damage done by actions that inflict these statuses will be modified)<br>FFh - No element
|-
| 0x0030
| 0x0038
| 16 bytes
| Attack action script id Action animation index (1 byte each).
|-
| 0x0048
| 32 bytes
| Enemy Attack ID's (2 bytes each).
|-
|style="background:rgb(255,255,204255)" | 0x00580x0068|style="background:rgb(255,255,204255)" | 38 32 bytes|style="background:rgb(255,255,204255)" | Unknown dataEnemy Attacks [[FF7/Battle/Camera Movement Id List|Camera Movement Id]] for single and multiple targets (2 bytes each). If set this will overwrite camera movement set in attack itself.
|-
| 0x0088
|style="background:rgb(255,255,204)" | 0x00B4
|style="background:rgb(255,255,204)" | 4 bytes
|style="background:rgb(255,255,204)" | Unknown[Always FFFFFFFFh]
|}
 
====Formation ID====
| Magical Counter
|-
|style="background:rgb(255,255,204)" | 0x0C|style="background:rgb(255,255,204)" | Party Member Death?Battle End
|-
| 0x0E
| PostPre-AttackAction Setup
|-
|style="background:rgb(255,255,204)" | 0x10
|style="background:rgb(255,255,204)" | UnusedCustom Event 1
|-
|style="background:rgb(255,255,204)" | 0x12
|style="background:rgb(255,255,204)" | UnusedCustom Event 2
|-
|style="background:rgb(255,255,204)" | 0x14
|style="background:rgb(255,255,204)" | UnusedCustom Event 3
|-
|style="background:rgb(255,255,204)" | 0x16
|style="background:rgb(255,255,204)" | UnusedCustom Event 4
|-
|style="background:rgb(255,255,204)" | 0x18
|style="background:rgb(255,255,204)" | UnusedCustom Event 5
|-
|style="background:rgb(255,255,204)" | 0x1A
|style="background:rgb(255,255,204)" | UnusedCustom Event 6
|-
|style="background:rgb(255,255,204)" | 0x1C
|style="background:rgb(255,255,204)" | UnusedCustom Event 7
|-
| 0x1E
| Post-BattleCustom Event 8
|}
It's Its structure and opcodes are described [[FF7/Battle/Battle_Scenes/Battle_Script|here]].
NOTES:
*A monster's total AI size will always be an even number of bytes. If the actual scripts are an odd number, a single NULL (FFh) will be placed before the next monster's AI header (may not be required).
*Battle begins after all characters' Initialize scripts have been run (order to be determinedPlayers first, then enemies, then formation).*Party Member Death The only character with "Battle End" is only used on in Cloud's AI. It's meant to lower the character's Love Points with him if he lets them die or he dies with them in the party (not sure which). Script never seems to activate on other characters and may not even execute on Cloud's.*PostPre-Attack Action Event occurs immediately after on all battle participants prior to any character performs actions performed by any attack to any target participant regardless whether damage is dealt of actor or target. This includes all executed 92 commands that have a command index of less than 21h. If any 92 commands are called in this section, the command that caused this script to run has priority.*The Custom Event sections are notcalled by any event. Script owner can be flagged as dead and They only occur if they are called with the 92 command. 60 22 <- command index "Run script" 60 0X <- where X is the script section in hex (eg. X = 8 would still activate. It's priority call Custom Event 1 since it is higher than that of other Counter Scripts.script id 08 [not to be confused with offset]) 92 *Post-Battle Custom Event 8 is only used on Mystery Ninja (all), Ultimate Weapons in location other than above Cosmo Canyon, Safer Sephiroth, and the final "showdown" between Cloud and Sephiroth. These characters have scripts on them that do not remove them from battle when they are defeated. This Script section is used to remove them from the battle probably to clean up memory. Executed after "victory dance"*Custom Events 1-7 may not work.(not thoroughly tested)*The order of scripts executed after an attack ::*Beginning of battle::Pre-Battle (all participants):*Once a "main-script enabled" enemy's time gauge isfull:::Main (Enemy performs action):*Pre-Attack (If enemy script uses a 92 command with a command index of 20h or less)::Pre-Action Setup (occurs on all participants):*#Post-Attack:*#Death Counter (If script owner died, execution stops here):*#General Counter (If script owner was targetExecuted by all targets):*#Physical Counter/Magical Counter (Executed by all targets depending on damage type):*Battle ends::Battle End (all participants) ==== Binary "Cover Flags" ==== These flags are used in conjunction with row to determine if a target can be selected as the target of a '''short-range attack'''. The determination of this is worked out in this way:An enemy exists in row 1 and another in row 2. If the enemy in row 1 shares a cover flag with the enemy in row 2 then the enemy in row 2 cannot be targeted until all enemies in row 1 that share a cover flag with the row 2 enemy is defeated.It works like this. Two active enemies exist, A and B. If ((B's row > A's row) and (B's cover flags AND A's cover flags) > 0) then enemy B cannot be targeted by short-range attacks.for any enemies A and B.<br />Example:<br />Consider the Battery Cap x6 battle in the forest between Nibelheim and Rocket Town. Their cover flags (in binary) are: Row 1: 00100 Row 2: 00110 01100 Row 3: 00011 00100 11000The battery caps in row 2 cannot be targeted by a short-range attack until the one in row 1 has been defeated because they share the 0x4 cover flag. Once row 1 has been cleared: Row 2: 00110 01100 Row 3: 00011 00100 11000The battery cap on left in row 2 covers the left two in row 3 because it shares flag 0x4 with the one in the middle and flag 0x2 with the one on the far left. As long as it is active these in row 3 cannot be targeted.Similarly, the battery cap on the right in row 2 shares the 0x4 flag with the middle of row 3 and the 0x8 flag with the far right of row 3 so these cannot be targeted until the right side of row 2 is defeated.<br />It is also necessary to note that because row 1 does not share any flags with the extreme right and left of row 3, they can be targeted if the corresponding enemy in row 2 is defeated even if the row 1 enemy is still active.<br />Also of note is that enemies in the same row that share cover flags are not considered.<br />Only the first five bits may be considered even though the value is stored as a word.<br />
== Useful downloads ==