赞 | 4 |
VIP | 71 |
好人卡 | 22 |
积分 | 6 |
经验 | 32145 |
最后登录 | 2013-8-9 |
在线时间 | 184 小时 |
Lv2.观梦者 天仙
- 梦石
- 0
- 星屑
- 640
- 在线时间
- 184 小时
- 注册时间
- 2008-4-15
- 帖子
- 5023

|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
是用於这个脚本
RM_VX地形标志V3.5_图块版本
帮忙生成那个设定的哈希表用的
设定好之後,按Z键(默认对应键盘上的D键)输出为文本
然後打开游戏文件夹,会看到一个 txt 文件: Terrain.txt
打开後将内容复制,覆盖上面那个脚本的「地形标志设置区」
调用:
$scene = Scene_TerrainTag.new
截图:
![]()
脚本:
- class Window_TerrainTag < Window_Selectable
- attr_writer :tile_ltr
- def initialize
- super(120, 0, 288, 1056, 0)
- @item_max = 256
- @column_max = 8
- @tile_ltr = "A"
- self.index = 0
- create_contents
- self.height = 416
- $tile_A_terrain_tag ||= Hash.new(0)
- $tile_B_terrain_tag ||= Hash.new(0)
- $tile_C_terrain_tag ||= Hash.new(0)
- $tile_D_terrain_tag ||= Hash.new(0)
- $tile_E_terrain_tag ||= Hash.new(0)
- @tags = eval("$tile_#{@tile_ltr}_terrain_tag")
- load_tilemap
- refresh
- end
- def refresh
- self.contents.clear
- draw_tile
- draw_terrain_tags
- draw_cursor
- end
- def update
- super
- if Input.trigger?(Input::C) or Input.trigger?(Input::B)
- if cannot_set_tag
- Sound.play_buzzer
- else
- Sound.play_decision
- @tags[@index] += 1 if Input.trigger?(Input::C)
- @tags[@index] -= 1 if Input.trigger?(Input::B)
- @tags[@index] %= 8
- refresh
- end
- elsif Input.trigger?(Input::DOWN) or Input.trigger?(Input::UP) or
- Input.trigger?(Input::LEFT) or Input.trigger?(Input::RIGHT)
- refresh
- end
- end
- def draw_cursor
- skin = Cache.system("Window")
- rect = Rect.new(64, 64, 32, 32)
- self.contents.blt(@index%8*32, @index/8*32, skin, rect)
- end
- def draw_tile
- if @tile_ltr == "A"
- create_tile_A
- else
- rect = Rect.new(0, 0, 256, 512)
- i = {"B" => 5, "C" => 6, "D" => 7, "E" => 8}
- self.contents.blt(0, 0, @tile_bitmaps[i[@tile_ltr]], rect)
- rect.x += 256
- self.contents.blt(0, 512, @tile_bitmaps[i[@tile_ltr]], rect)
- end
- end
- def draw_terrain_tags
- @tags = eval("$tile_#{@tile_ltr}_terrain_tag")
- 256.times {|i|
- x = (i%8) * 32
- y = (i/8) * 32
- self.contents.draw_text(x, y, 32, 32, @tags[i], 1)
- }
- end
- def create_tile_A
- @tile_A = Bitmap.new(256, 1024)
- for i in 0..4
- temp_bmp = @tile_bitmaps[i]
- case i
- when 0
- 16.times do |j|
- x = j % 8 * 32
- x += 64 if j%8>=2 and j%8<=3
- x -= 64 if j%8>=4 and j%8<=5
- x += 32 if j==1
- x -= 32 if j==4
- y = j / 8 * 32
- bx = j % 4 * 128+64
- by = j / 4 * 96
- if j == 0
- rect = Rect.new(16, 48, 32, 32)
- 3.times{|k| @tile_A.blt(x+(k+1)*32, y, temp_bmp, rect)}
- end
- rect = Rect.new(bx, by, 32, 32)
- @tile_A.blt(x, y, temp_bmp, rect)
- end
- when 1
- 32.times do |j|
- x = j % 8 * 32
- y = j / 8 * 32
- bx = j % 8 * 64
- by = j / 8 * 96
- if [0, 3].include?(j%8)
- rect = Rect.new(bx+16, by+48, 32, 32)
- 2.times{|k| @tile_A.blt(x+(k+1)*32, y+64, temp_bmp, rect)}
- end
- rect = Rect.new(bx, by, 32, 32)
- @tile_A.blt(x, y+64, temp_bmp, rect)
- end
- when 2
- 32.times do |j|
- x = j % 8 * 32
- y = j / 8 * 32
- bx = j % 8 * 64
- by = j / 8 * 64
- rect = Rect.new(0, 0, 32, 32)
- @tile_A.blt(x, y+192, get_corners(bx, by, temp_bmp), rect)
- end
- when 3
- 48.times do |j|
- x = j % 8 * 32
- y = j / 8 * 32
- bx = j % 8 * 64
- if (j/8)%2 == 0
- by = j / 8 * 80
- rect = Rect.new(bx, by, 32, 32)
- @tile_A.blt(x, y+320, temp_bmp, rect)
- else
- by = (j/8-1) * 80+96
- rect = Rect.new(0, 0, 32, 32)
- @tile_A.blt(x, y+320, get_corners(bx, by, temp_bmp), rect)
- end
- end
- when 4
- rect = Rect.new(0, 0, 256, 512)
- @tile_A.blt(0, 512, temp_bmp, rect)
- end
- end
- rect = Rect.new(0, 0, 256, 1024)
- self.contents.blt(0, 0, @tile_A, rect)
- end
- def get_corners(bx, by, bmp)
- temp_bmp = Bitmap.new(32, 32)
- rect = Rect.new(bx, by, 16, 16)
- temp_bmp.blt(0, 0, bmp, rect)
- rect = Rect.new(bx+48, by, 16, 16)
- temp_bmp.blt(16, 0, bmp, rect)
- rect = Rect.new(bx, by+48, 16, 16)
- temp_bmp.blt(0, 16, bmp, rect)
- rect = Rect.new(bx+48, by+48, 16, 16)
- temp_bmp.blt(16, 16, bmp, rect)
- return temp_bmp
- end
- def cannot_set_tag
- return true if @tile_ltr == "A" and @index == 136
- return true if @tile_ltr == "B" and @index == 0
- return false
- end
- def item_rect(index)
- rect = Rect.new(0, 0, 32, 32)
- rect.x = index % @column_max * (rect.width + @spacing)
- rect.y = index / @column_max * 32
- return rect
- end
- #--------------------------------------------------------------------------
- # ● 獲取首行
- #--------------------------------------------------------------------------
- def top_row
- return self.oy / 32
- end
- #--------------------------------------------------------------------------
- # ● 設置首行
- # row : 顯示在最上的行
- #--------------------------------------------------------------------------
- def top_row=(row)
- row = 0 if row < 0
- row = row_max - 1 if row > row_max - 1
- self.oy = row * 32
- end
- #--------------------------------------------------------------------------
- # ● 獲取一頁能顯示的行數
- #--------------------------------------------------------------------------
- def page_row_max
- return (self.height - 32) / 32
- end
- def load_tilemap
- @tile_bitmaps = Array.new(9)
- @tile_bitmaps[0] = Cache.system("TileA1")
- @tile_bitmaps[1] = Cache.system("TileA2")
- @tile_bitmaps[2] = Cache.system("TileA3")
- @tile_bitmaps[3] = Cache.system("TileA4")
- @tile_bitmaps[4] = Cache.system("TileA5")
- @tile_bitmaps[5] = Cache.system("TileB")
- @tile_bitmaps[6] = Cache.system("TileC")
- @tile_bitmaps[7] = Cache.system("TileD")
- @tile_bitmaps[8] = Cache.system("TileE")
- end
- end
- module TerrainTag
- TILESETS = ["A","B","C","D","E"]
- Directory = "Terrain.txt"
- end
- class Scene_TerrainTag < Scene_Base
- def start
- @tag_window = Window_TerrainTag.new
- @tag_window.active = true
- @tile_window = Window_Command.new(120, ["A","B","C","D","E"])
- @tile_window.index = 0
- @tile_window.active = false
- @help_window = Window_Base.new(392, -16, 168, 448)
- @help_window.back_opacity = 0
- @help_window.z = 0
- @help_window.contents.font.size = 14
- @help_window.contents.draw_text(4, 0, 170, 24, "A, S:切换图块")
- @help_window.contents.draw_text(4, 24, 170, 24, "确定键:地形标志+1")
- @help_window.contents.draw_text(4, 48, 170, 24, "取消键:地形标志-1")
- @help_window.contents.draw_text(4, 72, 170, 24, "D 键:输出为文本")
- update_tag
- end
- def update
- @tag_window.update
- @tile_window.update
- if Input.trigger?(Input::X) or Input.trigger?(Input::Y)
- @tile_window.index += 1 if Input.trigger?(Input::Y)
- @tile_window.index -= 1 if Input.trigger?(Input::X)
- @tile_window.index %= @tile_window.commands.size
- update_tag
- end
- if Input.trigger?(Input::Z)
- output_text
- end
- end
-
- def output_text
- text_str = ""
- TerrainTag::TILESETS.size.times do |i|
- ltr = TerrainTag::TILESETS[i]
- temp_tag = eval("$tile_#{ltr}_terrain_tag.sort")
- text_str += "
- MAP_TILE_#{ltr}=#{temp_tag.inspect}
- MAP_TILE_#{ltr}.default = 0
- "
- end
- text_file = File.open(TerrainTag::Directory, "w")
- text_file.write(text_str)
- p "输出完毕"
- exit
- end
-
- def update_tag
- @tag_window.tile_ltr = TerrainTag::TILESETS[@tile_window.index]
- @tag_window.refresh
- end
- def terminate
- @tag_window.dispose
- @tile_window.dispose
- @help_window.dispose
- end
- end
复制代码 |
|