Language…
16 users online: CroNo, DanMario24YT, Dennsen86, Hammerer, Inflagrandy, KaptainAhab,  MarioFanGamer,  MarkAlarm, mikeeeeee83, Nayfal, oliver1, playagmes169,  Segment1Zone2, signature_steve, Sweetdude, TheXander - Guests: 319 - Bots: 387
Users: 64,795 (2,371 active)
Latest user: mathew

Read all terrain block positions and types

All the scripts and tools I have tested only seems to be detecting sprites such as enemies and intractable blocks.

Is there any script or way to get all the terrain block such as the floor, the climbable net, water and so on?

The goal is to be able to make path finding scripts and to have Mario move in other patterns when climbing.


I'm a bit unsure about what you want to do, but if you're looking for how to read level data, you want $7EC800 and $7FC800, which contain all the tile data for the current level. Finding a specific tile can be a bit weird, though; if you need to do so through ASM, the routine from $019441 through $01953B might help (it finds the Map16 tile a sprite is currently touching, in a direction specified by Y with 0 = right, 1 = left, 2 = down, 3 = up).

Professional frame-by-frame time wizard. YouTube - Twitter - SMW Glitch List - SMW Randomizer
Originally posted by Thomas
I'm a bit unsure about what you want to do, but if you're looking for how to read level data, you want $7EC800 and $7FC800, which contain all the tile data for the current level. Finding a specific tile can be a bit weird, though; if you need to do so through ASM, the routine from $019441 through $01953B might help (it finds the Map16 tile a sprite is currently touching, in a direction specified by Y with 0 = right, 1 = left, 2 = down, 3 = up).


I want to create a grid map of the entire level or a section of the level in a list. This map will be used for making path finding algorithm and specific behavior when mario is on a specific tiletype.

Your reply seems to be exactly what I am looking for so I will check it out thanks for the help.
This will help you Basically, you input the x and y block position on $98 (Y position) and $9A (X position).
Give thanks to RPG hacker for working on Asar.
I am using BizHawk with Lua-script and i have a function that gives me the block on an XY position

I sill can't solve how to read all terrain blocks into a list though. I'm trying to make one functions that gives me all the terrain blocks Mario can "see" and one that gives all blocks for the current level.

Got any hints, pointers or tutorial for this?
If you just want a list of blocks then all blocks are listed at 0x7EC800/0x7FC800.

This script has a function called "get_map16_value" which might be worth looking at.
Originally posted by TheBiob
If you just want a list of blocks then all blocks are listed at 0x7EC800/0x7FC800.

This script has a function called "get_map16_value" which might be worth looking at.


Sweet thanks! What about water, lava and the climbable net are they part of the map_16 as well or?
Yes. Every block has it's own map16 id (I believe "map16" is just a name lunar magic gave it though). Water for example is 00 (01, 02 and 03 are also different types of water). Tiles 07-1C are climbable nets 06 is a vine, cement block is 130 etc.

If you open a clean rom in lunar magic then click on the "16x16 Tilemap editor" (#lm{16x}) you can see all tiles and their id. I believe "kind" contains the map16 id after calling the function from the script.
Originally posted by TheBiob
Yes. Every block has it's own map16 id (I believe "map16" is just a name lunar magic gave it though). Water for example is 00 (01, 02 and 03 are also different types of water). Tiles 07-1C are climbable nets 06 is a vine, cement block is 130 etc.

If you open a clean rom in lunar magic then click on the "16x16 Tilemap editor" (#lm{16x}) you can see all tiles and their id. I believe "kind" contains the map16 id after calling the function from the script.


Nice then i have everything i need thank you all for the help.

One last question for this topic: do i manually have to sort out all the tiles that has an affect on Mario? For example water makes you swim but a tree is just for decoration.

Or is there a much simpler way?
As far as I know there is not. The original two pages are mostly sorted though (Like most of the blocks that are the same type are in a row)
Originally posted by TheBiob
As far as I know there is not. The original two pages are mostly sorted though (Like most of the blocks that are the same type are in a row)


I manually created a list of which of the first 512 tiles were interactable then i noticed it doesn't detect the water in the first water level (Yoshi's Island 4).

It can't be selected in the lunar magic editor either is it some sort of special case?
Yeah, that water is Layer 3 water. From the looks of it that function is only able to find map16 tiles on Layer 1 (The main layer. Most of the levels only have that layer, some use layer 2 (The moving blocks in the first cave for exmample) and others use layer 3 (The smashers in the first castle and these water tides)).

Layer 3 tides by themselves are their own kind of thing. I don't really know how the game handles layer 3 water (I think I read that it uses the second half of the map16 data for interaction by filling it with water and uses layer 3's position to get the corresponding block? I don't actually know though) so I can't really help you there.

Since the water is stationary it might be enough to treat everything below a certain position as water in these levels? It's not really a pretty solution though.
You mean the tides, don't you? These aren't usual block. Instead, the game puts water tiles there (on a secondary layer i.e. the same layer 2 like in levels like Donut Plains 2 but without graphics*) and the graphics are on layer 3.

*It also is the reason why levels with tides can only have maximally 0x10 screens like layer 2 levels do instead of the usualy 0x20 as it's the case with all other regular horizontal levels.

Edit: Ninja'd but w/e.
Ah i see! This different layer stuff feels a bit advanced and layer 1 is enough for what i want to do anyway.

Probably something i will look at once i learned more.