Tile Control 3.1: Relative Coordinates, Fill Commands! RPG Maker MV

Hey RPG Makers!

This update adds the ability to use relative coordinates! In this way, you can cause tile changes without needing to know the exact coordinate, which allows for even more dynamic tile changes! Also, you can use new commands for filling just the borders of areas, including filling only based on region! The new fill commands make it easier than ever to have flowing water or other dynamic changes in autotiles, all condensed down to a single plugin command that knows where tile changes should flow next, based on the region you’ve selected!

You are not logged in.
Download available to supporters of the Design Counselor level and higher.

To install:

  1. Download the file, and unzip it.
  2. Make sure the unzipped file is named Tyruswoo_TileControl.js and is saved as a .js file.
  3. Open the file folder of your project. Place the file in your project’s “js” folder, within the “plugins” folder.
  4. Open your project in RPG Maker MV, then go to the Tools menu and select Plugin Manager. Use the Plugin Manager to add and activate the plugin.

The full help content for Tile Control v3.1 is included below.

Tile Control v3.1
by Tyruswoo

Last Update: July 12, 2020

===========================================================================

Plugin Commands:

Tile Info

Displays the location and ID of the tiles on which the player currently stands.

Tile Refresh

Forces the tilemap to refresh, which allows correctly displaying the graphics of the map’s tiles. (Note: Tilemap refresh is automatic whenever a tile is changed.)

Tile Set x y z tileId

Set a tile at coordinates x y and layer z to the selected tileId. z = 0 for lowest layer.

Tile Set PlayerLoc z tileId

Set a tile at the player’s coordinates and layer z to the selected tileId.

Tile Set PlayerFront z tileId

Set the tile towards which player is facing at layer z to selected tileId.

Tile Set EventLoc eventID z tileId

At the location of the event with eventID, set layer z to tileId.

Tile SetRegion regionId tileId z

At all tiles with regionId, set the tile to tileId. z level is optional, and if not used, defaults to 0.

Tile SetArea x1 y1 x2 y2 tileId z

At all tiles in the area defined by coordinates x1,y1 to x2,y2, set the tile to tileId. z level is optional, and if not used, default to 0.

Tile SetAreaRegion x1 y1 x2 y2 regionId TileId z

Tile SetRegionArea regionId x1 y1 x2 y2 tileId z

The above commands have identical effects of combining the area and region filters together to only change the tileId of tiles that meet both area and region conditions. The z level is optional, and if not used, default to 0.

Tile Swap startTileId tileId z zEnd

At all tiles with tileId startTileId, set the tile to tileId. Affects z layer z, which may be excluded to default to z layer 0. zEnd is the layer used for setting the new tile, and is an optional argument that is by default the same as z.

Tile SwapRegion regionId startTileId tileId z zEnd

At all tiles with regionId and startTileId, set the tile to tileId. z level is optional, and if not used, defaults to 0. zEnd is the layer used for setting the new tile, and is an optional argument that is by default the same as z.

Tile SwapArea x1 y1 x2 y2 startTileId tileId z zEnd

At all tiles in the area defined by coordinates x1,y1 to x2,y2, if the tile matches startTileId, then set the tile to tileId. z level is optional, and if not used, defaults to 0. zEnd is the layer used for setting the new tile, and is an optional argument that is by default the same as z.

Tile SwapAreaRegion x1 y1 x2 y2 regionId startTileId tileId z zEnd

Tile SwapRegionArea regionId x1 y1 x2 y2 startTileId tileId z zEnd

The above commands have identical effects of combining the area, region, and tile filters together to only change the tileId of tiles that meet all area, region, and tile swap conditions. The z level is optional, and if not used, defaults to 0. zEnd is the layer used for setting the new tile, and is an optional argument that is by default the same as z.

Tile Fill x y tileId

Tile Fill x y tileId startTileId distance z

This command originates at coordinates x,y and sets tiles to tileId. If no startTileId is provided, then the tile found at x,y will be used to determine the startTileId. Using this command, it is possible to fill tiles, similar to a fill tool.

startTileId, distance, and z are optional arguments. The distance argument determines how many far the fill command will go. Note that the distance depends on tiles being adjacent. The z argument can be used to determine which z level is used for checking and setting new tiles.

Tile FillInnerBorder x y tileId

Tile FillInnerBorder x y tileId startTileId z

Finds the tiles that would be filled, but then only fills the outermost of these tiles.

Tile FillOuterBorder x y tileId

Tile FillOuterBorder x y tileId startTileId z

Finds the tiles that would be filled, but then instead fills one tile beyond the border.

Tile FillInnerBorderRegion x y tileId

Tile FillInnerBorderRegion x y tileId region startTileId z

Same as FillInnerBorder, but instead applies only to border tiles that have the specified region. (If the optional region argument is excluded, then region will be assumed to match the region at location (x,y) on the current map.)

Tile FillOuterBorderRegion x y tileId

Tile FillOuterBorderRegion x y tileId region startTileId z

Same as FillOuterBorder, but instead modifies only the outer border tiles that match the specified region. (If the optional region argument is excluded, then region will be assumed to match the region at location (x,y) on the current map.)

Tip: FillOuterBorderRegion is especially useful for making flowing water or lava, or drying up of water or lava.

Note that if the optional argument startTileId is excluded from FillInnerBorder, FillOuterBorder, FillInnerBorderRegion, or FillOuterBorderRegion, the behavior of the plugin command may be different. For example, FillOuterBorder will attempt to fill the outer border of the specified startTileId, using tileId to fill. If startTileId is not included, it will be assumed to be the same as tileId. So, if tileId is not the same as the tile at the indicated location, the origin tile in question will be modified to tileId, without affecting any other tiles.

===========================================================================

A tile’s tileId may be identified by opening the console window (using F12), then by having the party leader stand on the tile of interest, then holding the Control (Ctrl) key and pressing Enter (Return).

For example, using the default Overworld tileset, a whirlpool can be placed using the following plugin command:

Tile Set PlayerLoc 0 2576

There is also an easier way to specify the tileId. Rather than using the tileId itself, a code can be used. The code should begin with the letter of the tile panel to be used (A, B, C, D, or E). This is followed by the code number of the desired tile, where the numbers begin at 0 in the upper-left corner of the tile pane, then proceed to increment by 1 from left to right, then top to bottom. The pattern of the numbers for each pane A, B, C, D, and E, matches exactly the numbers shown in the R (region) pane, so the region pane can be used to determine the code number of any desired tile.

For example, using the default Overworld tileset, a whirlpool can be placed using this plugin command:

Tile Set PlayerLoc 0 A11

Notice in the above, that the whirlpool tile is in the A panel, and it is tile 11 in the panel.

Another easy way to specify the tileId is using tilemap coordinates; in other words, the (x,y) position of the desired tile within the tile’s selection panel.

For example, using the default Overworld tileset, a whirlpool can be placed using this plugin command:

Tile Set PlayerLoc 0 A3,1

Caution! To use the special tileId codes (“letter number” or “letter x comma y”), the Tile Control plugin assumes that your tileset includes a full tileset, including all tileset portions for the A tab; this includes A1, A2, A3, A4, and A5. Some tilesets leave out one or more of the portions of the A tab, such as A3 or A4. In the editor, it will appear that the A4 or A5 is in the location of A3, for example. This can make it easy to accidentally mistake the code! If you select a tile code for a tile that does not exist in the tileset, then it can cause excessive processing that can freeze the game, and may necessitate forcing the app to close! The easiest way to prevent this problem is to just use placeholder A1, A2, A3, A4, and A5 tiles in your tilesets, even if the tiles are not needed for the map. This makes it easier to count the codes for the tiles.

===========================================================================

By default, above the selected z layer, all z layers are erased when the tile is set. This is similar to how RPG Maker MV works in the map editor. If you want to set a single z layer without modifying any upper z layers, use “Tile SetLayer” instead of “Tile Set”.

By default, autotiles are detected, so if Tile Set is used to set an autotile, then nearby autotiles will be detected, and they will be linked together. If you want to prevent autotiling, and just set the tile exactly, then use “Tile SetExact” instead of “Tile Set”. This is similar to using a Ctrl+RightClick to copy a tile exactly in the map editor.

It is possible to combine “Tile SetLayer” and “Tile SetExact”. So, you can use “Tile SetLayerExact” (or synonymously, “Tile SetExactLayer”). Using “Tile SetLayerExact” will result in the z layer of the tile being modified, without changing the above z layers of the tile, and without affecting any nearby autotiling.

===========================================================================

v2.1: May 7, 2020

It is now possible to use the following commands:

  • Tile SetRegion regionId tileId z
  • Tile SetArea x1 y1 x2 y2 tileId z
  • Tile SetAreaRegion x1 y1 x2 y2 regionId tileId z
  • Tile SetRegionArea regionId x1 y1 x2 y2 tileId z
  • Tile Swap startTileId tileId z zEnd
  • Tile SwapRegion regionId startTileId tileId z zEnd
  • Tile SwapArea x1 y1 x2 y2 startTileId tileId z zEnd
  • Tile SwapAreaRegion x1 y1 x2 y2 regionId startTileId tileId z zEnd
  • Tile SwapRegionArea regionId x1 y1 x2 y2 startTileId tileId z zEnd

Note: Set TileAreaRegion and Set TileRegionArea have the same result, but just switch the order of input of the regionId and area coordinates within the plugin command.

Also note that in the above plugin commands, z and zEnd are optional arguments. By default, z is 0. By default, zEnd is the same as z.

Tips:

The Swap command is useful if you want to change all startTileId to tileId on the current map.

The SwapArea command is useful if you want to change all startTileId to tileId within only a certain area of the map.

The SwapRegion command is useful if you want to change all startTileId to tileId within only a certain region of the map.

The SwapAreaRegion (or SwapRegionArea) command is useful if you want to change all startTileId to tileId within only a certain area of the map and certain region of the map. Therefore, three conditions must be met: startTileId, area, and region. This can be use for fine-tuned control of making lots of tile changes with only needing a few commands.

===========================================================================

v3.0: May 21, 2020

Adds the fill command!

Tile Fill x y tileId

Tile Fill x y tileId startTileId distance z

This command will begin at coordinates x,y and will set tiles to tileId. If no startTileId is provided, then the tile found at x,y will be used to determine the startTileId. Using this command, it is possible to fill tiles, similar to a fill tool.

startTileId, distance, and z are optional arguments. The distance argument determines how many far the fill command will go. Note that the distance depends on tiles being adjacent. The z argument can be used to determine which z level is used for checking and setting new tiles.

===========================================================================

v3.1: July 12, 2020

Relative Coordinates:

Added relative coordinate options! Now, instead of defining the exact x and y coordinates, you can use x, x+Int, x-Int, y, y+Int, or y-Int, where x and y represent the current coordinates of the event running the plugin command; and where “Int” is any integer value. You can use this to more easily specify where tile changes are to be made, without needing to determine the exact coordinate values!

For example, the following sets tile A3,1 at a location two tiles to the right, and one tile down, from the event running the plugin command:

Tile Set x+2 y+1 0 A3,1

As another example, the following sets tile A3,1 at a location two tiles to the left, and one tile up, from the event running the plugin command:

Tile Set x-2 y-1 0 A3,1

Relative coordinates also work with all other plugin commands, including Set Area, Swap Area, and all types of Fill commands, including the new Fill commands (see below).

Fill Border Commands:

Added more specialized fill commands! These fill commands make it easier to use a single plugin command multiple times in many situations, rather than needing to define exactly the location to be changed.

Use the following to find the tiles that would be filled, but then only fill the outermost of these tiles.

Tile FillInnerBorder x y tileId

Tile FillInnerBorder x y tileId startTileId z

Use the following to find the tiles that would be filled, but then instead fill one tile beyond the border.

Tile FillOuterBorder x y tileId

Tile FillOuterBorder x y tileId startTileId z

The following is the same as FillInnerBorder, but instead applies only to border tiles that have the specified region. (If the optional region argument is excluded, then region will be assumed to match the region at location (x,y) on the current map.)

Tile FillInnerBorderRegion x y tileId

Tile FillInnerBorderRegion x y tileId region startTileId z

The following is the same as FillOuterBorder, but instead modifies only the outer border tiles that match the specified region. (If the optional region argument is excluded, then region will be assumed to match the region at location (x,y) on the current map.)

Tile FillOuterBorderRegion x y tileId

Tile FillOuterBorderRegion x y tileId region startTileId z

Tip: FillOuterBorderRegion is especially useful for making flowing water or lava, or drying up of water or lava.

Note that if the optional argument startTileId is excluded from any of the above, the behavior of the plugin command may be different. For example, FillOuterBorder will attempt to fill the outer border of the specified startTileId, using tileId to fill. If startTileId is not included, it will be assumed to be the same as tileId. So, if tileId is not the same as the tile at the indicated location, the origin tile in question will be modified to tileId, without affecting any other tiles.

Also, as of Tile Control v2.0 and beyond, it is easy to select the desired tile using a code, which is including again here for reference.

The easiest way to identify the desired tile is using the tile’s coordinates. For example, if the map is using the Overworld tileset, and we want to place a whirlpool, we can use A3,1 for the tileId.

Tyruswoo Tile Control tileId Code
Example of how to determine the tileId code.

In the example above, it is also possible to use the code A11 to place the whirlpool tile, since (starting from the top left tile being tile 0), the whirlpool is tile 11. Note that this number matches the same number as shown on the R (region) tab, so you can use the region tab to easily find a code for the desired tile.

Or, in the example above, we can use the technical tileId, which is 2576. Using a technical tileId is only necessary if you want to place a specific shape of the autotile. In such cases, in your plugin command, you will also need to use SetExact instead of Set. To find the technical tileId, you can go into playtesting mode, then hold Ctrl and press Enter on top of a tile to log its technical tileId to the console window.

Caution!

When using the above method for finding the “letter x comma y” tileId code (or the similar “letter number” tileId code), you must never select a tile that is not defined in your tileset. Undefined tiles are most commonly accidentally selected when the A tab tiles do not include all of the A1, A2, A3, A4, and A5 tiles. Note that Tile Control assumes that when you determining the code, you are using a full set of all five types of A tiles in your tileset. So, for example, if your tileset is missing A3, and you do not account for this when determining the appropriate code for your A4 tile, you may accidentally select an A3 code, resulting in placing an undefined tile. This can cause your game to freeze and crash, and necessitate forcing the app to close!

The best way to avoid this problem is to fill all your tilesets with A1, A2, A3, A4, and A5 tiles, even if they are just placeholder tiles. This way, you can more easily count to determine the correct tileId code.

Happy RPG making! Only you can build your dreams!

Tyruswoo

P.S. Are you looking forward to RPG Maker MZ? I know I am! Let me know if you want me to make a tutorial video series for RPG Maker MZ!

Questions or concerns? Check out the forums to ask a question. You may even find an answer there, already!

To view and submit comments on this post, you must be logged in and joined as at least a Warm Fuzzy member. Log In No account, or ready to upgrade your membership? Join the adventure!

Tyruswoo

Indie Game Designer
creating game content!

Latest RPG Maker

Pin It on Pinterest

Shares