Final Attack (ファイナルアタック, Fainaru Atakku?), also known as a death counter or a death script, is a gameplay term in the Final Fantasy series. It refers to a part of a unit's attack script that has it execute an action upon being killed. In terms of game coding, the final attack can be a specific attack, or the final attack script can initiate a cutscene.
When a monster revives itself using the final attack script, it is treated as if it had never died; monsters with a final attack script to revive themselves typically are not meant to be killed. For example, the player's goal is to defeat Wrexsoul, not the Soul Savers, so simultaneously killing the Soul Savers would hypothetically end the battle with Wrexsoul still "alive," but due to the final attack script, they are not treated as being dead during the time they revive themselves, and so the battle continues. In the same way, the player is intended to defeat the demon form of the Chadarnook, not the goddess form, so the final attack script to revive itself keeps the player from winning by killing the goddess form.
There are ways around this script. Certain Death attacks stall an enemy's final attack script for one turn. They are Banish, Odin, Raiden, Oblivion, Snare, and Banisher. For most normal enemies, disabling their final attack only does that and nothing more, but against certain bosses glitches can arise. Against Wrexsoul and the Soul Savers, if the player kills a Soul Saver with Snare or Banish, their final attack to revive themselves will not execute and they will remain dead. If both Soul Savers are killed this way, and Wrexsoul removes/has removed itself from the battle, the battle will end as the game considers the player to have defeated the enemy party.
If the player kills Deathgaze with the Vanish-Doom bug using Banish in the Super Nintendo version, it prevents the game from recognizing it as beaten. This does not permanently miss the Bahamut magicite; while it won't drop for that battle, Deathgaze's death script never running also means Deathgaze is not flagged as defeated, and continues to appear at random, and so will give the magicite whenever he is beaten "properly".
Several enemies execute a final attack when their HP is reduced to 0. Some enemies, such as the Dragon Zombie and Ultimate Weapon, cast a powerful spell. Other enemies that have a final attack script are 2-Faced, Bottomswell, Gargoyle, Hojo, and Helletic Hojo.
Dragon Zombie is special in that it will only use its final attack, Pandora's Box, once per save file due to a global variable coded into the attack. The global variable is also used in the Jenova∙SYNTHESIS battle, meaning that after this battle, fighting another Dragon Zombie would have it use its final attack again. This is normally impossible since the Jenova∙SYNTHESIS battle is past the point of no return.
The player can use the final attack script as part of the Final Attack Materia, won from the Battle Square after winning the Special Battle once. If the player's Materia quota is full, they will permanently lose the Final Attack Materia. For each level the Materia gains, the command from the attached Materia will be used upon death, up to a maximum of five times. This can be further extended if the player equips the same Materia again to another Final Attack Materia on the same character, up to eight times.
Final Attack can be paired with all Magic and Summon Materia, Steal, Sense, Throw, Morph, Deathblow, Manipulate, Mime and Master Command. If paired with Master Magic/Summon/Command, a random ability contained in the Materia is chosen. If paired with Command Materia, the ability highlighted in the menu is used for the final attack. If paired with a Magic Materia, the highest spell the Materia has learned will be used.
If the player's last character falls and defeats the enemies with their Final Attack, the game will end in a Game Over with both player characters and enemies dead.
If the character has two copies of the same Magic or Summon Materia paired with Quadra Magic and Final Attack, the party member will use the spell four times when killed. This applies to Master Materia as well. For example, if a player character is killed with Master Summon paired with Quadra Magic and Phoenix paired with Final Attack, he will cast Phoenix Flame four times when killed.
When facing superbosses it is recommended to link the Phoenix Materia with Final Attack and equip the set to the party's most durable member. If the party member always has enough MP to execute the final attack, the boss would have to kill the equipped character at most six times for the player to get a Game Over.
Final Attack will hit either the enemy or allies, depending on the ability's default target. Abilities that target enemies choose a random enemy, unless the attack is area-of-effect. All supportive single-target spells target the character using the final attack.
Final attack will only trigger when the character is killed by an enemy. If the player kills themselves, even if done by a confused ally, or are killed by Poison or Death Sentence, the final attack will not trigger.
Final attack scripts are generally run through monsters that are at least level 30 or higher, including the Buel, Imp, Behemoth, and Krysta. If killed via instant death moves, the final attack script does not play.
Two bosses are notable for using final attacks upon their "death:" Beatrix and Kuja. While the player has technically won against these opponents by reducing their HP to 0, they use a powerful attack that reduces the entire party's HP to 1, or ends the battle instantly, respectively. Thus, for storyline purposes, neither of these opponents can technically be defeated.
Maliris uses the attack Raining Swords when defeated as a final attempt to defeat the player. If all the characters' HP is depleted by this attack, it's Game Over even if Maliris also dies.
Only two enemies have access to a final attack. The Behemoth King casts Meteor when killed, and the Catoblepas casts Ultima. If either enemy is defeated by a counterattack or Zanmato, the final attack will not be executed. In the case of the Behemoth King in the PAL/International/HD versions, if it is captured on the final attack, it will not cast Meteor.
Some opponents, such as the Behemoth fought in the KS99 BCNM Horns of War, use final attacks upon their death.
At Job Level 5, the Dark Knight class can learn the support ability See You In Hell, which activates when a character is KO'd and inflicts four times the damage of a conventional attack on all enemies.