Get tile name

Hi
i want to check the tile the player currently is to decide which battleback to show. it would be ideal to get that tile name as seen in the editor bottom-left hint.

Right now i can get the tile id like this but it's as far as i could get this time:

$gameMap.tileId($gamePlayer.x, $gamePlayer.y, 0); // And: let ts = $dataTilesets[$gameMap.tilesetId()];

anyone knows?

thx!
A couple of things:
1 - The engine already does this. If you change the tileset in the database to be World Type, you can then just edit the built-in function that produces battlebacks based on the tile ID.

2 - As far as I know, that "tile name" has no connection to the game at all. It's stored in separate text files that are only referenced by the editor, they're not loaded by the game engine.

Plus they're not universally used if you are using any tilesets other than the default included assets, so trying to base your code off of it would require you to spend additional effort making the text files, and then creating your own data structures and loading functions to get them into the game.
1 - The engine already does this. If you change the tileset in the database to be World Type, you can then just edit the built-in function that produces battlebacks based on the tile ID.

I didn't find such function but I'll keep looking

2 - As far as I know, that "tile name" has no connection to the game at all. It's stored in separate text files that are only referenced by the editor, they're not loaded by the game engine.

i was hoping they were loaded in, to somewhere....

Plus they're not universally used if you are using any tilesets other than the default included assets, so trying to base your code off of it would require you to spend additional effort making the text files, and then creating your own data structures and loading functions to get them into the game.

not a problem as I use the stock worldmap tiles only..
Yanfly has a plugin "YEP_RegionBattleBacks" which allow you to use
regions to decide what battle back to use (I dont use this my own),
but it can make things easier.

without plugin might be longer if you need to check the X and Y for each spots.
but not sure if there is a better way to control it otherwise.
I didn't find such function but I'll keep looking
If you grep the .js files for "battleback" it should come right up:
Code:
Spriteset_Battle.prototype.terrainBattleback1Name = function(type) {
    switch (type) {
    case 24: case 25:
        return 'Wasteland';
    case 26: case 27:
        return 'DirtField';
    case 32: case 33:
        return 'Desert';
    case 34:
        return 'Lava1';
    case 35:
        return 'Lava2';
    case 40: case 41:
        return 'Snowfield';
    case 42:
        return 'Clouds';
    case 4: case 5:
        return 'PoisonSwamp';
    default:
        return null;
    }
};

Spriteset_Battle.prototype.terrainBattleback2Name = function(type) {
    switch (type) {
    case 20: case 21:
        return 'Forest';
    case 22: case 30: case 38:
        return 'Cliff';
    case 24: case 25: case 26: case 27:
        return 'Wasteland';
    case 32: case 33:
        return 'Desert';
    case 34: case 35:
        return 'Lava';
    case 40: case 41:
        return 'Snowfield';
    case 42:
        return 'Clouds';
    case 4: case 5:
        return 'PoisonSwamp';
    }
};

You can just add conditionals in there to check $gameMap.tilesetId()
thx for the replies. i think the code seems bit undone but this is probably because they didn't want to create all the graphics like for example snow forest is missing.

but I guess you cant have everything 🙂
its for you to extend that list on the x/y I think on its type.
the list can be as long as you like to what to show where ^^
its for you to extend that list on the x/y I think on its type.
the list can be as long as you like to what to show where ^^

yep. i meant some graphics are missing so it wont be perfect
thx for the replies. i think the code seems bit undone but this is probably because they didn't want to create all the graphics like for example snow forest is missing.
...the default snowfield battleback shows the same kind of withered trees in it as the map tile does?

If you really think it doesn't look good enough without more of them, use an image editor to copy and paste them. The RTP is not intended to be an exhaustive set of assets.
just extend the tile ID and add the battle back, it can be even 100 battlebacks
or even more, depending on your needs, and not sure on MapId's using different
tilesets.

so something need to be done through that too or a way to control mapId
and the tileId.

which YEP_RegionBattlebacks make this easier ^^.
there might be other plugins controlling battlebacks I think.
...the default snowfield battleback shows the same kind of withered trees in it as the map tile does?

yes it shows few withered trees, definitely not a forest

wish I had artistic skills to do something about that ;D

Original thread: https://forums.rpgmakerweb.com/threads/get-tile-name.162778/