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.

CHANGE MAP TILESET (RM2k feature)

CHANGE MAP TILESET
version 1.1

by Ryethe (not DerVVulfman)
(05-05-2005)


This script restores yet another missing feature in RPG Maker XP relative to RPG Maker 2000 and 2003. This script allows you to change the tileset used by the current map. This is especially useful on maps that use multiple elevations, since you can change the tileset priorities as the player changes elevation. Adding this feature merely requires you to insert this script above main.

To use this script, you call it like so:

Script: $game_map.replace_tileset(3)[/FONT]

Where the "3" indicates that the tileset will be changed to the third tileset in your database.
aka... 003: Forest[/FONT] if you use the RTP.

Code:
class Game_Map
  # ---------------
  attr_accessor :new_tileset

  #--------------------------------------------------------------------------
  # * Setup (Modified for Change Tileset routine)
  #     map_id : map ID
  #--------------------------------------------------------------------------
  alias chgtileset_setup setup
  def setup(map_id)
    @new_tileset = false
     chgtileset_setup(map_id)
  end
  #--------------------------------------------------------------------------
  # * Replace Tileset (New Routine)
  #-------------------------------------------------------------------------- 
  def replace_tileset(new_tiles) # New Method
    tileset = $data_tilesets[new_tiles]
    @tileset_name = tileset.tileset_name
    @autotile_names = tileset.autotile_names
    @panorama_name = tileset.panorama_name
    @panorama_hue = tileset.panorama_hue
    @fog_name = tileset.fog_name
    @fog_hue = tileset.fog_hue
    @fog_opacity = tileset.fog_opacity
    @fog_blend_type = tileset.fog_blend_type
    @fog_zoom = tileset.fog_zoom
    @fog_sx = tileset.fog_sx
    @fog_sy = tileset.fog_sy
    @battleback_name = tileset.battleback_name
    @passages = tileset.passages
    @priorities = tileset.priorities
    @terrain_tags = tileset.terrain_tags
    $game_map.new_tileset = true
  end
end

class Spriteset_Map
  #--------------------------------------------------------------------------
  # * Update
  #-------------------------------------------------------------------------- 
  alias chgtileset_update update
  def update
    if $game_map.new_tileset == true
      @tilemap.tileset = RPG::Cache.tileset($game_map.tileset_name)
      @tilemap.priorities = $game_map.priorities
      for i in 0..6
        autotile_name = $game_map.autotile_names[i]
        @tilemap.autotiles[i] = RPG::Cache.autotile(autotile_name)
      end
      $game_map.new_tileset = false
    end
  chgtileset_update
  end
end
NOTE: The only thing I did was adding Aliases into the script for ease of use.
 
I didn't. It was really posted at RPG Advocate's website a year ago.

You'll find other "absent" features AT http://www.phylomortis.com (though the Defining Encounter Areas script is missing some instructions)

EDIT: Figured out and posted Defining Encounter Areas with deciphered/missing instructions.
 

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