Advertiser Content

Research Getting Altering Cave to Work

Started by shanem7 August 19th, 2017 9:15 PM
  • 2913 views
  • 4 replies
Male
Seen March 31st, 2019
Posted June 25th, 2018
43 posts
6.7 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.

igorfs10

Male
Brazil
Seen 3 Weeks Ago
Posted April 22nd, 2019
47 posts
4 Years
For Emerald i just repointed the Altering Cave script to this script.
#org @start
setflag 0x8DD
random 0x9
copyvar 0x403E LASTRESULT
end
Flag 0x8dd - Altering Cave visited
Var 0x403E is used to select wich wild table will be used for altering cave - Thanks PurpleOrange

WIld pokmon tables for Emerald.
00 - Zubat - 0x552b48 (The table that shows in AMAP) - Pointer at 0x553634
01 - Mareep - 0x552b80 - Pointer at 0x553648
02 - Pineco - 0x552bb8 - Pointer at 0x55365C
03 - Houndour - 0x552bf0 - Pointer at 0x553670
04 - Teddiursa - 0x552c28 - Pointer at 0x553684
05 - Aipom - 0x552c60 - Pointer at 0x553698
06 - Shuckle - 0x552c98 - Pointer at 0x5536AC
07 - Stantler - 0x552cd0 - Pointer at 0x5536C0
08 - Smeargle - 0x552d08 - Pointer at 0x5536D4
Advertiser Content