(RMMV) The correspondence between tiles and data number.

What is the correspondence between tiles and data number in RMMV?
Here is the problem I met when I tried to change the tile data in my .js script.
1. First, I'll show you the data structure of the map:

JSON:
{
    "autoplayBgm": false,
    "autoplayBgs": false,
    "battleback1Name": "",
    "battleback2Name": "",
    "bgm": { "name": "", "pan": 0, "pitch": 100, "volume": 90 },
    "bgs": { "name": "", "pan": 0, "pitch": 100, "volume": 90 },
    "disableDashing": false,
    "displayName": "小型测试地图",
    "encounterList": [],
    "encounterStep": 30,
    "height": 3,
    "note": "",
    "parallaxLoopX": false,
    "parallaxLoopY": false,
    "parallaxName": "",
    "parallaxShow": true,
    "parallaxSx": 0,
    "parallaxSy": 0,
    "scrollType": 0,
    "specifyBattleback": false,
    "tilesetId": 1,
    "width": 3,
    "data": [
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0
    ]
}

2. Second, here is the tile group I used to draw this map:
A1: B: C:
A.png
B.png
C.png


3. When I put the first tile in A1
SEA.png
on pixel (0, 0), I noticed that the key "data" of data structure turned into this:
JSON:
"data": [
    2086, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0
]

and the map looks like this:
MAP.png


4. And my final question is:
Could you explain why the index of this tile is 2086? Also, how exactly do the map tiles correspond to their indexes in RMMV?
This might be a good reference to use as a starting point:

The most efficient way to find that out is probably to look into the rpg_core / rmmz_core.js file in the js directory and search for "Tilemap". However, this requires some scripting knowledge, so I will also try to explain the IDs in my own words.

IDs...
Code:
from 0    to 255  belong to sheet B,
from 256  to 511  belong to sheet C,
from 512  to 767  belong to sheet D,
from 768  to 1535 belong to sheet E,
from 1536 to 2047 belong to sheet A5,
from 2048 to 2815 belong to sheet A1,
from 2816 to 4351 belong to sheet A2,
from 4352 to 5887 belong to sheet A3,
from 5888 to 8191 belong to sheet A4

IDs in A1, A2, A3, and A4 also include the tile's SHAPE. I recommend looking into this thread: https://forums.rpgmakerweb.com/index.php?threads/how-to-determine-your-tileid.91129/

Last but not least, you probably also want to know the position in the data array for your tile, so the formula is:

Code:
(z * map height + y) * map width + x
z is the layer ID.

Hope that helps!
Here is the problem I met when I tried to change the tile data in my .js script.
I don't know exactly what you're trying to do, but you may be better served by an existing plugin. For example, Shaz's Tile Change.
The most efficient way to find that out is probably to look into the rpg_core / rmmz_core.js file in the js directory and search for "Tilemap". However, this requires some scripting knowledge, so I will also try to explain the IDs in my own words.

IDs...
Code:
from 0    to 255  belong to sheet B,
from 256  to 511  belong to sheet C,
from 512  to 767  belong to sheet D,
from 768  to 1535 belong to sheet E,
from 1536 to 2047 belong to sheet A5,
from 2048 to 2815 belong to sheet A1,
from 2816 to 4351 belong to sheet A2,
from 4352 to 5887 belong to sheet A3,
from 5888 to 8191 belong to sheet A4

IDs in A1, A2, A3, and A4 also include the tile's SHAPE. I recommend looking into this thread: https://forums.rpgmakerweb.com/index.php?threads/how-to-determine-your-tileid.91129/

Last but not least, you probably also want to know the position in the data array for your tile, so the formula is:

Code:
(z * map height + y) * map width + x
z is the layer ID.

Hope that helps!
Thank you very much! I'd better carefully review the rpg core file.

I don't know exactly what you're trying to do, but you may be better served by an existing plugin. For example, Shaz's Tile Change.
Thank you! Shaz's plugin is great! Actually, what I really want is to generate random maps using LLMs.
I knew @Aerosys has made an excellent plugin for generating random dungeons in 2019. I think it would be great if I could make maps using LLMs and RAG technology!

Original thread: https://forums.rpgmakerweb.com/threads/rmmv-the-correspondence-between-tiles-and-data-number.172239/