Get tile type

Hi
I am trying to get some info off the tile which tells if there is water or something else blocking the tile but to my surprise i haven't found function to do this. I'm looking for script solution

i thought it might have something to do with $gameMap.layeredTiles but I don't know what the value in tile represents. It's probably some type of mask


JavaScript:
var tilesz = $gameMap.layeredTiles(xPos,yPos);
for(let ti = 0; ti < tilesz.length; ti++)
{
  var tile = tilesz[ti];
}

anyone knows?

thx!
Ok I think Game_Map.prototype.isPassable works here but i also need a way to check for water and what not

i didnt know RM has multiple layers of tiles so its confusing 🙂
Basic: $gameMap.isPassable(x, y)

To check for water
Code:
const tileId = $gameMap.tileId(x, y, z)
const isWater = Tilemap.isWaterTile(tileId)

You need to repeat this for z = 0, 1, 2, and 3.
Of course any mapping needs multiple layers, you wouldn't be able to place a tile like a tree above another tile like grass without layers.

That said, there is no flag to identify water or whatever, because the engine has no care on what picture any tile contains. It only cares about passability to the player, which is a combination of the passability of all tile layers.

And the ship/boat passability has no flag, it goes by ID of the tile. You can read in the help section which tiles from A1 are passable for the ship and which are not, and it doesn't matter to the ship if the picture of the tile is water, lava, grass or whatever.
thx!
can i ask why there is 4 layers of tiles? would index 3 mean it's top and blocks flying creatures? and zero is ground?
see my answer above, but basically you have one ground layer for A-tiles, one special ground layer that is used only for certain tiles like fences, and two upper layer for anything B-E tiles.
and nothing blocks flying, because there is no flying only events set to above (and that is ignoring passabilities, not flying)
What Aerosys mentioned should work. I think you'd only need to check z = 0 because MV's automatic layering will always place water tiles (A1) on layer 0. Tilemap.isWaterTile is just a shorthand for the relevant tile ID check.

Alternatively, you can use the Get Location Info event command to get tile info, e.g. Region ID or Terrain Tag, from map X & Y coordinates. Regions are painted from the R tab of the tile palette, terrain tags are set on the Tilesets tab of the database.

(Technically there are tileset flags for boat/ship passability, but like Andar said, the editor auto-assigns those based on tile ID.)

Original thread: https://forums.rpgmakerweb.com/threads/get-tile-type.161818/