• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • Forum moderator applications are now open! Click here for details.
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

Research: Getting Altering Cave to Work

45
Posts
11
Years
  • Seen Jun 26, 2023
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:

Code:
'-----------------
#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.
 
Last edited:

Lunos

Random Uruguayan User
3,108
Posts
15
Years
It is worth mentioning that the Map Script needs to be added as a Type 05 Script.
Or at least I tried it as a 03 and it didn't work.
In any case, even though it's been a while since it was posted, nice work shanem!
 
53
Posts
8
Years
For Emerald i just repointed the Altering Cave script to this script.
Code:
#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 pok?mon tables for Emerald.
Code:
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
 
Last edited:
Back
Top