RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.

RMRK.net has nothing to do with Blockchains, Cryptocurrency or NFTs. We have been around since the early 2000s, but there is a new group using the RMRK name that deals with those things. We have nothing to do with them.
NFTs are a scam, and if somebody is trying to persuade you to buy or invest in crypto/blockchain/NFT content, please turn them down and save your money. See this video for more information.
Auto-Tiles VX

0 Members and 1 Guest are viewing this topic.

****
Rep:
Level 69
If I were to use a another set of autotiles, how would I use them w/o overriding the old ones? Like use multiple sets for my game?

*
my name is Timothy what's yours
Rep:
Level 79
Hello
2014 Best IRC Quote2014 Zero to Hero2014 Most Missed Member2012 Zero To HeroSecret Santa 2012 ParticipantContestant - GIAW 9For frequently finding and reporting spam and spam bots2011 Zero to Hero
Code: [Select]
=begin
                    Swap Tileset with new passage setting

Version: 0.4
Author: BulletXt (bulletxt@gmail.com)
Date: 13/06/2009

This scripts makes you:

a) Swap a tileset at any time
b) you can swap all tilesets or n tilesets
c) you can load a new passage setting any time you want

How it works:
Create a folder named "extra_tiles" inside Graphics/System. Place your new
tilesets there. They can be named as you like. Before doing a map transfer,
do a simple callscript inside the event like this:
$tileA1 = "fileName"

Replace "fileName" with the tileset you want to change. In that example,
it will swap tile set A1. You can swap all tilesets or just some of them.
For example you can swap TileA1, TileA4 and TileE doing as said above:
$tileA1 = "fileName"
$tileA4 = "fileName"
$tileE = "fileName"


Immediately after the script call/s inside event,
turn the SWAP_TILE switch ON (this can be set below). To reset default
tileset, before a map transfer simply turn the switch to OFF.


This said, you can also load a new passage setting.
Simply open a new project, set the passagesettings as you want, save and close.
Get into Data folder and copy System.rvdata to your real project. Paste it always
inside "extra_tiles" and rename it to anything you want. Be sure file extension
ends with ".rvdata" .
Example: System.rvdata is renamed to:  pub.rvdata

Passage setting gets loaded exactly like tilesets, this means that first you
do the script call inside event and then you turn the
LOAD_PASSAGE_SETTING switch ON(this can be set below). You can
load a new passage setting without swapping any tiles. The 2 things are totally
indipendent.
The script call to load a passage setting is like this:
$swap_passages = "filePassage"
Replace filePassage with the passage setting file you want to load.


By simply turning both switches to OFF,
you automatically reset passage setting to default one and reset all
tilesets to default.
If instead you want to do a map transfer and keep your swapped tilesets
but want to reset only TileA3,simply do a script call of this type:
$tileA3 = nil
Same behaviour is for passage setting, simply set:
$swap_passages = nil
and that will reset passage setting to default.


Tricks:

- you can create a special effect as seen in the demo.
  For example, you can make a tile swap without
  doing a map transfer. You can for instance make a wall change real time its
  tile! To do this, do the normal call for swapping (callscript + switch ON),
  then immediatley after do this callscript: $game_map.tileset
  This callscript will reload the map (screen freezes for 30 milliseconds) so
  the final effect is that the wall has magically a new tile!
  Same thing is for passagesetting, you can load a new passage setting in real
  time by simply doing (callscript + switch ON) and then $game_map.tileset.

=end


############################# CONFIGURATION ####################################

# This is a switch ID, if ON it calls the swapping system. This is
# used for swapping/resetting tile sets. THIS DOES NOT CHANGE PASSAGE SETTINGS.
# Be sure to turn the switch ON only after doing the callscript (as said above).
SWAP_TILE = 84

# This is a switch ID, if ON it calls the passage setting system. This is
# used for loading/resetting new passage settings.
# THIS DOES NOT SWAP TILE SETS.
# Be sure to turn the switch ON only after doing the callscript (as said above).
LOAD_PASSAGE_SETTING = 85


########################## END CONFIGURATION ###################################


#==============================================================================
# ** Cache

module Cache_Swap_Tiles
 
  #--------------------------------------------------------------------------
  # * Get Character Graphic
  #     filename : Filename
  #--------------------------------------------------------------------------
  def self.swap(filename)
    load_bitmap("Graphics/System/extra_tiles/", filename)
  end
 
  #--------------------------------------------------------------------------
  # * Clear Cache
  #--------------------------------------------------------------------------
  def self.clear
    @cache = {} if @cache == nil
    @cache.clear
    GC.start
  end
  #--------------------------------------------------------------------------
  # * Load Bitmap
  #--------------------------------------------------------------------------
  def self.load_bitmap(folder_name, filename, hue = 0)
    @cache = {} if @cache == nil
    path = folder_name + filename
    if not @cache.include?(path) or @cache[path].disposed?
      if filename.empty?
        @cache[path] = Bitmap.new(32, 32)
      else
        @cache[path] = Bitmap.new(path)
      end
    end
    if hue == 0
      return @cache[path]
    else
      key = [path, hue]
      if not @cache.include?(key) or @cache[key].disposed?
        @cache[key] = @cache[path].clone
        @cache[key].hue_change(hue)
      end
      return @cache[key]
    end
  end
end

#initialize global variables
$tileA1 = nil
$tileA2 = nil
$tileA3 = nil
$tileA4 = nil
$tileA5 = nil
$tileB = nil
$tileC = nil
$tileD = nil
$tileE = nil
$swap_passages = nil
################################################################################
class Game_Map
include Cache_Swap_Tiles 
  alias bulletxt_goodbye_vx_limit_tile_setup setup
  def setup(map_id)
    #if false, normal vx behavior and exit
    if $game_switches[LOAD_PASSAGE_SETTING] == false
    bulletxt_goodbye_vx_limit_tile_setup(map_id)
    $swap_passages = nil
    return 
    end
   
 
    path = "Graphics/System/extra_tiles/" + $swap_passages.to_s() + ".rvdata" rescue nil

   if $swap_passages != nil

     @map_id = map_id
     @map = load_data(sprintf("Data/Map%03d.rvdata", @map_id))
     @display_x = 0
     @display_y = 0
     
     
      # load system settings from that file
      new_system_rvdata = load_data(path)
      # Use passage settings from that file
      @passages = new_system_rvdata.passages
     
      #default vx code
      referesh_vehicles
      setup_events
      setup_scroll
      setup_parallax
      @need_refresh = false
     
    else
    bulletxt_goodbye_vx_limit_tile_setup(map_id) 
    end
   
  end
 
  #if here, player has done a $game_map.tileset call. It must reload
  #map with new passage setting (if it exists) and upate map.
  def tileset
    #if false, we must update and load default passage
    if $game_switches[LOAD_PASSAGE_SETTING] == false
    @passages = $data_system.passages
    else
   
    #if nil, must reset passage setting to default 
    if $swap_passages == nil
    @passages = $data_system.passages
    $scene = Scene_Map.new
    return
    end
     
     
path = "Graphics/System/extra_tiles/" + $swap_passages + ".rvdata" rescue nil
   
    # load system settings from that file
    new_system_rvdata = load_data(path)
    # Use passage settings from that file
    @passages = new_system_rvdata.passages
   
     
   end   
   #this updates the map tiles. it does not modify events or anything else.
   $scene = Scene_Map.new
  end
 
 
 
end



class Spriteset_Map
include Cache_Swap_Tiles 
  alias bulletxt_lodestone_create_tilemap create_tilemap
  def create_tilemap
    if $game_switches[SWAP_TILE] == false
     bulletxt_lodestone_create_tilemap
     $tileA1 = nil
     $tileA2 = nil
     $tileA3 = nil
     $tileA4 = nil
     $tileA5 = nil
     $tileB = nil
     $tileC = nil
     $tileD = nil
     $tileE = nil
    else
bulletxt_lodestone_create_tilemap
path_to_graphic = "extra_tiles/"

#tileA1   
tile1 = Cache_Swap_Tiles.swap($tileA1 + ".png") rescue nil
@tilemap.bitmaps[0] = tile1 if $tileA1 != nil#if FileTest.exist?(path_to_graphic + $tileA1.to_s() + ".png")
#tileA2
tile2 = Cache_Swap_Tiles.swap($tileA2 + ".png") rescue nil
@tilemap.bitmaps[1] = tile2 if $tileA2 != nil#if FileTest.exist?(path_to_graphic + $tileA2.to_s() + ".png")
#tileA3
tile3 = Cache_Swap_Tiles.swap($tileA3 + ".png") rescue nil
@tilemap.bitmaps[2] = tile3 if $tileA3 != nil#if FileTest.exist?(path_to_graphic + $tileA3.to_s() + ".png")
#tileA4
tile4 = Cache_Swap_Tiles.swap($tileA4 + ".png") rescue nil
@tilemap.bitmaps[3] = tile4 if $tileA4 != nil#if FileTest.exist?(path_to_graphic + $tileA4.to_s() + ".png")
#tileA5
tile5 = Cache_Swap_Tiles.swap($tileA5 + ".png") rescue nil
@tilemap.bitmaps[4] = tile5 if $tileA5 != nil#if FileTest.exist?(path_to_graphic + $tileA5.to_s() + ".png")
#tileB
tile6 = Cache_Swap_Tiles.swap($tileB + ".png") rescue nil
@tilemap.bitmaps[5] = tile6 if $tileB != nil#if FileTest.exist?(path_to_graphic + $tileB.to_s() + ".png")
#tileC
tile7 = Cache_Swap_Tiles.swap($tileC + ".png") rescue nil
@tilemap.bitmaps[6] = tile7 if $tileC != nil#if FileTest.exist?(path_to_graphic + $tileC.to_s() + ".png")
#tileD
tile8 = Cache_Swap_Tiles.swap($tileD + ".png") rescue nil
@tilemap.bitmaps[7] = tile8 if $tileD != nil#if FileTest.exist?(path_to_graphic + $tileD.to_s() + ".png")
#tileE
tile9 = Cache_Swap_Tiles.swap($tileE + ".png") rescue nil
@tilemap.bitmaps[8] = tile9 if $tileE != nil#if FileTest.exist?(path_to_graphic + $tileE.to_s() + ".png")   

   
    end

  end

end



class Scene_File < Scene_Base
  alias bulletxt_swap_tiles_write_save_data write_save_data
  def write_save_data(file)
    bulletxt_swap_tiles_write_save_data(file)
    Marshal.dump($tileA1,      file)
    Marshal.dump($tileA2,      file)
    Marshal.dump($tileA3,      file)
    Marshal.dump($tileA4,      file)
    Marshal.dump($tileA5,      file)
    Marshal.dump($tileB,      file)
    Marshal.dump($tileC,      file)
    Marshal.dump($tileD,      file)
    Marshal.dump($tileE,      file)
    Marshal.dump($swap_passages.to_s(),   file)
  end 
 
 
  alias bulletxt_swap_tiles_read_save_data read_save_data
  def read_save_data(file)
    bulletxt_swap_tiles_read_save_data(file)
    $tileA1        = Marshal.load(file)
    $tileA2        = Marshal.load(file)
    $tileA3        = Marshal.load(file)
    $tileA4        = Marshal.load(file)
    $tileA5        = Marshal.load(file)
    $tileB        = Marshal.load(file)
    $tileC        = Marshal.load(file)
    $tileD        = Marshal.load(file)
    $tileE        = Marshal.load(file)
    $swap_passages = Marshal.load(file)
  end
 
 
 
  end
Credit BulletXt.
it's like a metaphor or something i don't know

****
Rep:
Level 69
where's the demo for that one? I put in the fil then put in the images, set the switches on and put in the run event and its not working :P

****
Rep:
Level 69
nvm found it