KTilesetDir VX
#1
KTilesetDir VX

by Kyonides

Introduction

A forumer once asked for a way to use a secondary group of tilesets, and that led me to come up with this scriptlet.
Every single tileset has the same name as the default one, but all of them should be placed in the Graphics/Tilesets directory instead.

The Script

Code:
# * KTilesetDir VX * #
#  Scripter : Kyonides Arkanthes
#  2024-10-26

# This scriptlet allows you to define a custom tileset directory located in the
# Graphics folder.

module KTileset
  TILESET_DIR = "Tilesets"
  # Add as Many Map ID's as deemed necessary, i.e. [1,2,3,4]
  MAP_IDS = []
end

module Cache
  def self.tileset(filename)
    load_bitmap("Graphics/#{KTileset::TILESET_DIR}/", filename)
  end
end

class Spriteset_Map
  alias :kyon_tileset_dirs_sprtst_map_crt_tilemap :create_tilemap
  def create_tilemap
    if KTileset::MAP_IDS.include?($game_map.map_id)
      create_custom_tilemap
    else
      kyon_tileset_dirs_sprtst_map_crt_tilemap
    end
  end

  def create_custom_tilemap
    @tilemap = Tilemap.new(@viewport1)
    @tilemap.bitmaps[0] = Cache.tileset("TileA1")
    @tilemap.bitmaps[1] = Cache.tileset("TileA2")
    @tilemap.bitmaps[2] = Cache.tileset("TileA3")
    @tilemap.bitmaps[3] = Cache.tileset("TileA4")
    @tilemap.bitmaps[4] = Cache.tileset("TileA5")
    @tilemap.bitmaps[5] = Cache.tileset("TileB")
    @tilemap.bitmaps[6] = Cache.tileset("TileC")
    @tilemap.bitmaps[7] = Cache.tileset("TileD")
    @tilemap.bitmaps[8] = Cache.tileset("TileE")
    @tilemap.map_data = $game_map.data
    @tilemap.passages = $game_map.passages
  end
end

Terms & Conditions

Free for use in non commercial games.
Due credit is mandatory!
Mention this forum in your game credits as well.
That's it! Tongue sticking out
"For God has not destined us for wrath, but for obtaining salvation through our Lord Jesus Christ," 1 Thessalonians 5:9

Maranatha!

The Internet might be either your friend or enemy. It just depends on whether or not she has a bad hair day.

[Image: SP1-Scripter.png]
[Image: SP1-Writer.png]
[Image: SP1-Poet.png]
[Image: SP1-PixelArtist.png]
[Image: SP1-Reporter.png]

My Original Stories (available in English and Spanish)

List of Compiled Binary Executables I have published...
HiddenChest & Roole

Give me a free copy of your completed game if you include at least 3 of my scripts! Laughing + Tongue sticking out

Just some scripts I've already published on the board...
KyoGemBoost XP VX & ACE, RandomEnkounters XP, KSkillShop XP, Kolloseum States XP, KEvents XP, KScenario XP & Gosu, KyoPrizeShop XP Mangostan, Kuests XP, KyoDiscounts XP VX, ACE & MV, KChest XP VX & ACE 2016, KTelePort XP, KSkillMax XP & VX & ACE, Gem Roulette XP VX & VX Ace, KRespawnPoint XP, VX & VX Ace, GiveAway XP VX & ACE, Klearance XP VX & ACE, KUnits XP VX, ACE & Gosu 2017, KLevel XP, KRumors XP & ACE, KMonsterPals XP VX & ACE, KStatsRefill XP VX & ACE, KLotto XP VX & ACE, KItemDesc XP & VX, KPocket XP & VX, OpenChest XP VX & ACE
Reply }




Users browsing this thread: 2 Guest(s)