Skeetendo

’Cause all games were better on the GBC

You are not logged in.

#1 2012-05-09 17:08:19

GeminiRage
Member
Registered: 2012-04-04
Post 14/92

Editing Headbutt and Rock Smash encounters.

Since searching the forums turned up no results, I'm going to ask it here.

I'm looking to change what Pokemon are encountered through headbutting trees and rock smashing.  Where would I look in the ROM for this data, and how is that data arranged? (seeing as how searching known level+species in an order of rarity didn't help me one bit like with grass encounters).

EDIT: Forgot to mention this is a Silver ROM.

Last edited by GeminiRage (2012-05-09 17:23:02)


Mostly done with: Touhoumon: Ordinary Version
Know how to make music?  Come help port some songs for my hack!

Offline

#2 2012-05-09 18:37:27

Miksy91
Member
Registered: 2010-10-16
Post 875/2,315

Re: Editing Headbutt and Rock Smash encounters.

The text data "$CF7E" did a Headbutt!" is at offset 0x194258 and the text pointer (16 + 2b) to it at 0xCE9E.
If you open PKSV and load a script from address 0xCEA8, you'll notice that there are three assembly routines called from offsets:
03:4947, 23:8E4A and 2E:7863 and after the last routine is gone through, "RAM" has been modified (RAM = D173) and if it equals to 0, no pokemon is encountered.

So basically, those three assembly codes "randomly" (depending on the area you're on) "draw" the encountered pokemon and whether RAM is 0 or not.
What you could do next is to start debugging those assembly codes while Headbutting the trees (BGB is a good tool for this) and see when PokéRAM = D117 and LevelRAM = D040 are changed and figure out how to get further from there.

Last edited by Miksy91 (2012-05-09 18:39:34)

Offline

#3 2012-05-11 02:37:06

469/701

Re: Editing Headbutt and Rock Smash encounters.

Looks like pointers to Headbutt data are at 2e:42e8 in Crystal. I didn't bother figuring out the format, or finding the location in G/S, but here are the hexdumps:

42fa:
        32,15,0a,0f,15,0a,0f,15,0a,0a,be,0a,05,be,0a,05,be,0a,ff

430d:
        32,15,0a,0f,d6,0a,0f,d6,0a,0a,be,0a,05,be,0a,05,be,0a,ff

4320:
        32,15,0a,0f,17,0a,0f,15,0a,0a,be,0a,05,be,0a,05,be,0a,ff

4333:
        32,15,0a,0f,d6,0a,0f,d6,0a,0a,be,0a,05,be,0a,05,be,0a,ff

4346:
        32,a3,0a,0f,a7,0a,0f,a5,0a,0a,66,0a,05,66,0a,05,66,0a,ff

4359:
        32,a3,0a,0f,cc,0a,0f,cc,0a,0a,66,0a,05,66,0a,05,66,0a,ff

436c:
        32,a3,0a,0f,17,0a,0f,a3,0a,0a,66,0a,05,66,0a,05,66,0a,ff

437f:
        32,a3,0a,0f,cc,0a,0f,cc,0a,0a,66,0a,05,66,0a,05,66,0a,ff

4392:
        32,a3,0a,0f,30,0a,0f,a3,0a,0a,66,0a,05,66,0a,05,66,0a,ff

43a5:
        32,a3,0a,0f,cc,0a,0f,cc,0a,0a,66,0a,05,66,0a,05,66,0a,ff

43b8:
        32,a3,0a,0f,cc,0a,0f,cc,0a,0a,a4,0a,05,0c,0a,05,0f,0a,ff

43cb:
        32,a3,0a,0f,0a,0a,0f,0d,0a,0a,a3,0a,05,0b,0a,05,0e,0a,ff

#4 2012-05-11 11:03:34

GeminiRage
Member
Registered: 2012-04-04
Post 15/92

Re: Editing Headbutt and Rock Smash encounters.

Okay, I've got this figured out.  Managed to find the tables for the Headbutt encounters (they're formatted the same as the Crystal ones), I'm going to test them when I get to that point in the game (I would've done it yesterday, except I accidentally loaded a Save State that set me back quite a bit, among other things I'm doing.)

It may be possible for me to find the Rock Smash encounters by a similar token.

Last edited by GeminiRage (2012-05-11 11:15:28)


Mostly done with: Touhoumon: Ordinary Version
Know how to make music?  Come help port some songs for my hack!

Offline

#5 2012-06-27 14:10:49

Miksy91
Member
Registered: 2010-10-16
Post 940/2,315

Re: Editing Headbutt and Rock Smash encounters.

The pointer table to the headbuttable pokemon is in 0xBA470 (that Marckus explained).

But I just found something more related to this!
I was mentioned that no pokemon could be encountered with headbutt in my hack so I decided to check how the data works and luckily, found another table starting at 0xBA3E6 (it was somewhat easy to find as it's close to that another table but still). This table consists of three bytes for each map that has headbutt-data:

0xBA3E6
[Map Bank] [Map No] [Pokemon data]

The third byte seems to be used for selecting which one of the pointers in the table at 0xBA470 is used to determine the pokemon that can be encountered. I felt like writing it all here already even though I haven't checked this out properly yet but I'll just fix this post later on if there is something wrong with it.

P.S
I'll probably edit this post later anyway when I've figured out what those bytes in the "pokemon data" lists do.

Last edited by Miksy91 (2012-06-27 14:12:38)

Offline

Board footer

Powered by FluxBB