Underworld AI glitch

320px|right|The glitch in action
The Underworld AI glitch, also known as the suicidal enemy glitch, is a glitch present in the first Japanese release of Final Fantasy IV. It is a result of the game loading the wrong enemy table after memory address oversights involving the way the game stores the party's location.
The problem lies within memory addresses 7E1701-7E1702, which are intended to store the current location of the player's party. At the beginning of a battle, the game checks these memory addresses; If the party's location is 015A-015C or 0167-017E, which are all locations for dungeons on the moon, then the game sets a flag to load a separate enemy data table. However, because of a shared memory byte, this information is not correct when on an overworld map. Once the party is on one of the maps, 7E1701 is used to store which map they are on (00 for overworld, 01 for underworld, 02 for the moon), while 7E1702 is not updated and continues to store the second byte of the previous location.
The glitch can be triggered if the party travels to the underworld directly after leaving any area with the location 005A-005C or 0067-007E, which includes the Mist Cave, the west entrance to Mt. Hobs, Antlion's Den, basement areas of Troia and the Underground Waterway. For Troia, the party would have to use the Exit spell, as leaving on foot takes the party through areas outside the affected range before reaching the map. Once in the Underworld, the game would incorrectly return locations matching 015A-015C or 0167-017E, due to prepending the 5A-5C or 67-7E bytes from 7E1702 with the underworld marker byte 01 from 7E1701. If the party enters a random encounter on the underworld map under these conditions, the game will load the wrong table for the enemy's AI. As a result, the enemies will use Stone on themselves and each other until they die, without using any actions that could harm the team.
This bug was fixed for the Revision A, or v1.1, release of Final Fantasy IV, by adding a check of memory address 7E1700, which stores a value of 03 when the party is in a dungeon. This fix is the only thing changed between the two versions. The version this glitch is found in, dubbed v1.0, was produced in a limited quantity before Square pulled it to fix this bug.
Category:Bugs in Final Fantasy IV