Submit Your Article


 
RPG Maker

Welcome Guest ( Log In | Register )


  Games Resources RPG Maker VX RPG Maker XP Scripts Tutorials Downloads

 
Reply to this topicStart new topic
> Tile Swap
Tsukihime
post Feb 28 2013, 08:20 AM
Post #1


Level 25
Group Icon

Group: Revolutionary
Posts: 561
Type: None
RM Skill: Undisclosed
Rev Points: 25




Tile Swap
Author: Tsukihime

Screenshot




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.

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
 
CODE
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
 
CODE
region_swap(regionID, tileID, layer, map_id)


3. Change by position
-The tile at the specified position will be changed to a new tile
 
CODE
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


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.

Understanding tiles

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
 
CODE
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.


__________________________
My Scripts
Go to the top of the page
 
+Quote Post
   

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 25th May 2013 - 05:37 AM
RPG RPG Revolution is an Privacy Policy and Legal
eXTReMe Tracker