This script provides functionality for swapping tiles. In a single script call, you can change entire groups of tiles from one tile to another. The changes may be reverted as well using simple script calls.
Script: download here
There are some concepts and terminology that you would need to be familiar with before effectively using this script.
RMVX Ace’s tileset design takes a single tileset and splits it into 5 different pages (A, B, C, D, E). It then takes the A-page and breaks it down into 5 more parts (A1, A2, A3, A4, A5)
This script uses the custom concept of a “tile ID”, which is a special string that represents a particular tile on your tileset page.
The format of a tile ID is a letter, followed by a number.
- The letter is the tileset page.
- The number is the position of the tile on that page.
So for example, “A3” would be the the third tile in tileset A, whereas
“B12” would be the 12th tile of tileset B.
It is very easy to look up the position of a tile: just look at your tileset page and number the top-left tile as 1. Then, numbering left-to-right, top-to-bottom, you would get something like this
For page A, it is a little different. This is assuming you have all 5 parts.
If you are missing any parts, you will need to skip them appropriately.
To avoid all the unnecessary math, simply fill up the empty slots with dummy tilesets to make things easier.
The script supports three ways to swap tiles:
- Swap by tile ID
tile_swap(old_tileID, new_tileID, layer, map_id)
This is a very simple swap. It takes all of the old tiles and swaps them to the new tile. For maps where you simply want to swap out an unwanted tile, this is the easiest to use.
2. Swap by region ID
region_swap(regionID, tileID, layer, map_id)
This swaps all tiles within a region to the new tile.
- Swap by position
pos_swap(x, y, tileID, layer, map_id)
This swaps the tile on the specified position to the new tile.
You can undo any changes by using the following calls
tile_revert(tid, layer, map_id) pos_revert(x, y, layer, map_id) region_revert(rid, layer, map_id) revert_all(map_id)
Each method has its own uses in different situations depending on which tiles need to be swapped.
KilloZapit, for providing the code for auto-tile generation.