Tile Swap
Author: Tsukihime
Overview
This script allows you to easily change tiles on the map.
Download
Script: Get it at Hime Works
Tutorial: Easy Tile Swapping. I would recommend reading this to see how this script works.
Extensions
"Swap From" functions - specify tile to swap using an existing tile on the map
Examples:
Making a bridge
A crack in the wall
Credits
KilloZapit, for providing the code for auto-tile generation.
Usage
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
Understanding tilesThis 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.
Author: Tsukihime
Overview
This script allows you to easily change tiles on the map.
Download
Script: Get it at Hime Works
Tutorial: Easy Tile Swapping. I would recommend reading this to see how this script works.
Extensions
"Swap From" functions - specify tile to swap using an existing tile on the map
Examples:
Making a bridge
A crack in the wall
Credits
KilloZapit, for providing the code for auto-tile generation.
Usage
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
Code:
tile_revert(tid, layer, map_id)pos_revert(x, y, tid, layer, map_id)region_revert(rid, layer, map_id)revert_all
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.
Last edited by a moderator:

