NPC walking behavior glitches

From Glitch City Wiki
Revision as of 07:40, 23 February 2019 by >Bbbbbbbbba (New page. Not sure about the name. It may also make sense to separate this into two pages, but then I have even less idea how to name them.)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

NPC walking behavior glitches are glitches in Pokémon Red and Blue that affect the behavior of NPCs that walk on their own (as opposed to during scripts) in the overworld.

Glitches related to NPC displacement

The game keeps track of the displacement of each NPC from its original position. Presumably, the intention is to keep an NPC from moving too far from its home location, but the actual execution (external link) makes little sense:

  • If the NPC is trying to move upwards, and it is already 8 steps above its initial position, then don't move.
  • If the NPC is not trying to move upwards, and it would be 4 or more steps above its initial position after finishing this step, then don't move.
  • If the NPC is trying to move left, and it is already 8 steps left of its initial position, then don't move.
  • If the NPC is not trying to move left, and it would be 4 or more steps left of its initial position after finishing this step, then do nothing (allow the move).

While the first and third clauses make sense, the second clause doesn't really make sense, and the last clause does literally nothing.

The consequences of the first two clauses are:

  • When an NPC is exactly 4 steps above its initial position, it cannot move horizontally, but it can move up or down (the latter bringing vertical displacement back to 3).
  • When an NPC is 5~7 steps above its initial position, it can only move up, not in any other direction.
  • When an NPC is 8 steps above its initial position, it cannot move at all.

To summarize the last two points, once an NPC moves 5 steps above its initial position, it can do nothing but move three more steps up (or less, if there is an impassable obstacle in its way), and then it gets completely stuck (until the player leaves the map to reset NPC positions).

This glitch can be easily observed because when an NPC fails to move, it will still turn to the direction it tries to move, just as if it tried to walk against an obstacle (the border of the screen counts as an obstacle). Notice that for walking NPCs, turning without moving doesn't happen in usual cases.

Notable consequences of this glitch include:

  • When trying to do the get stuck in a wall glitch, the girl must be guided to the desired horizontal position before allowed to move up the final three steps (the desired position is 7 steps above her initial position). Furthermore, if she moves one more step up, the player has to reset NPC positions and try again.
  • If the walking NPC in Cerulean City Pokémon Center walks through the Cable Club lady, he would be stuck in the tile behind her without going left or right, because that tile is exactly 4 steps above his initial position (and he cannot go up or down either).

In Japanese Pokémon Red, Green, and Pokémon Blue (Japanese), the last clause works just like the second clause, meaning that an NPC can get stuck by moving too far to the left as well as by moving too far upwards. The "left" version of this glitch is more dangerous, because there are five places (three Pokémon Centers and two Poké Marts) where a player can be trapped in a 1-tile wide aisle against an NPC that could only move left, resulting in a soft-lock. Perhaps this is the reason the English versions fixed the "left" part of this glitch, but kept the "up" part unchanged.

Glitch related to the border of the screen

As mentioned above, the border of the screen is considered as an obstacle to walking NPCs. The way the game checks for this is by checking whether the coordinate of the NPC after walking a pixel would be on-screen (0x00 <= Y coordinate <= 0x80, 0x00 <= X coordinate <= 0x90). However, due to an off-by-one error, Y = 0x80 (the bottom row) and X = 0x90 (the rightmost column) are both considered off-screen in this check.

The consequence of this is the NPC cannot move along those two borders (i.e. move left or right on the bottom row, or move up or down on the rightmost column). Moving down onto the bottom row or right onto the rightmost column are still allowed, because after walking only one pixel, the relevant coordinates, Y = 0x71 or X = 0x81, are still considered on-screen. Moving up from the bottom row or left from the rightmost column are also allowed, because the relevant coordinates will then be Y = 0x7F or X = 0x8F.


Youtube Video

YouTube video by Crystal_

External links