This script allows you to easily change tiles on the map.
Script: Get it at Hime Works
Tutorial: Easy Tile Swapping. I would recommend reading this to see how this script works.
Making a bridge
A crack in the wall
KilloZapit, for providing the code for auto-tile generation.
There are three types of tile swaps
1. Change by tile id
-All tiles on the map with the specified ID will be changed to a new tile
tile_swap(old_tileID, new_tileID, layer, map_id)
2. Change by region id
-All tiles that are covered by the specified region ID will be changed to a new tile
region_swap(regionID, tileID, layer, map_id)
3. Change by position
-The tile at the specified position will be changed to a new tile
pos_swap(x, y, tileID, layer, map_id)]
You can undo changes by using the following calls
tile_revert(tid, layer, map_id) pos_revert(x, y, tid, layer, map_id) region_revert(rid, layer, map_id) revert_all
For performance reasons, you should avoid swapping tiles by ID. It goes through every tile on the map to see if it needs to be changed, and if you have a large map, it will take some time to perform. This is meant for large-scale tile swaps where it is unfeasible to specify using regions or positions.
It is recommended that you stick with region tile swapping and position tile swapping.
This script uses the concept of a "tile ID", which is a special string
that represents a particular tile on your tileset.
The format of this tile ID is a letter, followed by a number.
The letters available are based on the tileset names
A, B, C, D, E
The number represents the ID of the tile.
So for example, "A3" would be the the third tile in tileset A, whereas
"B12" would be the 12th tile of tileset B.
An example usage would be
tile_swap("A9", "A1", 0)
Which will swap all "A9" tiles on layer 0 with "A1" tiles. As usual, because I did not pass in a map ID, it is assumed to be the current map. Please check the new script call format for details.
It is very easy to look up the appropriate ID: just look at your tileset and number the top-left tile as 1. Then, numbering left-to-right, top-to-bottom, you would get something like this
For tileset A, it is a little different. This is assuming you have all 5 parts in tileset A.
You will need to skip over any missing pieces appropriately if you do not have all 5 parts.
To avoid all this unnecessary math, simply fill up the empty slots with dummy tilesets to make things easier.
Edited by Tsukihime, 25 February 2013 - 02:35 PM.