From Glitch City Laboratories
The encounter flag is a flag for a value between and including 128 to 254 within the first generation of Pokémon games, which when checked, will activate a valid Pokémon as 'seen' in the Pokédex. A value of 128 is added on to the relevant Pokémon's Pokédex entry, either by encountering a Pokémon by 'seeing' the relevant Pokémon in battle, or sometimes by viewing its picture for example, by speaking to a Pokémon in Fuchsia City's zoo. If this value is already greater than 128, a value of 128 is not added, as these addresses can only hold 1 byte (2^8) byte integers, hence the value would roll over 255 to a value less than 128, which would mark the Pokémon as not being seen.
In the case of a glitch Pokémon, depending on its family it will either use an invalid address for its corresponding encounter flag, or share its encounter flag address with a valid Pokémon, such as LM4 which belongs with Golduck in family #55. MISSINGNO. is perhaps the most well known example of a glitch Pokémon with an invalid encounter flag; it is part of family #0 and when any variants of MISSINGNO. are encountered by the player, or 'M/3trainerpoké the player's sixth item quantity is increased by 128, unless the player already has greater than 127 of his or her sixth item.
See also
- Capture flag