PDA

View Full Version : [Tutorial] Killing the "Killing Pokémon Center" Glitch


Deokishisu
August 4th, 2009, 09:27 PM
Thought this might help out a couple people...

How to Kill the "Killing PC" Glitch

The "Killing PC Glitch" occurs when the player heals at a PC you created (i.e. one that you made out of another map or inserted into a blank map, not a PC that was already in the game and was edited) and hasn't healed at a "real" or "default" PC beforehand. It messes everything up and freezes the game as most of you know. Well, I've done some research, and I've learned how to fix it.

Now, default Nintendo PCs have two levelscripts in the map. The first goes like this:
#org 0x(offset)
sethealingplace 0x(#)
endThe second is always the same on every PC map, whose offset is: 1BC05C.

The first is what we have to worry about. When the command "sethealingplace" is used, it's basically setting that this was the last Pokémon Center the player has visited, and allows the Nurse to heal your Pokémon with the generic Nurse script without freezing. The "#" is a value in hex from 1 to 14 in Firered and Leafgreen. That means there are a total of 20 default PCs in Firered and Leafgreen.

Simply add these two levelscripts to your custom Pokémon Center, and your PC won't kill anyone.

However, there is a catch. As far as I can tell, you can't go past the default amount of Pokémon Centers included in the game. That means you can't increase the sethealingplace value past 14 and magically add another PC. If you do that, you'll appear at the last default PC, which happens to be Six Island in FR. The sethealingplace value should correspond to the previous Pokémon Center the player would have normally visited. That way, when your unsuspecting victims-I mean-loving playerbase finds their Pokémon have been eaten by a Lvl. 100 wild Cleffa, they'll go back to the previous town to heal and not, say, your unedited Seven Island's Pokemon Center.

The values go in order. In Firered they start with:
0x01 = Player's House
0x02 = Viridian City
0x03 = Pewter City
0x04 = Cerulean City
0x05 = Lavender Town
0x06 = Vermilion City
0x07 = Celadon City
0x08 = Fuchsia City
0x09 = Cinnabar Island
0x0A = Indigo Plateau/Pokemon League Entrance
0x0B = Saffron City
0x0C = Route 4/Mt. Moon Entrance
0x0D = Route 10/Rock Tunnel Entrance
0x0E = One Island
0x0F = Two Island
0x10 = Three Island
0x11 = Four Island
0x12 = Five Island
0x13 = Seven Island
0x14 = Six Island

^Notice Seven and Six Island are switched.
NOTE: The levelscript for the player's house is actually in the player's room,
and not on the first floor.As a totally random example, if you wanted to add a PC between Viridian and Pewter right before Viridian Forest, you would use 0x2 as your value for sethealingplace in your custom PC. That way, if the player dies, they will appear at Viridian's Pokémon Center and not Pewter's or Fuchsia's or another PC.

I don't hack R/S/E, but I'd imagine it'd work in a similar fashion. Someone's welcome to confirm it.

EDIT:
Sorry to bump, but here are the values for Pokemon Emerald:

0x01 = Player's Room (male)
0x02 = Player's Room (female)
0x03 = Petalburg City
0x04 = Slateport City
0x05 = Mauville City
0x06 = Rustboro City
0x07 = Fortree City
0x08 = Lilycove City
0x09 = Mossdeep City
0x0A = Sootopolis City
0x0B = Ever Grande City (Victory Road)
0x0C = Littleroot Town (left)
0x0D = Littleroot Town (right)
0x0E = Oldale Town
0x0F = Dewford Town
0x10 = Lavaridge Town
0x11 = Fallarbor Town
0x12 = Verdanturf Town
0x13 = Pacifidlog Town
0x14 = Ever Grande City (Pokemon League)
0x15 = Southern Island
0x16 = Battle Frontier


EDIT: Updated the list. Thanks colcolstyles.

Full Metal
August 5th, 2009, 04:17 AM
so you haven' figured out how to add more yet though?

0m3GA ARS3NAL
August 5th, 2009, 05:31 AM
I can imagine this would be a table, so if we can find the table data, we might be able to add more PC's... unless there IS not table, and the game just reads that one byte and does what it does...
This table data would be a bit more difficult to locate, I'll look for some help.

GREAT data BTW.

BlitŻ
August 5th, 2009, 06:37 AM
this is useful, but are these also the numbers I can use in a script for sethealing place?

Deokishisu
August 5th, 2009, 11:57 AM
this is useful, but are these also the numbers I can use in a script for sethealing place?

Yes, put one of the values in the sethealingplace 0x(#) bit of your level script and it will port the player to the Pokemon Center that corresponds to that value when they lose. That way, your custom PC won't try to heal the player and crash the game when they lose.

Samike360
August 5th, 2009, 01:50 PM
How would I edit the Nurse Joy script? Is that the second level script you mentioned? And thanks a lot, this will prove very useful to me.

Deokishisu
August 5th, 2009, 04:30 PM
How would I edit the Nurse Joy script? Is that the second level script you mentioned? And thanks a lot, this will prove very useful to me.

It really depends on what you want to do with the Nurse Joy script, as far as I can tell, it has nothing to do with the second levelscript on the map:

#org 0x1BC05C
special 0x182
end

^Which is the same offset and everything in every PC. I've tried using the special a number of times in different situations, and it appears to do nothing. However, it has to be important for the Pokemon Center, or it wouldn't be there. So I'd just be on the safe side and leave it as is.



There are a variety of things you could do with Nurse Joy's script without killing its functionality, would you care to be more specific?

For example, in something I've been working on in my spare time, you could get to a Pokemon Center before receiving your starter. I just added a checkflag 0x828 to the beginning of her script and if I didn't have a Pokemon, I had it simply go to a msgbox instead of going through and trying to heal my nonexistant Pokemon and crashing the game.

If you wanted to go even more simple and edit what she says in each town, you'd just replace the text and repoint if it's bigger in each town's individual Nurse Joy script.

You can do anything really, she's just like any other NPC, add some checkflags, applymovements, whatever you want and she'll function in any event. Just make sure she's pointed back to her original healing script if the event's already been done with a "checkflag 0x(#)" and a "if 0x1 goto 0x(offset of healing script)".

If you don't have a clue what I'm saying, read a scripting tutorial.

Samike360
August 5th, 2009, 05:22 PM
It really depends on what you want to do with the Nurse Joy script, as far as I can tell, it has nothing to do with the second levelscript on the map:

#org 0x1BC05C
special 0x182
end^Which is the same offset and everything in every PC. I've tried using the special a number of times in different situations, and it appears to do nothing. However, it has to be important for the Pokemon Center, or it wouldn't be there. So I'd just be on the safe side and leave it as is.



There are a variety of things you could do with Nurse Joy's script without killing its functionality, would you care to be more specific?

For example, in something I've been working on in my spare time, you could get to a Pokemon Center before receiving your starter. I just added a checkflag 0x828 to the beginning of her script and if I didn't have a Pokemon, I had it simply go to a msgbox instead of going through and trying to heal my nonexistant Pokemon and crashing the game.

If you wanted to go even more simple and edit what she says in each town, you'd just replace the text and repoint if it's bigger in each town's individual Nurse Joy script.

You can do anything really, she's just like any other NPC, add some checkflags, applymovements, whatever you want and she'll function in any event. Just make sure she's pointed back to her original healing script if the event's already been done with a "checkflag 0x(#)" and a "if 0x1 goto 0x(offset of healing script)".

If you don't have a clue what I'm saying, read a scripting tutorial.

What I'm trying to ask is how would I change what she says after all my pokemon faint.

liuyanghejerry
August 5th, 2009, 05:41 PM
What I'm trying to ask is how would I change what she says after all my pokemon faint.

You can use a hex editor and search what she says .

0m3GA ARS3NAL
August 5th, 2009, 08:41 PM
Hmm, about locating possible data, I have a theory.

I was thinking that first we are going to want to search for the bank and map number of the map, then it's X/Y coordinates.
I'll see what I can come up with...

Nope, no luck...
I'll see if I can get a hold of some help here...
HackMew or something, anyone would help though!

Deokishisu
August 5th, 2009, 08:51 PM
What I'm trying to ask is how would I change what she says after all my pokemon faint.

The "blah blah scurried to a Pokemon Center" bit? Or the "if your Pokemon's HP is low please come see us" bit?

Well, either way, A-Text is an easy way to edit it. Open your ROM with it, search for the text you want, hit resume 'till you find it, add it to the ini, and edit it from there. It'll even repoint it for you if it's bigger than the previous text.

Hmm, about locating possible data, I have a theory.

I was thinking that first we are going to want to search for the bank and map number of the map, then it's X/Y coordinates.
I'll see what I can come up with...

Nope, no luck...
I'll see if I can get a hold of some help here...
HackMew or something, anyone would help though!

Glad I got people excited about this, I'll work on my end when I have the time. Maybe we can crack this.

0m3GA ARS3NAL
August 5th, 2009, 09:16 PM
Glad I got people excited about this, I'll work on my end when I have the time. Maybe we can crack this.

Yeah, it would be a great thing to find table data, that means we might be able repoint and expand.
That means more Pokemon Centers!

Samike360
August 6th, 2009, 03:23 AM
The "blah blah scurried to a Pokemon Center" bit? Or the "if your Pokemon's HP is low please come see us" bit?

Well, either way, A-Text is an easy way to edit it. Open your ROM with it, search for the text you want, hit resume 'till you find it, add it to the ini, and edit it from there. It'll even repoint it for you if it's bigger than the previous text.



Glad I got people excited about this, I'll work on my end when I have the time. Maybe we can crack this.

Ok thanks a lot. I'll see what I can do.

Learath2
August 16th, 2009, 10:16 PM
İt is a noobish question but what do you mean by pc ?

Mateo
August 16th, 2009, 11:27 PM
İt is a noobish question but what do you mean by pc ?

Pokemon Center.




I was thinking, could it be a list of pointers to the fly-to data for towns? I haven't hacked the Advance gen much, I'm a Metal Gen hacker mostly, but it might be worth looking into.

0m3GA ARS3NAL
August 17th, 2009, 10:08 AM
Pokemon Center.




I was thinking, could it be a list of pointers to the fly-to data for towns? I haven't hacked the Advance gen much, I'm a Metal Gen hacker mostly, but it might be worth looking into.

Checked that, and no, didn't work, still have yet to find the data for this, it would be GREAT to expand.

score_under
August 18th, 2009, 05:29 AM
so you haven' figured out how to add more yet though?
I have.
I can imagine this would be a table, so if we can find the table data, we might be able to add more PC's... unless there IS not table, and the game just reads that one byte and does what it does...
This table data would be a bit more difficult to locate, I'll look for some help.

GREAT data BTW.
There is a table... and think what you're saying! If it "reads one byte and does what it does", then the code to do that is in the ROM somewhere! ;)

To anyone skimming this topic, this is pretty important:

BFD80 and BFDA4 in FR point to the sethealingplace table, and BFD54 and BFD78 point to it in LG.

I can't believe it wasn't found before, that was really simple :P (I also can't believe people overlooked the very fundamental sethealingplace until now... I'd considered it for a long time)

0m3GA ARS3NAL
August 18th, 2009, 11:01 AM
I have.

There is a table... and think what you're saying! If it "reads one byte and does what it does", then the code to do that is in the ROM somewhere! ;)

To anyone skimming this topic, this is pretty important:

BFD80 and BFDA4 in FR point to the sethealingplace table, and BFD54 and BFD78 point to it in LG.

I can't believe it wasn't found before, that was really simple :P (I also can't believe people overlooked the very fundamental sethealingplace until now... I'd considered it for a long time)

You didn't have to show off, lol.
I looked for a bit, and I couldn't find it, what did you do to find it?
(I looked for bank.map data, I looked for the X/Y positions, I couldn't find it.)
So if these POINT to it, then why are there 2 pointers for each ROM?
Does it point to 2 different tables?
Care to elaborate a bit?

Gamer2020
August 18th, 2009, 04:15 PM
Most importantly please say what you did to find these. I want to try to find them for emerald...

Jambo51
September 20th, 2009, 10:29 AM
Is there a tutorial for expanding either this (the sethealingplace table) or the flying table?

I could do with expanding both of them for my hack.

OM3GA Umbr30n
January 6th, 2010, 02:11 PM
Wow this is great information, im sure this will help alot of people and will change hacks as we know them :P

hoebeke
June 29th, 2010, 11:58 AM
I'm very sorry for bumping, but i have tried this and I must be doing SOMETHING wrong because I can't get it to work :\ please help?

Chaos Rush
July 26th, 2010, 09:46 PM
Sorry to bump, but here are the values for Pokemon Emerald:

0x01 = Player's Room (male)
0x02 = Player's Room (female)
0x03 = Petalburg City
0x04 = Slateport City
0x05 = Mauville City
0x06 = Rustboro City
0x07 = Fortree City
0x08 = Lilycove City
0x09 = Mossdeep City
0x0A = Sootopolis City
0x0B = Ever Grande City (Victory Road)
0x0C = Littleroot Town (left)
0x0D = Littleroot Town (right)
0x0E = Oldale Town
0x0F = Dewford Town
0x10 = Lavaridge Town
0x11 = Fallarbor Town
0x12 = Verdanturf Town
0x13 = Pacifidlog Town
0x14 = Ever Grande City (Pokemon League)
0x15 = Southern Island
0x16 = Battle Frontier


EDIT: Updated the list. Thanks colcolstyles.

colcolstyles
July 26th, 2010, 10:49 PM
Here are your missing values:

0x01 = Player's Room (male)
0x02 = Player's Room (female)
...
0x0C = Outside Player's House (male)
0x0D = Outside Player's House (female)
...
0x15 = Southern Island

0x00 and anything higher than 0x16 appears to always warp the player to Petalburg City.

Kevin
July 31st, 2010, 10:34 AM
Thank you so much!!! You helped me with my hack, I accidentally deleted the map scripts. =P

Steveice10
August 5th, 2010, 12:00 PM
How do I access the second levelscript in Emerald for the Pokemon Center?

1-Up
August 6th, 2010, 07:47 PM
Hey, I'm hacking FR and used this patch
http://www.pokecommunity.com/showthread.php?t=194241

When I run out of usable pokemon I show up in a glitched room and the game freezes.
There are currently no healing spots yet and I'm working to set up mom, at home, to heal you. Is this enough for the game to send me there or to a pokemon center when out of pkmn? Or do I need to sethealingspot all of the PCs and home since the rom is wiped clean with that patch?


EDIT: Ok, so I tried adding sethealingspot 0x01 on moms script and when I run out of pkmn it loads me in the black border of a map, in which I can't move. (stuck there, but can face different directions) The text that appears when you white out and go home shows up as usual, but I'm in an area I can't ecape. Do I need to assign a person ID to mom to make me show up next to her? Same with the pokemon centers, do they need to be assigned something so thats where I go when I run out of pkmn? I know I need to sethealingspot 0xXX, but that wasn't enough with the patch I have I guess. Help please!!!!! Thank you.

howieho
August 7th, 2010, 09:22 AM
What exactly do I apply this script to? And where do I find the P.C. map offset of 1bc05c?

Octsia101
August 15th, 2010, 01:50 PM
Ah, thanks- this will help me fix my hack.

heat012191
March 7th, 2012, 07:24 PM
this is really starting to piss me off. I try to set a healing place for my map. now the script for my first healing place is just (offset, first pointer) sethealingplace 0x01. that one works. my next town is sethealingplace 0x02. that one works as well. but i try to make one for my next town that is sethealingplace 0x03 and it doesn't work. i'm using emerald and it always warps me back to petalburg city. i've tried everything from changing the healing place i set to deleting all the sethealingplaces in the regular games, to getting rid of the flying position in petalburg city to redoing the script. in my custom pc i have the special 0x1A4 that is just there. i left it there and i tried the script 30 different ways and every time it still teleports me to petalburgh when i lose a fight.

AriArk
December 9th, 2014, 09:08 AM
I have something really weird happening.
Basically, I got the error that was happening and this fixed it, but for some reason, once I closed VBA and changed some sprites with Gen 3 hacking suite (I don't think that has anything to do with it but i'll put it here just in case) and also edited a map (not the PC), the error returned when I opened the game in VBA again. What could be happening?

Hold on, I think i've fixed it. If anyone else got this, it seemed the problem was because on the second levelscript, instead of having the levelscript "On entering map/on menu close [05]" I had "On entering map/on menu close [07]"
There must be some difference or something XD