Advertisement
Guest User

Untitled

a guest
Jan 28th, 2018
630
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.42 KB | None | 0 0
  1. FF8 Enemy AI Script Analysis
  2.  
  3. FF8's AI script converted into Ruby code.
  4.  
  5. Due to the enemy's behavior is set for each level band, three types of low/med/high are prepared for each (the scripts themselves).
  6.  
  7. In order to understand this, some knowledge of Ruby is necessary.
  8.  
  9. File Name Description:
  10. *-ai-if*/ AI script version readable. "Pseudocode" is referenced here.
  11. *-ai-jmp-*/ AI script close to the original jmp instruction.
  12. psjp-*/ PS Japanese version of the AI.
  13. steam-*/ Steam version of the AI.
  14. readme.ods The file you're reading.
  15. ultimecia-code.txt The enemy's AI for the battle against Ultimecia is too complicated, so it simplifies the pseudocode and gives an explanation to the code and variables. However, the explanation may be a bit redundant.
  16.  
  17. For those that can't be satisfied with the information on the "Ultimecia Sheet"
  18.  
  19. **The difference between "ai-jmp-*/" and "ai-if-*/"
  20. Convert hmp instruction to if-elsif-else-end
  21. Change variable name.
  22. Convert target specification to ".on(...)" after use.
  23. Some binaries are omitted instead.
  24.  
  25.  
  26.  
  27. Each AI Section
  28.  
  29. Section Explanation
  30.  
  31. INT - Executed at the beginning. It's used for variable initialization, appearence, effects, etc.
  32. EXECUTE ATB - Executed when the ATB is filled. Enemy action detail.
  33. COUNTER - Executed when receiving certain behavior. Used for mainly counter/bullet counts.
  34. DEATH - Executed upon death. Used for the adding of another enemy and the final attack in a battle.
  35. PRECOUNTER - Executed immediately upon receiving some actions before the COUNTER section. Used for forced motions, etc.
  36.  
  37. Variable
  38.  
  39. Variable Name Descriptions
  40.  
  41. @varname - *Individual variable. The enemy in battle is held together.
  42. Mostly used for the number of actions and impact count.
  43. @@varname - *Shared variable. All enemies in battle share values.
  44. It's used for Iguion hit count and killing witches battle.
  45. $varname - *GLobal variable. All enemies in battle share values and continue to save said values after a battle ends.
  46. It's used for the Tonberry countdown and the tutorial.
  47.  
  48.  
  49. There are 8 individual variables for every enemy, 8 for shared variables, 8 for global variables, and 8 for global variables throughout the game.
  50.  
  51. All variables are initialized to 0. In the INIT section the AI sometimes is sometimes 0, and assigned to an individual variable or a shared variable, but all variables which are not are initialized to 0.
  52.  
  53. All variables used in the AI script (except verified) are named. Variables whose end is "?" can be regarded as true or false types with 1 being true and 0 being false.
  54.  
  55. End "?" in reference, please forgive me for using characters that can't be used as variable names such as "@ hp <50%?" because it's easier to understand...
  56.  
  57. The names of individual variables and shared variables can be seen on the "Variable Name" sheet. Here we introduce the other global variables:
  58.  
  59. Variable Name / Original Variable Name / Description
  60.  
  61. $defeat_weddgebiggs? $global[0]"D - Encountered Wedge and Biggs in D District Camp.
  62. Biggs (Encounter #2) - Used by the security guards. Their dialogue opening will change and they'll begin using Sleep.
  63.  
  64. $kill_tonverry_count $global[1]" - Tonberries killed.
  65. Used for Tonberries. If the encounter ID 236 is 20 or more, if ID 237 is 50 or more, then the Tonberry King appears.
  66.  
  67. $awarded_GFtonberry? $global[2]"GF - Tonberry GF acquired.
  68. Used for judging Tonberry/Tonberry King's appearence.
  69.  
  70. $ufo_is_broken? $global[3]"UFO? (Destroyed) - Has been defeated.
  71. Used in UFO? (Destroyed). Koyokoyo will appear around the site of Balamb Garden.
  72.  
  73. $bytebug_tutorial? $global[5]" Quistis's tutorial, Byte Bugs have been executed.
  74. Used for Byte Bug.
  75. $bomb_tutorial? $global[5]" Quistis's tutorial, bomb edit.
  76. Used for Bombs.
  77. $rexaur_tutorial? $global[6]" Quistis's tutorial, Arkenodios edit.
  78. Used for Arkeodainas.
  79.  
  80. $irvine_tutorial? $global[7] Irvine's tutorial has been executed.
  81. Used for Thrust Avis / Iguion
  82.  
  83.  
  84. Misc.
  85.  
  86. Most enemies will terminate (wait) their turn without doing anything with a high chance. "if rand(1/3) return end" happens immediately after the start of the EXECUTE section of Red Mousse and Focal Fake.
  87.  
  88. There is no effect like this, however the instruction "@instance[-124] = 0" in the INIT section of the Galbadian Soldier is probably an offset mistake.
  89.  
  90. Hedge Viper uses the ability "Makikitsuki" with the probability of the next turn being 1/2 against the person who attacked using a physical attack.
  91.  
  92. Wedge #2 was supposed to only ignore Biggs #2's friendly fire once when being hit with magic from Biggs #2.
  93. However, it's not the case because ID 135 (Fujin #2) is used instead of ID 134 (Biggs #2) for comparison with last_action.subject as a mistake.
  94.  
  95. BGH251F2#1 when it's at <40% HP, its in Beam Cannon mode, and suicides at <20% HP.
  96.  
  97. In the Witch Wars battles, the witches up to the 9th turn summon the next witch with a 1/2 chance if there is only one witch on the field when their turn happens.
  98.  
  99. Witch #2 has a survivor number of 1 if the standby rate rises from 1/3 to 7/9. Also, every individual uses only Telekinesis, Thundaga, and Esuna.
  100.  
  101. It seems that the helix was originally intended as a counter for "magic other than Libra", not "magic other than Magic command".
  102.  
  103. If you use potion on Omega Weapon, make sure to wait for the next turn.
  104.  
  105. Change Log
  106.  
  107. 17-03-06
  108.  
  109. Added Steam version (english only). In the directory of the original PS Japanese version AI, "psjp-" was added at the beginning.
  110.  
  111. Added Ultimecia (draw point) that had been overlooked. Due to this influence, deviation of ID designation in Mishia 3 was fixed.
  112.  
  113. Naming individual variables of Gomani, Dolnami, and Besiege (for Steam version).
  114.  
  115. Fixed explanation about the counter for Ifrit.
  116.  
  117. 2016-09-26
  118.  
  119. Updated AI because OP code 24 was found to be "fill_ATB".
  120.  
  121. Ultimecia 2's AI commentary has changed slightly.
  122.  
  123. Added "AI of major enemies during RTA" sheet. However, I don't care for confusing things.
  124.  
  125. The spelling of the bariable name "recieve" has been changed to "receive".
  126.  
  127.  
  128. 2016-07-02
  129.  
  130. Release of this document.
  131.  
  132. References
  133.  
  134. ff8 monsters : .dat files analysis
  135. Monster AI script analysis by random_npc-san (5 years ago).
  136.  
  137. FF8 Qhimm Wiki
  138. File Format, Encounter Codes
  139.  
  140. Deling
  141. How to convert from binary to text from source code.
  142.  
  143. Czar Dragon's Den
  144. Ability name of enemies (english) list.
  145.  
  146. Final Fantasy 8 - FF WIki
  147. English-Japanese bilingual table.
  148.  
  149. Final Fantasy Terminology Dictionary Wiki
  150. Enemy behavior patterns.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement