Changes
Jump to navigation
Jump to search
Not complete. I'll come back to this later and make links to it.
<p>''In this page, an "actor" is defined as an entity instance in a battle (scene). The "current actor" is an actor that is executing a script or performing an action. An "active actor" is one that can perform actions. An "action" is defined as an event with a visual representation in battle (eg. an attack or a position change).''</p>
Most of the complexities of AI scripts use different memory addresses to make decisions based on the actor performing an action or the target of an action. There are three categories of address each spanning a separate useable<sup>1</sup> address ranges.
<p>
{| border="1" cellspacing="1" cellpadding="3" style="border: 1px solid black; border-collapse: collapse;"
! style="background:rgb(204,204,204)" | Range
! style="background:rgb(204,204,204)" | Usage
|-
| 0x0000 - 0x1FFF
| Random Access Variables. No initial value or significance to battle.
|-
| 0x2000 - 0x21DF
| Globally accessible values. Values are the same for all actors.
|-
| 0x4000 - 0x433F
| Actor specific values. Contains information such as HP, MP, Level, stats, etc. One for each Actor, 10 in all.
|}
</p>
<p>
Each address references a specific bit of memory rather than a byte which means individual bits can be manipulated without using BIT-wise operations in script. Every 8 address values is the beginning of a byte (ie. 0x0000, 0x0008, etc.). The code used to access an address determines whether a bit, byte, word, or dword is being read/written.<br/>
Addresses must be accessed directly. There is no pointer support to these values accessible in AI scripts.<br/>
</p>
==Random Access Variables==
These values are used between scripts and not automatically set/cleared at any time during battle. If an address is set to a specific value in one script, it will retain that value when the next script begins. They can all be treated as having no initial value.
==Global Values==
Generally these contain information about the battle itself. These values are the same when any actor accesses them, although they do change to reflect the battle's events.
{| border="1" cellspacing="1" cellpadding="3" style="border: 1px solid black; border-collapse: collapse;"
! style="background:rgb(204,204,204)" | Address
! style="background:rgb(204,204,204)" | Value
|-
| 0x2000
| Command Index of last action performed
|-
| 0x2008
| Action Index of last action performed
|-
| 0x2010
| Memory 1/2 Bank access value
|-
| 0x2018
| DUMMY. Used in one script in a test enemy.
|-
| 0x2020
| Battle Formation (side, pincer, pre-emptive, etc.)
|-
| 0x2038
|style="background:rgb(255,255,204)" | Limit Level. Only used by Vincent during transformation.
|-
| 0x2050
| Active Actor List. A bit mask of all active (scripts enabled) actors.
|-
| 0x2060
| Single bit indicating which actor owns the script that is currently executing. Changes as scripts are triggered.
|-
| 0x2070
| Bit mask of actors indicating targets of the current action. Should be set prior to any action.
|-
| 0x2080
| Bit mask of actors indicating actors the current actor considers as allies. Changes as scripts are triggered.
|-
| 0x2090
| Bit mask of ''active'' actors indicating actors the current actor considers as allies. Changes as scripts are triggered.
|-
| 0x20A0
| Bit mask of actors indicating actors the current actor considers as enemies. Changes as scripts are triggered.
|-
| 0x20B0
| Bit mask of ''active'' actors indicating actors the current actor considers as enemies. Changes as scripts are triggered.
|-
| 0x20C0
| Bit mask of active player's characters
|-
| 0x20E0
| Bit mask of all active and inactive actors present in the battle.
|-
| 0x2110
|style="background:rgb(255,255,204)" | Set of flags indicating battle rewards (functions unknown).
|-
| 0x2120
| Elements of last performed action.
|-
| 0x2140
| Formation Index of the current battle.
|-
| 0x2150
| Index of last performed action.
|-
| 0x2160
|style="background:rgb(255,255,204)" | Some sort of flags (unknown effect).
|-
| 0x2170
| [[FF7/Battle/Special Attack Flags|Special Attack Flags]].
|-
| 0x2180
|style="background:rgb(255,255,204)" | Unknown
|-
| 0x21A0
|style="background:rgb(255,255,204)" | Something to do with String display (not sure what).
|-
| 0x21C0
| Party's Gil
|}
==Actor Specific==
These values are reflections of a given actor's status. They include some obvious things like Statuses, Level, HP, MP, etc and a few abstract things like Animation IDs for reactions. Every actor has their own copy of these values that reflects their instance. These values are accessed by masking the address with a specific actor(s) in the script.
{| border="1" cellspacing="1" cellpadding="3" style="border: 1px solid black; border-collapse: collapse;"
! style="background:rgb(204,204,204)" | Address
! style="background:rgb(204,204,204)" | Value
|-
| 0x4000
| Bitmask of current [[FF7/Battle/Status_Effects|Statuses]]
|-
| 0x4020
| Set of flags relating to situation (defending, backrow, etc.).
|-
| 0x4040
|style="background:rgb(255,255,204)" | Unknown
|-
| 0x4048
| Level
|-
| 0x4058
| Greatest Elemental Damage modifier (No damage, half, normal, etc.)
|-
| 0x4060
|style="background:rgb(255,255,204)" | Unknown
|-
| 0x4068
| Physical Attack Power
|-
| 0x4070
| Magic Attack Power
|-
| 0x4078
| Physical Evade
|-
| 0x4080
| Idle Animation ID
|-
| 0x4088
| Damaged Animation ID
|-
| 0x4090
| Back Damage Multiplier
|-
| 0x4098
| Model Size (default is 16)
|-
| 0x40A0
| Dexterity
|-
| 0x40A8
| Luck
|-
| 0x40B0
|style="background:rgb(255,255,204)" | Unknown
|-
| 0x40B8
|style="background:rgb(255,255,204)" | Set to equal 0x4060 under unknown condition
|-
| 0x40C0
| Target(s) of last action performed by actor
|-
| 0x40D0
| Previous Attacker
|-
| 0x40E0
| Previous Physical Attacker
|-
| 0x40F0
| Previous Magical Attacker
|-
| 0x4100
| Physical Defense Rating
|-
| 0x4110
| Magical Defense Rating
|-
| 0x4120
| Index of actor
|-
| 0x4130
| Absorbed Elements
|-
| 0x4140
| Current MP
|-
| 0x4150
| Max MP
|-
| 0x4160
| Current HP
|-
| 0x4180
| Max HP
|-
| 0x4220
| Initial Statuses
|-
| 0x4268
| Magic Evade
|-
| 0x4270
| Row
|-
| 0x4278
|style="background:rgb(255,255,204)" | Unknown
|-
| 0x4280
| Gil stolen (Enemies only)
|-
| 0x4290
| Item stolen (Enemies only)
|-
| 0x42A0
|style="background:rgb(255,255,204)" | Unknown
|-
| 0x42B0
| AP actor is worth
|-
| 0x42C0
| Gil actor is worth
|-
| 0x42E0
| EXP actor is worth
|}
<br/>
<p>
NOTES:<br/>
1 - These values are only checked by the minimum value. Technically, a value of 0xFFFF could be used as an address, but that would result in a memory leak producing erratic results.</p>
Most of the complexities of AI scripts use different memory addresses to make decisions based on the actor performing an action or the target of an action. There are three categories of address each spanning a separate useable<sup>1</sup> address ranges.
<p>
{| border="1" cellspacing="1" cellpadding="3" style="border: 1px solid black; border-collapse: collapse;"
! style="background:rgb(204,204,204)" | Range
! style="background:rgb(204,204,204)" | Usage
|-
| 0x0000 - 0x1FFF
| Random Access Variables. No initial value or significance to battle.
|-
| 0x2000 - 0x21DF
| Globally accessible values. Values are the same for all actors.
|-
| 0x4000 - 0x433F
| Actor specific values. Contains information such as HP, MP, Level, stats, etc. One for each Actor, 10 in all.
|}
</p>
<p>
Each address references a specific bit of memory rather than a byte which means individual bits can be manipulated without using BIT-wise operations in script. Every 8 address values is the beginning of a byte (ie. 0x0000, 0x0008, etc.). The code used to access an address determines whether a bit, byte, word, or dword is being read/written.<br/>
Addresses must be accessed directly. There is no pointer support to these values accessible in AI scripts.<br/>
</p>
==Random Access Variables==
These values are used between scripts and not automatically set/cleared at any time during battle. If an address is set to a specific value in one script, it will retain that value when the next script begins. They can all be treated as having no initial value.
==Global Values==
Generally these contain information about the battle itself. These values are the same when any actor accesses them, although they do change to reflect the battle's events.
{| border="1" cellspacing="1" cellpadding="3" style="border: 1px solid black; border-collapse: collapse;"
! style="background:rgb(204,204,204)" | Address
! style="background:rgb(204,204,204)" | Value
|-
| 0x2000
| Command Index of last action performed
|-
| 0x2008
| Action Index of last action performed
|-
| 0x2010
| Memory 1/2 Bank access value
|-
| 0x2018
| DUMMY. Used in one script in a test enemy.
|-
| 0x2020
| Battle Formation (side, pincer, pre-emptive, etc.)
|-
| 0x2038
|style="background:rgb(255,255,204)" | Limit Level. Only used by Vincent during transformation.
|-
| 0x2050
| Active Actor List. A bit mask of all active (scripts enabled) actors.
|-
| 0x2060
| Single bit indicating which actor owns the script that is currently executing. Changes as scripts are triggered.
|-
| 0x2070
| Bit mask of actors indicating targets of the current action. Should be set prior to any action.
|-
| 0x2080
| Bit mask of actors indicating actors the current actor considers as allies. Changes as scripts are triggered.
|-
| 0x2090
| Bit mask of ''active'' actors indicating actors the current actor considers as allies. Changes as scripts are triggered.
|-
| 0x20A0
| Bit mask of actors indicating actors the current actor considers as enemies. Changes as scripts are triggered.
|-
| 0x20B0
| Bit mask of ''active'' actors indicating actors the current actor considers as enemies. Changes as scripts are triggered.
|-
| 0x20C0
| Bit mask of active player's characters
|-
| 0x20E0
| Bit mask of all active and inactive actors present in the battle.
|-
| 0x2110
|style="background:rgb(255,255,204)" | Set of flags indicating battle rewards (functions unknown).
|-
| 0x2120
| Elements of last performed action.
|-
| 0x2140
| Formation Index of the current battle.
|-
| 0x2150
| Index of last performed action.
|-
| 0x2160
|style="background:rgb(255,255,204)" | Some sort of flags (unknown effect).
|-
| 0x2170
| [[FF7/Battle/Special Attack Flags|Special Attack Flags]].
|-
| 0x2180
|style="background:rgb(255,255,204)" | Unknown
|-
| 0x21A0
|style="background:rgb(255,255,204)" | Something to do with String display (not sure what).
|-
| 0x21C0
| Party's Gil
|}
==Actor Specific==
These values are reflections of a given actor's status. They include some obvious things like Statuses, Level, HP, MP, etc and a few abstract things like Animation IDs for reactions. Every actor has their own copy of these values that reflects their instance. These values are accessed by masking the address with a specific actor(s) in the script.
{| border="1" cellspacing="1" cellpadding="3" style="border: 1px solid black; border-collapse: collapse;"
! style="background:rgb(204,204,204)" | Address
! style="background:rgb(204,204,204)" | Value
|-
| 0x4000
| Bitmask of current [[FF7/Battle/Status_Effects|Statuses]]
|-
| 0x4020
| Set of flags relating to situation (defending, backrow, etc.).
|-
| 0x4040
|style="background:rgb(255,255,204)" | Unknown
|-
| 0x4048
| Level
|-
| 0x4058
| Greatest Elemental Damage modifier (No damage, half, normal, etc.)
|-
| 0x4060
|style="background:rgb(255,255,204)" | Unknown
|-
| 0x4068
| Physical Attack Power
|-
| 0x4070
| Magic Attack Power
|-
| 0x4078
| Physical Evade
|-
| 0x4080
| Idle Animation ID
|-
| 0x4088
| Damaged Animation ID
|-
| 0x4090
| Back Damage Multiplier
|-
| 0x4098
| Model Size (default is 16)
|-
| 0x40A0
| Dexterity
|-
| 0x40A8
| Luck
|-
| 0x40B0
|style="background:rgb(255,255,204)" | Unknown
|-
| 0x40B8
|style="background:rgb(255,255,204)" | Set to equal 0x4060 under unknown condition
|-
| 0x40C0
| Target(s) of last action performed by actor
|-
| 0x40D0
| Previous Attacker
|-
| 0x40E0
| Previous Physical Attacker
|-
| 0x40F0
| Previous Magical Attacker
|-
| 0x4100
| Physical Defense Rating
|-
| 0x4110
| Magical Defense Rating
|-
| 0x4120
| Index of actor
|-
| 0x4130
| Absorbed Elements
|-
| 0x4140
| Current MP
|-
| 0x4150
| Max MP
|-
| 0x4160
| Current HP
|-
| 0x4180
| Max HP
|-
| 0x4220
| Initial Statuses
|-
| 0x4268
| Magic Evade
|-
| 0x4270
| Row
|-
| 0x4278
|style="background:rgb(255,255,204)" | Unknown
|-
| 0x4280
| Gil stolen (Enemies only)
|-
| 0x4290
| Item stolen (Enemies only)
|-
| 0x42A0
|style="background:rgb(255,255,204)" | Unknown
|-
| 0x42B0
| AP actor is worth
|-
| 0x42C0
| Gil actor is worth
|-
| 0x42E0
| EXP actor is worth
|}
<br/>
<p>
NOTES:<br/>
1 - These values are only checked by the minimum value. Technically, a value of 0xFFFF could be used as an address, but that would result in a memory leak producing erratic results.</p>