Jump to content

Custom maps: Difference between revisions

no edit summary
>Torchickens
>Torchickens
No edit summary
 
(4 intermediate revisions by the same user not shown)
Line 16:
[[File:RB Subtile table1.png|400px]]
 
The little endian pointer to the top-left map block on the screen is stored at D35ED35F/D35FD360 (D35E/D35D/D35E in Yellow) and is adjusted when the player is walking around. This pointer can be changed to RAM by adjusting item 33 and item 33 quantity. This method while applying the changes while the menu is opened, does not immediately do so while the menu is closed (unless the player walks around to load the new data). However, the data can be applied by using glitch item [[ItemDex/Y:094|9F (0x5E)]] in English Yellow, or by swapping an X Attack x18 into item 41 in English Red/Blue (the latter forces the map script to load it).
 
Normally, D35ED35F/D360 points to RAM anyway and the game writes to the relevant address after a normal map is loaded. Hence, an alternative method for creating a custom map is to write to the intended RAM address (for example the region around C6F9+ in Pallet Town). To create a sense of permanency, the player can use a [[MetascriptDex|meta map script in RAM]] to call copydata to constantly write to this data, even after leaving and returning to the map (as long as the altered meta map script is kept).
 
Additional features to the map can be added by making the arbitrary code execution program alter the following addresses:
Line 24:
*D887 (or D886): The start of the wild grass Pokémon data (see [https://datacrystal.romhacking.net/wiki/Pok%C3%A9mon_Red/Blue:RAM_map#Wild_Pok.C3.A9mon Datacrystal]). The player needs to be on the same sub-tile stored in D535 (known as the "grass tile"), which is normally 0x52.
*D8A4 (or D8A3): The start of wild water Pokémon data. All maps use sub-tile 0x14 as the water-tile.
*D36C-D36D (or D36B-D36C): The text pointer table location for each NPC. This two byte pointer should point to an address itself a list of two byte pointers in the map's text box index number order (readwhen reading a sign/talking to an NPC this is stored at FF8C).
*D36E-D36F (or D36D-D36F): The "level-script pointer". It is basically a little endian pointer to a script that is run continuously when the menu is closed (which is also an ideal arbitrary code execution method through adjusting item 41 in the expanded inventory). The bank of the script for pointers ranging between 4000-7FFF depends on the currently loaded map at D35E/D (see [[bp:List of locations by index number (Generation I)|this article on Bulbapedia for each map's bank]]).
*D35E (or D35D): The currently stored map. Upon changing it, this will control the palette, Town Map name/position on map; however, this will not warp the player automatically (the player can however warp instantly using the previously mentioned 9F or X Attack x18 methods but data like coordinates D361-D362 (-1), coordinate block D363-D364 (-1) may have to be adjusted with it).
*D367 (or D366): "wCurMapTileset", although changes will not be applied to the tileset. This address however modifies field move permissions. 0x00 indicates that the player can Fly and Teleport away. 0x06 is used for buildings where it is impossible to escape with any field move. 0x11 is for dungeons/in-door places where it is possible to Dig or Escape Rope away.
*D35B/A: Music played on map. These changes are not automatic, so including code in the map script to play it may be a reasonable idea.{{elaborate}} A list of values can be found in the Pastebin paste [https://pastebin.com/1epAd2aT here]
Line 74:
 
wSignTextIDs:: ; d4d1
</pre>
 
Others (-1 in Yellow). Note: When adjusting wWarpEntries, the warp must be a suitable tile to function, such as a door or ladder.
 
<pre>
wCurMapHeight:: ; d368
; blocks
ds 1
 
wCurMapWidth:: ; d369
; blocks
ds 1
 
wMapDataPtr:: ; d36a
ds 2
 
wMapConnections:: ; d370
; connection byte
ds 1
 
wMapConn1Ptr:: ; d371
ds 1
 
wNorthConnectionStripSrc:: ; d372
ds 2
 
wNorthConnectionStripDest:: ; d374
ds 2
 
wNorthConnectionStripWidth:: ; d376
ds 1
 
wNorthConnectedMapWidth:: ; d377
ds 1
 
wNorthConnectedMapYAlignment:: ; d378
ds 1
 
wNorthConnectedMapXAlignment:: ; d379
ds 1
 
wNorthConnectedMapViewPointer:: ; d37a
ds 2
 
wMapConn2Ptr:: ; d37c
ds 1
 
wSouthConnectionStripSrc:: ; d37d
ds 2
 
wSouthConnectionStripDest:: ; d37f:
ds 2
 
wSouthConnectionStripWidth:: ; d381
ds 1
 
wSouthConnectedMapWidth:: ; d382
ds 1
 
wSouthConnectedMapYAlignment:: ; d383
ds 1
 
wSouthConnectedMapXAlignment:: ; d384
ds 1
 
wSouthConnectedMapViewPointer:: ; d385
ds 2
 
wMapConn3Ptr:: ; d387
ds 1
 
wWestConnectionStripSrc:: ; d388
ds 2
 
wWestConnectionStripDest:: ; d38a
ds 2
 
wWestConnectionStripHeight:: ; d38c
ds 1
 
wWestConnectedMapWidth:: ; d38d
ds 1
 
wWestConnectedMapYAlignment:: ; d38e
ds 1
 
wWestConnectedMapXAlignment:: ; d38f
ds 1
 
wWestConnectedMapViewPointer:: ; d390
ds 2
 
wMapConn4Ptr:: ; d392
ds 1
 
wEastConnectionStripSrc:: ; d393
ds 2
 
wEastConnectionStripDest:: ; d395
ds 2
 
wEastConnectionStripHeight:: ; d397
ds 1
 
wEastConnectedMapWidth:: ; d398
ds 1
 
wEastConnectedMapYAlignment:: ; d399
ds 1
 
wEastConnectedMapXAlignment:: ; d39a
ds 1
 
wEastConnectedMapViewPointer:: ; d39b
ds 2
 
wSpriteSet:: ; d39d
; sprite set for the current map (11 sprite picture ID's)
ds 11
 
wSpriteSetID:: ; d3a8
; sprite set ID for the current map
ds 1
 
wObjectDataPointerTemp:: ; d3a9
ds 2
 
ds 2
 
wMapBackgroundTile:: ; d3ad
; the tile shown outside the boundaries of the map
ds 1
 
wNumberOfWarps:: ; d3ae
; number of warps in current map
ds 1
 
wWarpEntries:: ; d3af
; current map warp entries
ds 128
 
wDestinationWarpID:: ; d42f
; if $ff, the player's coordinates are not updated when entering the map
ds 1
 
ds 128
</pre>
 
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.