Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

[VX] Multiple Tilesets

poccil

Sponsor

Multiple Tilesets
By Peter O., June 1, 2008

This is a system for allowing more tilesets than normally allowed in RPG Maker VX.
Tilesets are placed in the folder Graphics/Tilesets/ and each map can have its own tileset.

Download

Download link

A new version was uploaded to solve issues and emphasize very important points.

Introduction

This system is designed to support multiple tilesets in a game.  It does so by placing each tileset image file in
the folder Graphics/Tilesets/.  Each map can have its own tileset.  For example, map 1's tileset could have a
certain set for TileA, TileB, etc., and map 2's tileset could have a different set for those same tilesets.

First Steps

First, copy the files in the tileset system's download to your game project's folder, then put the script file named
"TilemapRuntime"  within the Materials section of the project's script editor.

Please note that the tileset editor cannot be run by itself.  It must be used in conjunction with an existing project
(copy the files in the download to the project's folder).

The editing is done in the tileset editor.  When you start the tileset editor, you are presented with two choices: 
"Edit tilesets", for creating the tilesets, and "Edit maps' tilesets", for associating the tilesets with each map
in the game.

Edit Tilesets

Use the option Edit Tilesets to either create a new tileset, or modify an existing tileset.  A tileset consists
of nine files, which have  the same meaning as in RPG Maker VX.  Here is an example of how a tileset could look
in the "Edit tilesets" part of the tileset editor.

TileA1: MyTileA1.png
TileA2: MyTileA2.png
TileA3: Buildings.png
TileA4: Walls.png
TileA5: Floor.png
TileB: MyTileB.png
TileC: MyTileC.png
TileD: MyTileD.png
TileE: MyTileE.png

By default, each file in a new tileset will be equal to the files found in the RGSS2-RTP named "RPGVX".  Put those files
in a new folder, "Graphics/Tilesets/".  This is where all custom tileset files should be placed.

Select a tileset image to change the image used for that part of the tileset.  For example, select TileA1
to change the TileA1 tileset.  You will get a list of all the image files contained in the Graphics/Tilesets/
folder to choose from.

There are two other options here: "Rename" and "Set passages".  Choosing Set passages opens an editor similar
to the "Passage settings" mode in RPGVX.  Here you can change the passability of each tile in the tileset.  In
this editor, press the F5 key to move to a different portion of the tileset, and press X to save or cancel the
changes.

The last option is to rename the tileset.  This is rather self-explanatory.

Edit Maps' Tilesets

The other choice found in the main menu is to "edit maps' tilesets", that is to edit the association of a map
with a tileset, as defined according to the steps above.

Here, choose any map, and you will have the option to choose a tileset or to load the tileset in RPGVX.  If you
choose to choose a tileset, a list of all the tilesets available will appear where you can make a selection.

If you choose to load the tileset, you will be notified whether the loading is successful.  If the tileset was
loaded, click on the map's name in the RPGVX editor to see the change and work with the map as usual.  Passage
settings cannot be edited here, but only in the tileset editor.  Internally, the process copies the files mentioned
in the tileset to the System folder of the project; thus, tileset files located there can be overwritten.  This is
why all tileset files should be placed in the "Graphics/Tilesets/" folder.

It is very important to note that RPGVX will not load tilesets automatically.  Whenever you decide to work with
a different map in RPGVX, you must select the new map in the tileset editor and load that map's tileset.  If you
don't, the tileset for that map may appear incorrect.  This is a problem with RPGVX, not with the tileset editor, because
the limitation is that RPGVX can load only one tileset at a time, not multiple tilesets.  Once again, RPGVX will not load
the new tileset automatically.


Comments

Please post comments, improvements, or problems in this thread.
 

poccil

Sponsor

As I mentioned, the tilemap editor cannot be run by itself.  That is, opening the files in the download, and then running the editor by itself, will cause errors.  The files in the download, including the folder structure, must be copied to an existing project, and the tileset editor must be run from within that project.  I will update the download to make this more explicit.
 
I think i figured out how it works. This get's around the universal tileset problem.so we can have more than one tileset for VX.
 
Poccil:

That's really, really awesome.

Would you mind explaining in greater detail how to use this?

We'd like to share this on our french forum (with your permission) but we're having a hard time figuring out how it works.
 

poccil

Sponsor

Okay, I will try to explain it better.

This system is designed to support multiple tilesets in a game.  It does so by placing each tileset image file in
the folder Graphics/Tilesets/.  Each map can have its own tileset.  For example, map 1's tileset could have a
certain set for TileA, TileB, etc., and map 2's tileset could have a different set for those same tilesets.

First Steps

First, copy the files in the tileset system's download to your game project's folder, then put the script file named
"TilemapRuntime"  within the Materials section of the project's script editor.

The editing is done in the tileset editor.  When you start the tileset editor, you are presented with two choices:  "Edit tilesets", for creating the tilesets, and "Edit maps' tilesets", for associating the tilesets with each map in the game.

Edit Tilesets

Use the option Edit Tilesets to either create a new tileset, or modify an existing tileset.  A tileset consists of nine files, which have  the same meaning as in RPG Maker VX.  Here is an example of how a tileset could look in the "Edit tilesets" part
of the tileset editor.

TileA1: MyTileA1.png
TileA2: MyTileA2.png
TileA3: Buildings.png
TileA4: Walls.png
TileA5: Floor.png
TileB: MyTileB.png
TileC: MyTileC.png
TileD: MyTileD.png
TileE: MyTileE.png

By default, each file in a new tileset will be equal to the files found in the RGSS2-RTP named "RPGVX".  Put those files
in a new folder, "Graphics/Tilesets/".  This is where all custom tileset files should be placed.

Select a tileset image to change the image used for that part of the tileset.  For example, select TileA1
to change the TileA1 tileset.  You will get a list of all the image files contained in the Graphics/Tilesets/
folder to choose from.

There are two other options here: "Rename" and "Set passages".  Choosing Set passages opens an editor similar
to the "Passage settings" mode in RPGVX.  Here you can change the passability of each tile in the tileset.  In
this editor, press the Z key to move to a different portion of the tileset, and press X to save or cancel the
changes.

The last option is to rename the tileset.  This is rather self-explanatory.

Edit Maps' Tilesets

The other choice found in the main menu is to "edit maps' tilesets", that is to edit the association of a map
with a tileset, as defined according to the steps above.

Here, choose any map, and you will have the option to choose a tileset or to load the tileset in RPGVX.  If you
choose to choose a tileset, a list of all the tilesets available will appear where you can make a selection.

If you choose to load the tileset, you will be notified whether the loading is successful.  If the tileset was
loaded, click on the map's name in the RPGVX editor to see the change and work with the map as usual.  Passage settings cannot be edited here, but only in the tileset editor.  Internally, the process copies the files mentioned in the tileset to the System folder of the project; thus, tileset files located there can be overwritten.  This is why all tileset files should be placed in the "Graphics/Tilesets/" folder.
 
Thank you very much for your explanation (but I’m having trouble with something).

Here, let me show you what I did.

1st:
First of all I put the script into the “Materialâ€
 

poccil

Sponsor

When editing passages, press the Z key to change between the other tilesets (tileset A2, A3, and so on).

Whenever you change to a new map, you must use the Load Tilemap feature to switch to that new map's tileset.  RPGVX will not do that automatically.  Though it may appear in RPGVX as though each map has the same tileset, the reality is that each map will have its own tileset when the game is run.

Please also note that the default tileset files from the RGSS-RTP must be copied to the Tilesets folder as well.  They are not included in the download because adding them would substantially increase the file size.
 
Though it may appear in RPGVX as though each map has the same tileset, the reality is that each map will have its own tileset when the game is run.

But... if the only way to see the actual tile is to run the game, doesn't that make mapping impossible?

Pressing "Z" doesn't change the tileset for me, it just switches the passage from passable to non-passable. 0_o!

Alright well, I spent about 2 hours trying to get this to work, without success. Didn't work for me.

Hopefully it will work for somone else. All there's left to do is wait for a patch.
 

poccil

Sponsor

Pressing "Z" doesn't change the tileset for me, it just switches the passage from passable to non-passable.

The Z key works for me.  I believe the problem is that you must have assigned the "A button" (which is what the game actually checks) to a different key or keys.  In that case, press the key that is associated with the "A button".  In the next version the F5 key will be used instead, to avoid ambiguity.

But... if the only way to see the actual tile is to run the game, doesn't that make mapping impossible?

That is not what I meant.  I meant to describe the behavior of RPGVX.  The fact that each tileset must be loaded from the tileset editor in order for the map to look "correct" is necessary in order to work around the limitation inherent in RPGVX, namely that RPGVX can load only one tileset at a time and not multiple tilesets.  The "load tileset" feature is ultimately meant to aid the mapping process. 

Also, the fact that the tileset was only "partially loaded" is because the editor could not find all the tileset files from the Graphics/Tilesets/ folder.  Note that the tileset you mention also refers to "TileA1.png", "TileA2.png", and so on, all of which are missing from that folder.  I should mention again that the default tileset files from the RGSS-RTP must be copied to the Graphics/Tilesets/ folder as well in order to ensure proper behavior.
 
I did copy the original tilesets and I've tried using the "A Key" but it still doesn't work for me.

I'll wait for your next update.

Thanks for your help anyway, it's really kind of you to share this with the community.
 
I tried this on my project but there's an error on the passability settings.

In your program I tried to make a certain tiles impassable (chainging it to X) but it's not working... but changing it to star it happens to work... any solution how to fix this?
 

poccil

Sponsor

That's because the TilemapRuntime script failed to change the map's passages to those of the tileset.  This is a fixed version of that script:
Code:
module RPG
  class TilesetVX
    attr_accessor :name
    attr_accessor :bitmapNames
    attr_accessor :passages
    attr_accessor :terrainTags
    def initialize(name,bitmapNames,passages)
      @name=name
      @bitmapNames=bitmapNames
      @passages=passages
      @terrainTags=Table.new(0x2000)
    end
  end
end

def loadTileset(name)
  begin
    return Cache.load_bitmap("Graphics/Tilesets/",name)
  rescue RGSSError, Errno::ENOENT
    return Cache.system(name)
  end
end

class Game_Map
  attr_accessor :terrain_tags
  attr_accessor :passages
  def terrain_tag(x,y)
    if @map_id != 0 && @terrain_tags
      for i in [2, 1, 0]
        tile_id = data[x, y, i]
        if tile_id == nil
          return 0
        elsif @terrain_tags[tile_id] && @terrain_tags[tile_id] > 0
          return @terrain_tags[tile_id]
        end
      end
    end
    return 0
  end
end

class Spriteset_Map
  def create_tilemap
    if !$data_map_tilesets
     begin
       $data_map_tilesets=load_data("Data/MapTilesets.rvdata")
     rescue
       $data_map_tilesets=nil
     end
    end
    if !$data_tilesets
     begin
       $data_tilesets=load_data("Data/Tilesets.rvdata")
     rescue
       $data_tilesets=nil
     end
    end
    @tilemap = Tilemap.new(@viewport1)
    tileset=nil
    if $data_map_tilesets && $data_tilesets
      mapset=$data_map_tilesets[$game_map.map_id]
      tileset=$data_tilesets[mapset] if mapset && mapset>0
    end
    if tileset
      @tilemap.bitmaps[0] = loadTileset(tileset.bitmapNames[0])
      @tilemap.bitmaps[1] = loadTileset(tileset.bitmapNames[1])
      @tilemap.bitmaps[2] = loadTileset(tileset.bitmapNames[2])
      @tilemap.bitmaps[3] = loadTileset(tileset.bitmapNames[3])
      @tilemap.bitmaps[4] = loadTileset(tileset.bitmapNames[4])
      @tilemap.bitmaps[5] = loadTileset(tileset.bitmapNames[5])
      @tilemap.bitmaps[6] = loadTileset(tileset.bitmapNames[6])
      @tilemap.bitmaps[7] = loadTileset(tileset.bitmapNames[7])
      @tilemap.bitmaps[8] = loadTileset(tileset.bitmapNames[8])
      $game_map.passages = tileset.passages
      $game_map.passages[0] = 0x10
      $game_map.terrain_tags = tileset.terrainTags
    else
      @tilemap.bitmaps[0] = Cache.system("TileA1")
      @tilemap.bitmaps[1] = Cache.system("TileA2")
      @tilemap.bitmaps[2] = Cache.system("TileA3")
      @tilemap.bitmaps[3] = Cache.system("TileA4")
      @tilemap.bitmaps[4] = Cache.system("TileA5")
      @tilemap.bitmaps[5] = Cache.system("TileB")
      @tilemap.bitmaps[6] = Cache.system("TileC")
      @tilemap.bitmaps[7] = Cache.system("TileD")
      @tilemap.bitmaps[8] = Cache.system("TileE")
      $game_map.terrain_tags = nil
    end
    @tilemap.passages = $game_map.passages
    @tilemap.map_data = $game_map.data
  end
end
 
Hmmm... Maybe there's something in my editor.
Because all my tile from tile A are passable even if it should be passable, but the other tiles worked perfectly.
I created a new project and this errors occurs also...
Maybe I'll have to reinstall it ^_^

Anyway, thanks poccil.
 

poccil

Sponsor

I've uploaded a new version today.  In addition to solving the problem with passages, the tileset editor also includes a way to edit the bush flag, counter flag, and terrain tag of each tile. 

Terrain tags are a feature that's not normally supported in RPG Maker VX, and the TilemapRuntime script now includes a method of Game_Map called "terrain_tag".
 
Hi, I'm having a little trouble with this^^; I did like you said, copied the files into my game's folder, and inserted the script. Now... it works perfect except for the fact that when I have one tilemap loaded, it only shows that tilemap, rather than all of them, when the game is being played. I hope that makes sense...
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top