Male
Seen March 31st, 2019
Posted June 25th, 2018
43 posts
6.4 Years
At the request of the user tkim, I'm posting this here. Altering Cave was supposed to be a cave with alternating wild Pokemon data based on a random value (1-9) being loaded into an address in RAM.

Since the e-Reader event never came out to the public, I've decided to share my findings with the community. But not just any community... the Pokemon community!

How to get Altering cave functional again:

'-----------------
#org @Start    //put your starting address offset here or use a dynamic address
random 0x9
copyvar 0x4024 LASTRESULT
setworldmapflag 0x8BE
end
Put this code in A-Map's map header for Altering Cave. What this does is alter the Pokemon of Altering Cave every time it is entered to emulate the original design of the cave as if Mystery Gift were used.

Next, if we want to edit the Pokemon, its data starts at 0x3C9AF8.

The data is in this order:

The Pokemon Data (by level, then Pokemon), the termination byte ($05), 3 bytes of $00 and a 4 byte pointer (the first Pokemon is Mareep, pointing to 0x83C9AF8, the start of the Monster's data). The Pokemon data are 56 bytes long, each.

For example, the first Pokemon is Mareep, it is loaded as follows when the right value gets written to 0x4024:

Mareep lv7 - lv7
Mareep lv9 - lv9
Mareep lv5 - lv5
Mareep lv12 - lv12
Mareep lv7 - lv7
Mareep lv9 - lv9
Mareep lv13 - lv13
Mareep lv3 - lv3
Mareep lv5 - lv5
Mareep lv12 - lv12
Mareep lv5 - lv5
Mareep lv12 - lv12

Then it terminates with a $05.

The Pokemon go in this order, starting at 0x3C9AF8, 56 bytes each:

Mareep
Pineco
Houndour
Teddiursa
Aipom
Shuckle
Stantler
Smeargle

Zubat's data (the one used by A-Map for Altering Cave) is actually before Mareep's (the first "altering" Pokemon) within hex = 0x3C9AC0. Really, I'm not surprised, since the routine draws the data set by pulling a random value (1-9) so having them all together like that makes sense. You could, in theory, change the data offset for the pointer used for A-Map for each one to make it easier to edit then revert it.

There is a bunch of free space tacked on at the end of this data. It seems that you could freely add more Pokemon and then change the "Random 9" to your new number of Pokemon to adjust it. The way the free space is set up, it seems that more Pokemon were originally intended to be used within Map 8BE (Altering Cave).

I hope this basic explanation on the logic for Altering Cave is helpful.