Lua RPG Maker
Gostaria de reagir a esta mensagem? Crie uma conta em poucos cliques ou inicie sessão para continuar.

TilesetExtension

2 participantes

Ir para baixo

TilesetExtension Empty TilesetExtension

Mensagem por IDmaluco Qua Ago 11, 2010 12:07 pm

Pessoal , to com uma dúvida aki .'-'
Eu ia usar aquela script dos tilesets, acho q o nome é Swap Tiliset Editor.
Mas ai procurando na NET achei isso :

Código:
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_
#_/    ◆            Tileset Expansion - KGC_TilesetExtension            ◆ VX ◆
#_/    ◇                    Last Update: 2008/07/13                          ◇
#_/    ◆                Translation by Mr. Anonymous                        ◆
#_/-----------------------------------------------------------------------------
#_/  This script restores some functionanlity pertaining to tilesets that were
#_/  originally included in previous RPG Makers.
#_/
#_/                        ★ Restored Functions ★
#_/  1. Tilesets may be changed to different tileset files.
#_/  2. 4-way Directional Passability
#_/  3. Terrain tags. (Up to 99!)
#_/
#_/  Note: When the tileset is changed, it DOES NOT appear within the editor.
#_/        You may want to open the image in an external viewer for reference.
#_/-----------------------------------------------------------------------------
#_/                      ◆ 2008/07/13 UPDATE [KGC] ◆
#_/              Bugfix relating to loading extra tilesets.
#_/-----------------------------------------------------------------------------
#_/                      ◆ 2008/05/29 UPDATE [MRA] ◆
#_/  Added a method to designate a variable within the customization block of
#_/    this script that stores the terrain tag the player is currently standing
#_/    on. This should help a small bit with lag caused by parallel processes.
#_/=============================================================================
#_/                        ◆ Instructions For Usage ◆
#_/ To set up the 4-way directional passability properties and the terrain tag
#_/  features on a given tile, use the VXTilesetTool located in the Tileset Tool
#_/  folder of this project.
#_/ 
#_/  The following tags are to be entered after a map's name.
#_/  [SET "PresetName"]
#_/    Refer to the customization block to understand this feature.
#_/ 
#_/  [INHERIT]
#_/    Uses the same tileset settings as the parent map.
#_/ 
#_/                          ◆ Script Commands ◆
#_/  These commands are used in the "Script" function in the third page of event
#_/  commands under "Advanced". These commands are all terrain-related.
#_/ 
#_/  * get_terrain_tag(x, y, variable_id)
#_/      Obtains the terrain tag at the specified x/y coordinates and stores it
#_/      in the designated variable.
#_/ 
#_/  * get_event_terrain_tag(event_id, variable_id)
#_/      Obtains the terrain tag where a specified event is located and stores
#_/      it in the designated variable.
#_/ 
#_/  * get_player_terrain_tag(variable_id)
#_/      Obtains the terrain tag where a player is currently located and it in
#_/      the designated variable.
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_

#==============================================================================#
#                            ★ Customization ★                                #
#==============================================================================#


module KGC
 module TilesetExtension
  #                    ◆ Required Text String Prefix ◆
  #  This is the text string the script searches for in regards to tilesets in
  #  your "Graphics\System" folder.
  TILE_IMAGE_PREFIX = "Tile"
 
  #                    ◆ Player Terrain Tag Variable ◆
  #  The current terrain tag that the player is standing on is stored here.
  PLAYER_TERRAIN_TAG = 1

  #                      ◆ Tileset Image Preset ◆
  TILE_PRESET = {}  # ← Do not remove or alter this!
  # The custom tilesets are defined below.
  #  In this example, the script would search for images in the system folder
  #    labeled XN-Castle, and appoints the appropriate tile category by name.
  #    Where X = Tile Category(A,B,C,D,E) Where N = Sub autotile Number
  # Also of note that the text that appears after TILE_PRESET in the brackets []
  #  is what designates your preset Tile groupings.
  #  So all the tilesets defined after ["Castle"] in the example are bound to
  #  the "Castle" tag.
  #
  #      TILE_PRESET["Castle"] = {
  #        "A1"=>"A1-Castle",
  #        "A2"=>"A2-Castle",
  #        "B"=>"B-Castle",
  #        "D"=>"D-Castle",
  #      }
  #
  # By entering [SET Castle] to the end of a map's name (in Map Properties), the
  #  map would use the tiles defined in the above expression for that particular
  #  map instead of the default tiles A1, A2, B, and D.

  #                  ◆ Insert Custom Tileset Presets Below ◆
  # Note: The following is used as a sample for the Black and White Forest
  # section of the KGC library demo. Please alter this to your needs.
    TILE_PRESET["BW"] = {
      "A1"=>"A1-BW",
      "A2"=>"A2-BW",
      "A3"=>"A3-BW",
      "A4"=>"A4-BW",
      "A5"=>"A5-BW",
      "B"=>"B-BW",
      "C"=>"C-BW",
      "D"=>"D-BW",
    }
 
 
  #                  ◆ Insert Custom Tileset Presets Above ◆ 
 
  #            ◆ Four-way Direction Passage and Terrain Tag Button ◆
  #  (For debugging only, available in playtesting mode)
  #  To indicate the four-way directional passage setting of the current tile,
  #  you'd press this key (F7 by default).
  #  The terrain features tag is displayed in a popup dialog box.
  #  This function becomes invalid when setting it to nil.
  DEBUG_INFO_BUTTON = Input::F7
 end
end

#------------------------------------------------------------------------------#

# * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * #
#  Unless you know what you're doing, it's best not to alter anything beyond  #
#  this point, as this only affects the tags used for the Map name and how    #
#  the script sets up the extra Tile sets.                                    #
# * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * #

$imported = {} if $imported == nil
$imported["TilesetExtension"] = true

if $data_mapinfos == nil
  $data_mapinfos = load_data("Data/MapInfos.rvdata")
end

  # Direction Flag Module(for four-way directional passability)
module DirectionFlag
  DOWN  = 0x01
  LEFT  = 0x02
  RIGHT = 0x04
  UP    = 0x08
end

module KGC::TilesetExtension
  # File name of extended tile set data.
  EX_RVDATA = "TilesetEx.rvdata"

  # Regular Expressions Defined
  module Regexp
    # Inherit tag string
    INHERIT = /\[INHERIT\]/i
    # Preset tag string
    PRESET = /\[SET ([\w\-]+)\]/i
  end

  # Default tile set file names
  #  "File Suffix"=>"Full Filename"
  DEFAULT_FILENAME = {
    "A1"=>"TileA1", # This is the first and second rows of autotiles
    "A2"=>"TileA2", # This is the 3rd-6th rows of autotiles
    "A3"=>"TileA3", # This is the 7th-10th rows of autotiles
    "A4"=>"TileA4", # This is the 11th-16th of the autotiles.
    "A5"=>"TileA5", # This is the rest of the TileA tiles.
    "B"=>"TileB",  # TileB tiles.
    "C"=>"TileC",  # TileC tiles.
    "D"=>"TileD",  # TileD tiles.
    "E"=>"TileE"    # TileE tiles.
  }
  @@__filename = DEFAULT_FILENAME.dup

  module_function
  #--------------------------------------------------------------------------
  # ○ Initialize Tileset Filename
  #    map_id : Map ID
  #--------------------------------------------------------------------------
  def init_tileset_filename(map_id)
    @@__filename = get_converted_tileset_filename(map_id)
  end
  #--------------------------------------------------------------------------
  # ○ Get Convertered Tileset Filename
  #    map_id : Map ID
  #--------------------------------------------------------------------------
  def get_converted_tileset_filename(map_id)
    info = $data_mapinfos[map_id]
    name = info.original_name
    filename = DEFAULT_FILENAME.dup
    if name =~ Regexp::INHERIT
      # Retrieve parent map ID
      parent_id = $data_mapinfos[map_id].parent_id
      if parent_id > 0
        filename = get_converted_tileset_filename(parent_id)
      end
    end
    # Jump to Convert Tileset Filename method
    return convert_tileset_filename(filename, name)
  end
  #--------------------------------------------------------------------------
  # ○ Convert Tileset Filename
  #    filename : Image Filename (Hash)
  #    map_name : Map Name
  #--------------------------------------------------------------------------
  def convert_tileset_filename(filename, map_name)
    name_buf = filename.dup
    # Determine Preset
    presets = map_name.scan(Regexp::PRESET)
    presets.each { |s|
      if TILE_PRESET.has_key?(s[0])
        TILE_PRESET[s[0]].each { |k, v|
          name_buf[k] = TILE_IMAGE_PREFIX + v
        }
      end
    }
    # Convert Map Name
    DEFAULT_FILENAME.keys.each { |key|
      if map_name =~ /\[#{key} ([\w\-]+)\]/
        name_buf[key] = TILE_IMAGE_PREFIX + $1
      end
    }
    return name_buf
  end
  #--------------------------------------------------------------------------
  # ○ Get Tileset Filename
  #--------------------------------------------------------------------------
  def get_tileset_filename
    return @@__filename
  end
end

#==============================================================================
# □ KGC::Commands
#==============================================================================

module KGC::Commands
  module_function
  #--------------------------------------------------------------------------
  # ○ Get Terrain Tag
  #    x : X Coordinate of Map
  #    y : Y Coordinate of Map
  #    variable_id : In-Game Variable ID
  #--------------------------------------------------------------------------
  def get_terrain_tag(x, y, variable_id = 0)
    tag = $game_map.terrain_tag(x, y)      # Assign the X/Y coordinate
    if variable_id > 0
      $game_variables[variable_id] = tag    # Assign the tag to the variable
    end
    return tag
  end
  #--------------------------------------------------------------------------
  # ○ Get Event Terrain tag
  #    event_id : Event ID
  #    variable_id : In-Game Variable ID
  #--------------------------------------------------------------------------
  def get_event_terrain_tag(event_id, variable_id = 0)
    event = $game_map.events.values.find { |e| e.id == event_id }
    if event == nil
    # If there is no event, the value is set to 0.
      tag = 0
    else
      tag = $game_map.terrain_tag(event.x, event.y)
    end

    # If the variable is assigned, the tag is stored there.
    if variable_id > 0
      $game_variables[variable_id] = tag
    end
    return tag
  end
  #--------------------------------------------------------------------------
  # ○ Get Player Terrain Tag
  #    variable_id : In-Game Variable ID
  #--------------------------------------------------------------------------
  def get_player_terrain_tag(variable_id = 0)
    tag = $game_map.terrain_tag($game_player.x, $game_player.y)

    # If the variable is assigned, the tag is stored there.
    if variable_id > 0
      $game_variables[variable_id] = tag
    end
    return tag
  end
end

class Game_Interpreter
  include KGC::Commands
end

#==============================================================================
# ■ RPG::MapInfo
#==============================================================================

class RPG::MapInfo
  #--------------------------------------------------------------------------
  # ● Map Name
  #--------------------------------------------------------------------------
  def name
    return @name.gsub(/\[.*\]/) { "" }
  end
  #--------------------------------------------------------------------------
  # ○ Original Map Name
  #--------------------------------------------------------------------------
  def original_name
    return @name
  end
end

#==============================================================================
# □ RPG::Tileset
#------------------------------------------------------------------------------
#  Define new properties to the Tileset class
#==============================================================================

class RPG::Tileset
  #-------------------------------------------------------------------------- 
  # ○ Table Size
  #--------------------------------------------------------------------------
  TABLE_SIZE = 8192                      # 通行・地形タグテーブルのサイズ
  #--------------------------------------------------------------------------
  # ○ Public Instance Variables
  #--------------------------------------------------------------------------
  attr_accessor :version                  # Map Version
  attr_accessor :passages                # 4-Way Directional Passages
  attr_accessor :terrain_tags            # Terrain Tags
  #--------------------------------------------------------------------------
  # ○ Initialize
  #--------------------------------------------------------------------------
  def initialize
    @version = 1
    @passages = Table.new(TABLE_SIZE)
    @terrain_tags = Table.new(TABLE_SIZE)
  end
end

#==============================================================================
# ■ Game_Map
#==============================================================================

class Game_Map
  LAYERS = [2, 1, 0]
  #--------------------------------------------------------------------------
  # ● Setup
  #    map_id : Map ID
  #--------------------------------------------------------------------------
  alias setup_KGC_TilesetExtension setup
  def setup(map_id)
    @map_id = map_id
    init_tileset_filename

    setup_KGC_TilesetExtension(map_id)
  end
  #--------------------------------------------------------------------------
  # ○ Initialize Tileset Filename
  #--------------------------------------------------------------------------
  def init_tileset_filename
    KGC::TilesetExtension.init_tileset_filename(@map_id)
  end
  #--------------------------------------------------------------------------
  # ○ Define Passage
  #    x : X Position
  #    y : Y Position
  #--------------------------------------------------------------------------
  def passage(x, y)
    LAYERS.each { |i|
      tile_id = @map.data[x, y, i]
      return 0 if tile_id == nil
      return $data_tileset.passages[tile_id]
    }
    return 0
  end
  #--------------------------------------------------------------------------
  # ○ Define Terrain Tag
  #    x : X Position
  #    y : Y Position
  #--------------------------------------------------------------------------
  def terrain_tag(x, y)
    LAYERS.each { |i|
      tile_id = @map.data[x, y, i]              # タイル ID を取得
      return 0 if tile_id == nil                # タイル ID 取得失敗 : タグなし
      tag = $data_tileset.terrain_tags[tile_id]  # 地形タグを取得
      return tag if tag > 0                      # タグが設定してあれば返す
    }
    return 0
  end
  #--------------------------------------------------------------------------
  # ○ Define Passable Direction Flag
  #    x : X Position
  #    y : Y Position
  #    d : Direction
  #--------------------------------------------------------------------------
  def passable_dir?(x, y, d)
    # 方向 (0,2,4,6,8,10) から 通行フラグ (0,1,2,4,8,0) に変換
    flag = (1 << (d / 2 - 1)) & 0x0F

    LAYERS.each { |i|                        # レイヤーの上から順に調べる
      tile_id = @map.data[x, y, i]            # タイル ID を取得
      return false if tile_id == nil          # タイル ID 取得失敗 : 通行不可
      pass = $data_tileset.passages[tile_id]  # タイルセットの通行属性を取得
      return false if pass & flag != 0x00    # フラグが立っていたら通行不可
    }
    return true
  end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# ■ Game_Character
#==============================================================================

class Game_Character
  #--------------------------------------------------------------------------
  # ○ 通行可能判定
  #    x : X 座標
  #    y : Y 座標
  #    d : 移動方向 (省略時: 10)
  #--------------------------------------------------------------------------
  def passable?(x, y, d = 10)
    nx = moved_x(x, d)
    ny = moved_y(y, d)
    nx = $game_map.round_x(nx)                        # 横方向ループ補正
    ny = $game_map.round_y(ny)                        # 縦方向ループ補正
    return false unless $game_map.valid?(nx, ny)      # マップ外?
    return true if @through or debug_through?          # すり抜け ON?
    return false unless map_passable?(x, y, d)        # 指定方向に移動不能?
    return false unless map_passable?(nx, ny, 10 - d)  # 移動先が進入不能?
    return false if collide_with_characters?(nx, ny)  # キャラクターに衝突?
    return true                                        # 通行可
  end
  #--------------------------------------------------------------------------
  # ○ 移動後の X 座標算出
  #    x : X 座標
  #    d : 移動方向
  #    移動後の X 座標を計算する。
  #--------------------------------------------------------------------------
  def moved_x(x, d)
    return x + (d == 6 ? 1 : d == 4 ? -1 : 0)
  end
  #--------------------------------------------------------------------------
  # ○ 移動後の Y 座標算出
  #    y : Y 座標
  #    d : 移動方向
  #    移動後の Y 座標を計算する。
  #--------------------------------------------------------------------------
  def moved_y(y, d)
    return y + (d == 2 ? 1 : d == 8 ? -1 : 0)
  end
  #--------------------------------------------------------------------------
  # ○ マップ通行可能判定
  #    x : X 座標
  #    y : Y 座標
  #    d : 移動方向
  #    指定座標の指定した方向が通行可能かを取得する。
  #--------------------------------------------------------------------------
  def map_passable?(x, y, d)
    return $game_map.passable?(x, y) && $game_map.passable_dir?(x, y, d)
  end
  #--------------------------------------------------------------------------
  # ● 下に移動
  #    turn_ok : その場での向き変更を許可
  #--------------------------------------------------------------------------
  def move_down(turn_ok = true)
    if passable?(@x, @y, 2)                # 通行可能
      turn_down
      @y = $game_map.round_y(@y+1)
      @real_y = (@y-1)*256
      increase_steps
      @move_failed = false
      #------------------------------------------------------------------
      # ○ Check Player's Terrain Tag
      #    * Added by Mr. Anonymous 5/29/2008
      #------------------------------------------------------------------ 
        tag = $game_map.terrain_tag($game_player.x, $game_player.y)
        $game_variables[KGC::TilesetExtension::PLAYER_TERRAIN_TAG] = tag
        return tag
    else                                    # 通行不可能
      turn_down if turn_ok
      check_event_trigger_touch(@x, @y+1)  # 接触イベントの起動判定
      @move_failed = true
    end
  end
  #--------------------------------------------------------------------------
  # ● 左に移動
  #    turn_ok : その場での向き変更を許可
  #--------------------------------------------------------------------------
  def move_left(turn_ok = true)
    if passable?(@x, @y, 4)                # 通行可能
      turn_left
      @x = $game_map.round_x(@x-1)
      @real_x = (@x+1)*256
      increase_steps
      @move_failed = false
      #------------------------------------------------------------------
      # ○ Check Player's Terrain Tag
      #    * Added by Mr. Anonymous 5/29/2008
      #------------------------------------------------------------------ 
        tag = $game_map.terrain_tag($game_player.x, $game_player.y)
        $game_variables[KGC::TilesetExtension::PLAYER_TERRAIN_TAG] = tag
        return tag
    else                                    # 通行不可能
      turn_left if turn_ok
      check_event_trigger_touch(@x-1, @y)  # 接触イベントの起動判定
      @move_failed = true
    end
  end
  #--------------------------------------------------------------------------
  # ● 右に移動
  #    turn_ok : その場での向き変更を許可
  #--------------------------------------------------------------------------
  def move_right(turn_ok = true)
    if passable?(@x, @y, 6)                # 通行可能
      turn_right
      @x = $game_map.round_x(@x+1)
      @real_x = (@x-1)*256
      increase_steps
      @move_failed = false
      #------------------------------------------------------------------
      # ○ Check Player's Terrain Tag
      #    * Added by Mr. Anonymous 5/29/2008
      #------------------------------------------------------------------ 
        tag = $game_map.terrain_tag($game_player.x, $game_player.y)
        $game_variables[KGC::TilesetExtension::PLAYER_TERRAIN_TAG] = tag
        return tag
    else                                    # 通行不可能
      turn_right if turn_ok
      check_event_trigger_touch(@x+1, @y)  # 接触イベントの起動判定
      @move_failed = true
    end
  end
  #--------------------------------------------------------------------------
  # ● 上に移動
  #    turn_ok : その場での向き変更を許可
  #--------------------------------------------------------------------------
  def move_up(turn_ok = true)
    if passable?(@x, @y, 8)                # 通行可能
      turn_up
      @y = $game_map.round_y(@y-1)
      @real_y = (@y+1)*256
      increase_steps
      @move_failed = false
      #------------------------------------------------------------------
      # ○ Check Player's Terrain Tag
      #    * Added by Mr. Anonymous 5/29/2008
      #------------------------------------------------------------------ 
        tag = $game_map.terrain_tag($game_player.x, $game_player.y)
        $game_variables[KGC::TilesetExtension::PLAYER_TERRAIN_TAG] = tag
        return tag
    else                                    # 通行不可能
      turn_up if turn_ok
      check_event_trigger_touch(@x, @y-1)  # 接触イベントの起動判定
      @move_failed = true
    end
  end
  #--------------------------------------------------------------------------
  # ● 左下に移動
  #--------------------------------------------------------------------------
  def move_lower_left
    unless @direction_fix
      @direction = (@direction == 6 ? 4 : @direction == 8 ? 2 : @direction)
    end
    if (passable?(@x, @y, 2) && passable?(@x, @y+1, 4)) ||
      (passable?(@x, @y, 4) && passable?(@x-1, @y, 2))
      @x -= 1
      @y += 1
      increase_steps
      @move_failed = false
      #------------------------------------------------------------------
      # ○ Check Player's Terrain Tag
      #    * Added by Mr. Anonymous 5/29/2008
      #------------------------------------------------------------------ 
        tag = $game_map.terrain_tag($game_player.x, $game_player.y)
        $game_variables[KGC::TilesetExtension::PLAYER_TERRAIN_TAG] = tag
        return tag
    else
      @move_failed = true
    end
  end
  #--------------------------------------------------------------------------
  # ● 右下に移動
  #--------------------------------------------------------------------------
  def move_lower_right
    unless @direction_fix
      @direction = (@direction == 4 ? 6 : @direction == 8 ? 2 : @direction)
    end
    if (passable?(@x, @y, 2) && passable?(@x, @y+1, 6)) ||
      (passable?(@x, @y, 6) && passable?(@x+1, @y, 2))
      @x += 1
      @y += 1
      increase_steps
      @move_failed = false
      #------------------------------------------------------------------
      # ○ Check Player's Terrain Tag
      #    * Added by Mr. Anonymous 5/29/2008
      #------------------------------------------------------------------ 
        tag = $game_map.terrain_tag($game_player.x, $game_player.y)
        $game_variables[KGC::TilesetExtension::PLAYER_TERRAIN_TAG] = tag
        return tag
    else
      @move_failed = true
    end
  end
  #--------------------------------------------------------------------------
  # ● 左上に移動
  #--------------------------------------------------------------------------
  def move_upper_left
    unless @direction_fix
      @direction = (@direction == 6 ? 4 : @direction == 2 ? 8 : @direction)
    end
    if (passable?(@x, @y, 8) && passable?(@x, @y-1, 4)) ||
      (passable?(@x, @y, 4) && passable?(@x-1, @y, 8))
      @x -= 1
      @y -= 1
      increase_steps
      @move_failed = false
      #------------------------------------------------------------------
      # ○ Check Player's Terrain Tag
      #    * Added by Mr. Anonymous 5/29/2008
      #------------------------------------------------------------------ 
        tag = $game_map.terrain_tag($game_player.x, $game_player.y)
        $game_variables[KGC::TilesetExtension::PLAYER_TERRAIN_TAG] = tag
        return tag
    else
      @move_failed = true
    end
  end
  #--------------------------------------------------------------------------
  # ● 右上に移動
  #--------------------------------------------------------------------------
  def move_upper_right
    unless @direction_fix
      @direction = (@direction == 4 ? 6 : @direction == 2 ? 8 : @direction)
    end
    if (passable?(@x, @y, 8) && passable?(@x, @y-1, 6)) ||
      (passable?(@x, @y, 6) && passable?(@x+1, @y, 8))
      @x += 1
      @y -= 1
      increase_steps
      @move_failed = false
      #------------------------------------------------------------------
      # ○ Check Player's Terrain Tag
      #    * Added by Mr. Anonymous 5/29/2008
      #------------------------------------------------------------------ 
        tag = $game_map.terrain_tag($game_player.x, $game_player.y)
        $game_variables[KGC::TilesetExtension::PLAYER_TERRAIN_TAG] = tag
        return tag
    else
      @move_failed = true
    end
  end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# ■ Game_Player
#==============================================================================

class Game_Player < Game_Character
  #--------------------------------------------------------------------------
  # ○ マップ通行可能判定
  #    x : X 座標
  #    y : Y 座標
  #    d : 移動方向
  #    指定座標の指定した方向が通行可能かを取得する。
  #--------------------------------------------------------------------------
  alias map_passable_KGC_TilesetExtension? map_passable?
  def map_passable?(x, y, d)
    return false unless map_passable_KGC_TilesetExtension?(x, y)

    return $game_map.passable_dir?(x, y, d)
  end

  if $TEST && KGC::TilesetExtension::DEBUG_INFO_BUTTON != nil
  #--------------------------------------------------------------------------
  # ● フレーム更新
  #--------------------------------------------------------------------------
  alias update_KGC_TilesetExtension update
  def update
    update_KGC_TilesetExtension

    if Input.trigger?(KGC::TilesetExtension::DEBUG_INFO_BUTTON)
      show_passage_and_terrain_tag
    end
  end
  #--------------------------------------------------------------------------
  # ○ プレイヤー位置の通行フラグ・地形タグを表示
  #--------------------------------------------------------------------------
  def show_passage_and_terrain_tag
    passage = $game_map.passage(x, y)
    tag = $game_map.terrain_tag(x, y)

    # デバッグ情報作成
    s = "通行可能: "
    s += "↓" if passage & DirectionFlag::DOWN  == 0x00
    s += "←" if passage & DirectionFlag::LEFT  == 0x00
    s += "→" if passage & DirectionFlag::RIGHT == 0x00
    s += "↑" if passage & DirectionFlag::UP    == 0x00
    s += "  地形タグ: #{tag}"

    p s
  end
  end

end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# ■ Sprite_Character
#==============================================================================

class Sprite_Character < Sprite_Base
  #--------------------------------------------------------------------------
  # ● 指定されたタイルが含まれるタイルセット画像の取得
  #    tile_id : タイル ID
  #--------------------------------------------------------------------------
  def tileset_bitmap(tile_id)
    filename = KGC::TilesetExtension.get_tileset_filename
    set_number = tile_id / 256
    return Cache.system(filename["B"]) if set_number == 0
    return Cache.system(filename["C"]) if set_number == 1
    return Cache.system(filename["D"]) if set_number == 2
    return Cache.system(filename["E"]) if set_number == 3
    return nil
  end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# ■ Spriteset_Map
#==============================================================================

class Spriteset_Map
  #--------------------------------------------------------------------------
  # ● タイルマップの作成
  #--------------------------------------------------------------------------
  def create_tilemap
    filename = KGC::TilesetExtension.get_tileset_filename
    @tilemap = Tilemap.new(@viewport1)
    @tilemap.bitmaps[0] = Cache.system(filename["A1"])
    @tilemap.bitmaps[1] = Cache.system(filename["A2"])
    @tilemap.bitmaps[2] = Cache.system(filename["A3"])
    @tilemap.bitmaps[3] = Cache.system(filename["A4"])
    @tilemap.bitmaps[4] = Cache.system(filename["A5"])
    @tilemap.bitmaps[5] = Cache.system(filename["B"])
    @tilemap.bitmaps[6] = Cache.system(filename["C"])
    @tilemap.bitmaps[7] = Cache.system(filename["D"])
    @tilemap.bitmaps[8] = Cache.system(filename["E"])
    @tilemap.map_data = $game_map.data
    @tilemap.passages = $game_map.passages
  end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# ■ Scene_Title
#==============================================================================

class Scene_Title < Scene_Base
  #--------------------------------------------------------------------------
  # ● データベースのロード
  #--------------------------------------------------------------------------
  alias load_database_KGC_TilesetExtension load_database
  def load_database
    load_database_KGC_TilesetExtension

    load_tileset
  end
  #--------------------------------------------------------------------------
  # ○ タイルセット付加情報のロード
  #--------------------------------------------------------------------------
  def load_tileset
    begin
      $data_tileset = load_data("Data/#{KGC::TilesetExtension::EX_RVDATA}")
    rescue
      $data_tileset = RPG::Tileset.new
    end
  end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# ■ Scene_File
#==============================================================================

class Scene_File < Scene_Base
  #--------------------------------------------------------------------------
  # ● セーブデータの読み込み
  #    file : 読み込み用ファイルオブジェクト (オープン済み)
  #--------------------------------------------------------------------------
  alias read_save_data_KGC_TilesetExtension read_save_data
  def read_save_data(file)
    read_save_data_KGC_TilesetExtension(file)

    $game_map.init_tileset_filename
    Graphics.frame_reset
  end
end

#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_
#_/  The original untranslated version of this script can be found here:
# http://f44.aaa.livedoor.jp/~ytomy/tkool/rpgtech/php/tech.php?tool=VX&cat=tech_vx/map&tech=tileset_extension
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_

O que isso faz ?
IDmaluco
IDmaluco

Mensagens : 44
Data de inscrição : 08/08/2010

Ir para o topo Ir para baixo

TilesetExtension Empty Re: TilesetExtension

Mensagem por Zephi Qua Ago 11, 2010 5:50 pm

Está escrito no script... xD

Script escreveu:This script restores some functionanlity pertaining to tilesets that were
originally included in previous RPG Makers.

★ Restored Functions ★
1. Tilesets may be changed to different tileset files.
2. 4-way Directional Passability
3. Terrain tags. (Up to 99!)

Note: When the tileset is changed, it DOES NOT appear within the editor.
You may want to open the image in an external viewer for reference.
.

Traduzindo...
O script restaura algumas funções pertencentes aos tilesets originais nos RPGs Makers anteriores.

Funções restauradas:
1-Os tilesets podem ser alterados para diferentes arquivos de tilesets (oO)
2-Passabilidade dos 4 lados
3-Tags de terreno (mais de 99")

Nota: Quando o tileset é alterado, ele NÃO aparecer dentro do editor.
Você pode querer abrir a imagem em um visor externo para referência.

Esse script é de VX, e restaura algumas funções no tileset que os outros rpg makers tinham.
Testei esse script, mas pelo que eu entendi na parte de instruções tem que ter uma ferramenta de num sei o que lá que está incluída na Demo. Procure pela demo do script para entender melhor ^^

É isso, espero que tenha entendido.

Zephi

Mensagens : 85
Data de inscrição : 14/07/2010
Idade : 26
Localização : Base Lunar; quarto 213; empacotando as malas

Ir para o topo Ir para baixo

TilesetExtension Empty Re: TilesetExtension

Mensagem por IDmaluco Qui Ago 12, 2010 11:18 am

Opa , testei aki xD.
Estranho que na pasta da DEMO , tem 3 arquivos não tão normais : XD

TCap.dll e,TCrypt.dll RGSS200J.dll

Sei que esse tcrypt tem alguma coisa a ver com uma script que vem , que é sobre trancar seu projeto.Acho que com ele fica mais difícil de desencriptar.

Bem , vlw ae TilesetExtension Icon_smile .
IDmaluco
IDmaluco

Mensagens : 44
Data de inscrição : 08/08/2010

Ir para o topo Ir para baixo

TilesetExtension Empty Re: TilesetExtension

Mensagem por Conteúdo patrocinado


Conteúdo patrocinado


Ir para o topo Ir para baixo

Ir para o topo


 
Permissões neste sub-fórum
Não podes responder a tópicos