Glitch City Laboratories Archives

Glitch City Laboratories closed on 1 September 2020 (announcement). This is an archived copy of a thread from Glitch City Laboratories Forums.

You can join Glitch City Research Institute to ask questions or discuss current developments.

You may also download the archive of this forum in .tar.gz, .sql.gz, or .sqlite.gz formats.

Generation I Glitch Discussion

NPCs that can be removed by the Mew Glitch? - Page 1

NPCs that can be removed by the Mew Glitch?

Posted by: Ephraim225
Date: 2016-05-08 21:17:03
Hello, I was messing around with the Mew Glitch in Yellow recently, and I noticed that the guy guarding Cerulean Cave was gone after I'd done it. This was very odd to me as I know about NPCs vanishing after the Mew Glitch but usually when I do it, the guard in front of the sacked house disappears. Then I realized that this time I had done the glitch BEFORE getting the S.S. Ticket. Later after that I noticed the Rocket in Saffron that sleeps in front of Silph Co. was also completely gone.

So does that mean depending on certain events different NPCs can disappear depending on how far you are in the game? Has this been thoroughly looked into? (I'd be willing to do that if it hasn't been explored quite yet)

EDIT: So I tried getting the cave guard to disappear again and it didn't work, but I did forget to mention that I was doing the Mew Glitch to encounter Yellow Missingno. at the time, and I did it by healing at the Route 4 Pokémon Center, escaping the Bug Catcher in Viridian Forest, advancing to Misty, beating her, and then depositing all non-fainted Pokémon for an instant blackout. Then I went back to Viridian Forest with no extra encounters. So that makes me wonder if Yellow Missingno. had something to do with that?

Re: NPCs that can be removed by the Mew Glitch?

Posted by: Krys3000
Date: 2016-05-09 05:53:53
I don't think the phenomenon has been seriously investigated, and have personally no idea why it happens. It might be related to the summoned text box, but since most Ditto Tricks are done using the Start Menu, I would not get why.

Re: NPCs that can be removed by the Mew Glitch?

Posted by: Bert
Date: 2016-05-09 16:09:36
I was under the impression it had something to do with RAM bytes being changed or somesuch, since glitches are known to mess with that. I've had overworld NPCs disappear because of my shenanigans involving Save Abuse, which does involve corrupting various values*.

*Programming and moral in my case.

Re: NPCs that can be removed by the Mew Glitch?

Posted by: Ephraim225
Date: 2016-05-10 00:26:39
I know why NPCs disappear in general, it's because the game thinks the Mew Glitch encounter is a legendary, and because it's a legendary an NPC is supposed to vanish when it's done. You can get Snorlax to disappear this way.

I'm just befuddled as to how the Cerulean Cave guard vanished.

Re: NPCs that can be removed by the Mew Glitch?

Posted by: Krys3000
Date: 2016-05-10 01:56:14
To my knowledge, special stat encounters are nothing more than modifying $CD2D (opponent trainer's hex ID) into a given Pokémon's hex ID, while the eye-contact script is forced on. I don't know of any relation with legendaries, nor what kind of corruption it could provoke, unlike Save abuse's WMD-like, massive 400+ memory addresses turning into FF. 

Re: NPCs that can be removed by the Mew Glitch?

Posted by: TheZZAZZGlitch
Date: 2016-05-10 05:52:23
I decided to look into it.

Indeed, encounters generated by the Mew Glitch count as legendary encounters. That's because legendary encounters are the only legitimate way of starting a wild Pokemon battle after talking to a sprite. The game explicitly checks if the previously activated trainer battle was with a wild Pokemon, and if so, it activates some "special code".

[tt]EndTrainerBattle:
    (…)
    ld a, [W_ENEMYMONORTRAINERCLASS]
    ; is the opponent's hex ID >= 200?
    cp $c8
    ; if not, we have better stuff to do
    jr nc, .skipRemoveSprite
    ; otherwise, some magic happens[/tt]

What happens with legendaries after finishing the battle? Of course, they disappear. To do that, the game sets appropriate missable object flags, corresponding to the sprite ID we recently talked to. The missable object flags are later checked upon entering any map, and if the flag is set, the corresponding sprite will disappear.

[tt]    ld hl, W_MISSABLEOBJECTLIST
    ld de, $2
    ld a, [$cf13]
    ; search for most recent sprite ID in the missable object list
    call IsInArray
    ; obviously there's no error checking for when the ID wasn't found.
    ; what could possibly go wrong?

    inc hl
    ld a, [hl]
    ; get the missable object index for our sprite ID
    ld [$cc4d], a
    ; indirect jump to RemoveMissableObject
    ld a, $11
    call Predef
.skipRemoveSprite
    ; normal stuff again[/tt]

The missable object list is just that - a list of all sprites that could potentially disappear from the current map, along with their missable object flag offsets. This list is updated every time the player enters a new area.

So, if we use textbox matching to change the sprite ID we recently talked to, we can trigger certain missable object flags on the map the Mew Glitch is performed. Let's see an example. This is the missable object list on Route 24:

[tt]01 24 08 25 FF[/tt]

The FF at the end is to terminate the list.
01 24 means that sprite ID 0x01 is a missable object, and has its missable object flag at bit 0x24. That's the Team Rocket member that gives a Nugget to the player.
08 25 means that sprite ID 0x08 is a missable object, and has its missable object flag at bit 0x25. That's the Pokeball with TM45, which disappears after picking it up.

So, if we do the Mew Glitch on Route 24, we can make either of those two objects disappear, by first displaying a textbox ID 0x01 or 0x08, and encountering a wild Pokemon there. The game will assume this was a legendary encounter, and will set the missable object flag for either the Pokeball or the Nugget script tile. That doesn't seem very useful, and that doesn't seem like the whole story. It was reported that Cerulean Cave and Silph Co. guards could also disappear, yet it's not possible to do a Mew Glitch on their maps (at least not through normal means).

What would happen if the person ID we previously talked to isn't on the missable object list? For example, opening the Start menu counts as talking to person 0. What if we try to remove the missable object flag for person 0? The game does not have an error handler for this case - the developers expected the object to always be on the list - like legendaries.

If the item is not found, the IsInArray subroutine exits with the hl register set to the end of the array. The game then assumes that hl is a pointer to a valid list entry, reads one byte beyond the list, takes that as a missable object flag index and sets it. What's beyond the missable object list? The buffer containing the list is 32 bytes long, so we're probably not going to read past it. Instead, we will be reading garbage entries from other maps. Let's take a look. This is the missable object list for Cerulean City:

[tt]01 05 02 06 06 07 0A 08 0B 09 FF[/tt]

Now, we go to Route 24. The list was now updated to look like this:

[tt]01 24 08 25 FF 07 0A 08 0B 09 FF[/tt]

The new list is only 5 bytes long, and the remaining bytes are just garbage data from the previous map.
Now, if we trigger a wild encounter through the Mew Glitch, with last textbox ID other than 0x01 and 0x08, the game will set missable object flag 0x07. That's the flag for one of the guards next to the house (not the one blocking the entrance, but the one standing next to it). Basically, this oversight allows us to set missable object flags from different maps.

So, if the player already visited Bill, did the Mew Glitch on Route 24, and then returned there through Cerulean City… the guard in front of the house will disappear completely.

[img]http://i.imgur.com/Tenliw4.png[/img]

For all those years, I thought that the disappearing guard was normal behavior… This is a fun way to tell whether the original Mew Glitch was ever performed on a save file.

The Cerulean Cave guard uses missable object flag 0x08, so to make him disappear, we'd need to perform the Mew Glitch on a route with 3 missable objects (like Route 12), fight a trainer, fly to Cerulean City, then to Lavender Town (this won't screw up the process, since Lavender Town has no missable objects and won't overwrite the fourth list entry), make sure that the Start menu was the last textbox loaded into memory, then go back to Route 12 to finish the Mew Glitch and run away from the resulting encounter.

This makes me think if making objects disappear this way would be a viable strategy in "no save corruption"/"no item underflow" speedruns.

Re: NPCs that can be removed by the Mew Glitch?

Posted by: Krys3000
Date: 2016-05-10 06:46:35
Very nice job TheZZAZZGlitch, as always! Indeed it might open some interesting strategies in skipping stuff using Mew Glitch  ;D

Re: NPCs that can be removed by the Mew Glitch?

Posted by: camper
Date: 2016-05-10 08:49:48
That explains why the Snorlax blocking Route 16 didn't disappear when Twitch Plays Pokemon did the Jack-fly trick (John-fly, actually) on Route 17 recently! Celadon has much more missable objects than Route 16 (thanks Team Rocket), so something else was set to disappear instead.

Re: NPCs that can be removed by the Mew Glitch?

Posted by: Ephraim225
Date: 2016-05-10 20:50:11
Oh my god did I just contribute to finding another use for the Mew Glitch I'm so happy

Thanks, ZZAZZ, you're incredible :D


That explains why the Snorlax blocking Route 16 didn't disappear when Twitch Plays Pokemon did the Jack-fly trick (John-fly, actually) on Route 17 recently!


They got Jack's item?? And did that?? How in the world?

Re: NPCs that can be removed by the Mew Glitch?

Posted by: camper
Date: 2016-05-10 23:23:04


That explains why the Snorlax blocking Route 16 didn't disappear when Twitch Plays Pokemon did the Jack-fly trick (John-fly, actually) on Route 17 recently!


They got Jack's item?? And did that?? How in the world?

Democracy. This channel has all the footage. (check the recent videos)

Re: NPCs that can be removed by the Mew Glitch?

Posted by: Torchickens
Date: 2016-05-11 05:13:51



That explains why the Snorlax blocking Route 16 didn't disappear when Twitch Plays Pokemon did the Jack-fly trick (John-fly, actually) on Route 17 recently!


They got Jack's item?? And did that?? How in the world?

Democracy. This channel has all the footage. (check the recent videos)


That's amazing!

Re: NPCs that can be removed by the Mew Glitch?

Posted by: Dante
Date: 2016-05-11 15:10:17
Hi guys! I'm doing a "Pokemon Red Glitched Adventure" series on my channel on youtube (italian), and I was looking for some great glitch to show off. Now I found this and I think it would be amazing to exploit it to get rid of the Snorlax on route 12. I'm in Vermillion City right now, do you think there's some way to achieve that?

Re: NPCs that can be removed by the Mew Glitch?

Posted by: TwilightHakuryuu
Date: 2016-05-11 16:10:25

Hi guys! I'm doing a "Pokemon Red Glitched Adventure" series on my channel on youtube (italian), and I was looking for some great glitch to show off. Now I found this and I think it would be amazing to exploit it to get rid of the Snorlax on route 12. I'm in Vermillion City right now, do you think there's some way to achieve that?


I recommend that you check the wiki next time, because that particular use of the tainer-escape glitch was found ages ago. The methodology is summed up in this article on the GCL wiki.

Good luck on your glitch series. :)

Re: NPCs that can be removed by the Mew Glitch?

Posted by: Dante
Date: 2016-05-11 16:30:49
Thank you :)

Sadly this isn't useful since I have not access to Lavander Town.
The series is meant to exploit glitches to beat the game in a cool way while helping me, so I'm trying to find a balance between beating it as fast as I can and making the series long enough.

Right now I was thinking about reaching the super store to get X special without getting cut and avoiding the rock tunnel, then after obtaining 7F (I'm using the Italian version since I want my viewers able to try the glitches for themselves) use this to get the badges without actually beating the gyms, and then the noclip glitch to avoid victory road.

But I assume that I can't do that D:
I'll go to lavander town by normal means.

Re: NPCs that can be removed by the Mew Glitch?

Posted by: TwilightHakuryuu
Date: 2016-05-11 17:22:26

Sadly this isn't useful since I have not access to Lavander Town.
The series is meant to exploit glitches to beat the game in a cool way while helping me, so I'm trying to find a balance between beating it as fast as I can and making the series long enough.

Right now I was thinking about reaching the super store to get X special without getting cut and avoiding the rock tunnel, then after obtaining 7F (I'm using the Italian version since I want my viewers able to try the glitches for themselves) use this to get the badges without actually beating the gyms, and then the noclip glitch to avoid victory road.


I wonder if the cuttable trees are also missable objects? But you wouldn't be able to trainer-fly from route 9 without being able to get on route 9 in the first place.

Alternatively, there might be a way to get a fresh water/lemonade/soda pop without going to celadon city first. Then you could simply go right through saffron city to get to celadon and lavander. Actually, I'm sure there's a way, I just don't know it myself, and I don't recall seeing it posted anywhere. Maybe ask around a bit?