(MV) Change tile A ingame with script

All is in the title, I want to know how i can edit ground/Tile A, ingame to make a "random Map Generator"

Edit: I just need the MV version of ($game_map.data[11,5,0] = 2816)
To permanently change any tile (to keep the change after going to another map and returning) you'll need a plugin that rewrites how maps are loaded, because otherwise any change to the data structure will be lost as soon as a new map is loaded.
As far as I know such a plugin does not exist yet - there is one that uses regions to define what to load from other maps (to allowed for developing a map on predefined states), but that would require a lot of prework and not fit a random map generator.
@Andar I'm sorry there is a misunderstood, but it also solve the problem.
I do not want to keep the changeforever. I just need a way to recreate a map when the player enter in (I make the game for mobile. more than having plenty of map using Space in the hardrive, i want one map always different.)
((This is why i asked to you and refer to an other topic It was completely what i needed.))
Just a script to have a changed tile A while in the map)) The only things i see a plugin could be usefull, is if the plugin make it himself regarding the regions))
But no worry, I really just need the script to change the map while you are in.



(Optional to read: I started to create water Character sprite, but considering how it work, and that i also need grass and other tile A element, i want to save my time, my file size, and also optimize it (I guess change the tile with a script is better for the device than spawn event for each water tile...)
@ashyramoonwolf If you ONLY need to change the tileset, not the map structure, you can use random variables and use the "Change Tileset" option in the event menu.
@Extazee No. I don't need to change the tileset. But the tile. Lile generating water somewhere. ELSE I'll say I need to change the tileset, not the tile. That ia kind trying to help. But when I speack about "ground/tile" this is not a random formula.
And I will not create a thread for tileset, it already have been explained thousands times..
I'd say go to the script request thread and post it there, maybe someone would take it up to craft it. Cus I also doubt that the plugin exists yet.
From a VX Ace thread "The answer said that you can use the following command to do a temporarly tile changing.


$game_map.data[11,5,0] = 2816"

This is why i'm not in plugin request (befor the moderator move my thread) I need the Script call "

$game_map.data[11,5,0] = 2816" For MV
No more no less tbh...

(Edit: Of course i do not need this value. Just the general script call)

(Edit 2 : I already asked for many plugins, so while i can do without that... (Yes i'm still waiting for some of them))

(Edit 3 : I read all in the But never find it. Or as i think it is not in the list, or i need to change my eyes... ^^)
MV does not use the same structure as Ace for holding map data.

You could do it that way, but the A tiles are all autotiles, so it's not a matter of changing to a single tile id - it's a matter of determining which of the possible 48 patterns of an autotile should be used based on the current tile and the 8 surrounding tiles, and then setting that id.

I played with that when I was working on my upper autotile plugin (which broke with 1.5.0 and has never been fixed). Good luck with it.
Well, basically, i'm already trying to process it that way with event. I thought that using A tile change will be better for performance... (maybe not?)
Considering the way i'm working it, each tile call the next tile. (in a river going from up to down as an exemple, that can only lead to 3 way. going to left, right or keeping going down... Also when the lake started, you just need to draw the border, then doing the middle... )

.. Also in some situation, base autotiles can be "dumb" (I more than once tried to do things that couldn't be done the way autotile is working...

But whatever i try to see it, i think this will be the best for mobile export (If i do it my way, i create picture already existing in the A tile File, and as i said, i create bunch of event. Considering the road and the water, that already make ~200 event more or less...

If either you say me that using plenty of event to draw road and river isn't even slowing the performance, i'll keep it my way. (I don't know to be honest, i just think it is better for the phone...)

(Maybe it can help or not, but here are the first tried of my "Map Generator", of course the water is precreated here, i mainly tried to enable collider and bridge working nice)
Spoiler: video


Edit: to be accurate, i just need to have water, grass, and road to be randomly added. House and structure are premade in a character file, Then YEP REGION restrict the move

Edit 2: In the video, the map i'm talking about is the one i go in at 0:36 second. The one access by portal between the angels.
Sure, using events will slow down performance, because it's got all the interpreter behind it - move to the next command, set up the parameters, call the command - in addition to the logic you're actually doing

Depending on how you're doing it - with event commands to do the calculations, or as a single script call within the event.
I try to have a single process (event) spawning the world. (So i create water, then big structure, then road, then the nature (tree flower), then event (like npc, etc...))
My biggest problem is having each road tile and river tile as a event (when it should be just a tile.) This is why i want the script call to direct edit the ground/tile A (still don't know how to call them) and so create river road as tile and not as event (because right now, just to draw the road, i have like 80 event , one per tile, same for river and water.... so between 30 and 90 event (all this number are the "Minimum", as the road can take "weird" way but always end at the end of the map. And same for river. Current map size is 80 x/35 y.).
And as i'm bad at JS, i do not even know how to find the script call...

Edit: (Each tile is created one by one regarding wich tile was the last tile spawned. PLus the random effect that make a random map.)

Edit 2: Here you can "see" the map generating herself
Spoiler: viedo
@Shaz

(UP plz)

I wanted to know, looking at the primary JS files, i found line who may are what i need!

Spoiler: Line code from rpg core
/**
* @method _drawNormalTile
* @param {Bitmap} bitmap
* @param {Number} tileId
* @param {Number} dx
* @param {Number} dy
* @private
*/
Tilemap.prototype._drawNormalTile = function(bitmap, tileId, dx, dy) {
var setNumber = 0;

if (Tilemap.isTileA5(tileId)) {
setNumber = 4;
} else {
setNumber = 5 + Math.floor(tileId / 256);
}

var w = this._tileWidth;
var h = this._tileHeight;
var sx = (Math.floor(tileId / 128) % 2 * 8 + tileId % 8) * w;
var sy = (Math.floor(tileId % 256 / 8) % 16) * h;

var source = this.bitmaps[setNumber];
if (source) {
bitmap.bltImage(source, sx, sy, w, h, dx, dy, w, h);
}
};

/**
* @method _drawAutotile
* @param {Bitmap} bitmap
* @param {Number} tileId
* @param {Number} dx
* @param {Number} dy
* @private
*/
Tilemap.prototype._drawAutotile = function(bitmap, tileId, dx, dy) {
var autotileTable = Tilemap.FLOOR_AUTOTILE_TABLE;
var kind = Tilemap.getAutotileKind(tileId);
var shape = Tilemap.getAutotileShape(tileId);
var tx = kind % 8;
var ty = Math.floor(kind / 8);
var bx = 0;
var by = 0;
var setNumber = 0;
var isTable = false;

if (Tilemap.isTileA1(tileId)) {
var waterSurfaceIndex = [0, 1, 2, 1][this.animationFrame % 4];
setNumber = 0;
if (kind === 0) {
bx = waterSurfaceIndex * 2;
by = 0;
} else if (kind === 1) {
bx = waterSurfaceIndex * 2;
by = 3;
} else if (kind === 2) {
bx = 6;
by = 0;
} else if (kind === 3) {
bx = 6;
by = 3;
} else {
bx = Math.floor(tx / 4) * 8;
by = ty * 6 + Math.floor(tx / 2) % 2 * 3;
if (kind % 2 === 0) {
bx += waterSurfaceIndex * 2;
}
else {
bx += 6;
autotileTable = Tilemap.WATERFALL_AUTOTILE_TABLE;
by += this.animationFrame % 3;
}
}
} else if (Tilemap.isTileA2(tileId)) {
setNumber = 1;
bx = tx * 2;
by = (ty - 2) * 3;
isTable = this._isTableTile(tileId);
} else if (Tilemap.isTileA3(tileId)) {
setNumber = 2;
bx = tx * 2;
by = (ty - 6) * 2;
autotileTable = Tilemap.WALL_AUTOTILE_TABLE;
} else if (Tilemap.isTileA4(tileId)) {
setNumber = 3;
bx = tx * 2;
by = Math.floor((ty - 10) * 2.5 + (ty % 2 === 1 ? 0.5 : 0));
if (ty % 2 === 1) {
autotileTable = Tilemap.WALL_AUTOTILE_TABLE;
}
}

var table = autotileTable[shape];
var source = this.bitmaps[setNumber];

if (table && source) {
var w1 = this._tileWidth / 2;
var h1 = this._tileHeight / 2;
for (var i = 0; i < 4; i++) {
var qsx = table[0];
var qsy = table[1];
var sx1 = (bx * 2 + qsx) * w1;
var sy1 = (by * 2 + qsy) * h1;
var dx1 = dx + (i % 2) * w1;
var dy1 = dy + Math.floor(i / 2) * h1;
if (isTable && (qsy === 1 || qsy === 5)) {
var qsx2 = qsx;
var qsy2 = 3;
if (qsy === 1) {
qsx2 = [0,3,2,1][qsx];
}
var sx2 = (bx * 2 + qsx2) * w1;
var sy2 = (by * 2 + qsy2) * h1;
bitmap.bltImage(source, sx2, sy2, w1, h1, dx1, dy1, w1, h1);
dy1 += h1/2;
bitmap.bltImage(source, sx1, sy1, w1, h1/2, dx1, dy1, w1, h1/2);
} else {
bitmap.bltImage(source, sx1, sy1, w1, h1, dx1, dy1, w1, h1);
}
}
}
};



Any idea about that?
That is only a part of it.
I was wondering! Had you tried your plugins with YEP's one?? ( http://yanfly.moe/2017/09/13/yanflys-desktop-optimized-version-update-rpg-maker-mv-1-5-1/ )

If no mistake, it bring back some functions from version before 1.5.1
no. I don't write plugins that are dependent on other people's plugins, and I try to avoid using other people's plugins where possible. 1.5.0 changed the way tiles are drawn. I doubt Yanfly's plugin changes it back to the old way.

You really need to stop sending me PMs now. If I cannot help you here, in your thread, then repeatedly asking for help via PM is not going to get you any further.
ADMIN PLEASE! Delete the thread! Not usefull anyway!!!!
ADMIN PLEASE! Delete the thread! Not usefull anyway!!!!
Please check our rules around here ;-)
we never delete topics, we only close them - and you should report them to be closed, because a post like yours can be missed by the moderators (who are all volunteers on their limited free time).
Thread closed IgnoreMe

Original thread: https://forums.rpgmakerweb.com/threads/mv-change-tile-a-ingame-with-script.90005/