设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 3367|回复: 7
打印 上一主题 下一主题

RM_VX地形标志编辑器

 关闭 [复制链接]

Lv2.观梦者

天仙

梦石
0
星屑
640
在线时间
184 小时
注册时间
2008-4-15
帖子
5023

贵宾

跳转到指定楼层
1
发表于 2009-1-16 14:30:54 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有帐号?注册会员

x
是用於这个脚本
RM_VX地形标志V3.5_图块版本
帮忙生成那个设定的哈希表用的

设定好之後,按Z键(默认对应键盘上的D键)输出为文本
然後打开游戏文件夹,会看到一个 txt 文件: Terrain.txt
打开後将内容复制,覆盖上面那个脚本的「地形标志设置区」

调用:
$scene = Scene_TerrainTag.new

截图:


脚本:
  1. class Window_TerrainTag < Window_Selectable
  2.   attr_writer :tile_ltr
  3.   def initialize
  4.     super(120, 0, 288, 1056, 0)
  5.     @item_max = 256
  6.     @column_max = 8
  7.     @tile_ltr = "A"
  8.     self.index = 0
  9.     create_contents
  10.     self.height = 416
  11.     $tile_A_terrain_tag ||= Hash.new(0)
  12.     $tile_B_terrain_tag ||= Hash.new(0)
  13.     $tile_C_terrain_tag ||= Hash.new(0)
  14.     $tile_D_terrain_tag ||= Hash.new(0)
  15.     $tile_E_terrain_tag ||= Hash.new(0)
  16.     @tags = eval("$tile_#{@tile_ltr}_terrain_tag")
  17.     load_tilemap
  18.     refresh
  19.   end
  20.   def refresh
  21.     self.contents.clear
  22.     draw_tile
  23.     draw_terrain_tags
  24.     draw_cursor
  25.   end
  26.   def update
  27.     super
  28.     if Input.trigger?(Input::C) or Input.trigger?(Input::B)
  29.       if cannot_set_tag
  30.         Sound.play_buzzer
  31.       else
  32.         Sound.play_decision
  33.         @tags[@index] += 1 if Input.trigger?(Input::C)
  34.         @tags[@index] -= 1 if Input.trigger?(Input::B)
  35.         @tags[@index] %= 8
  36.         refresh
  37.       end
  38.     elsif Input.trigger?(Input::DOWN) or Input.trigger?(Input::UP) or
  39.       Input.trigger?(Input::LEFT) or Input.trigger?(Input::RIGHT)
  40.       refresh
  41.     end
  42.   end
  43.   def draw_cursor
  44.     skin = Cache.system("Window")
  45.     rect = Rect.new(64, 64, 32, 32)
  46.     self.contents.blt(@index%8*32, @index/8*32, skin, rect)
  47.   end
  48.   def draw_tile
  49.     if @tile_ltr == "A"
  50.       create_tile_A
  51.     else
  52.       rect = Rect.new(0, 0, 256, 512)
  53.       i = {"B" => 5, "C" => 6, "D" => 7, "E" => 8}
  54.       self.contents.blt(0, 0, @tile_bitmaps[i[@tile_ltr]], rect)
  55.       rect.x += 256
  56.       self.contents.blt(0, 512, @tile_bitmaps[i[@tile_ltr]], rect)      
  57.     end
  58.   end
  59.   def draw_terrain_tags
  60.     @tags = eval("$tile_#{@tile_ltr}_terrain_tag")
  61.     256.times {|i|
  62.       x = (i%8) * 32
  63.       y = (i/8) * 32
  64.       self.contents.draw_text(x, y, 32, 32, @tags[i], 1)
  65.     }
  66.   end
  67.   def create_tile_A
  68.     @tile_A = Bitmap.new(256, 1024)
  69.     for i in 0..4
  70.       temp_bmp = @tile_bitmaps[i]
  71.       case i
  72.       when 0
  73.         16.times do |j|
  74.           x = j % 8 * 32
  75.           x += 64 if j%8>=2 and j%8<=3
  76.           x -= 64 if j%8>=4 and j%8<=5
  77.           x += 32 if j==1
  78.           x -= 32 if j==4
  79.           y = j / 8 * 32
  80.           bx = j % 4 * 128+64
  81.           by = j / 4 * 96
  82.           if j == 0
  83.             rect = Rect.new(16, 48, 32, 32)
  84.             3.times{|k| @tile_A.blt(x+(k+1)*32, y, temp_bmp, rect)}
  85.           end
  86.           rect = Rect.new(bx, by, 32, 32)
  87.           @tile_A.blt(x, y, temp_bmp, rect)
  88.         end
  89.       when 1
  90.         32.times do |j|
  91.           x = j % 8 * 32
  92.           y = j / 8 * 32
  93.           bx = j % 8 * 64
  94.           by = j / 8 * 96
  95.           if [0, 3].include?(j%8)
  96.             rect = Rect.new(bx+16, by+48, 32, 32)
  97.             2.times{|k| @tile_A.blt(x+(k+1)*32, y+64, temp_bmp, rect)}
  98.           end
  99.           rect = Rect.new(bx, by, 32, 32)
  100.           @tile_A.blt(x, y+64, temp_bmp, rect)
  101.         end
  102.       when 2
  103.         32.times do |j|
  104.           x = j % 8 * 32
  105.           y = j / 8 * 32
  106.           bx = j % 8 * 64
  107.           by = j / 8 * 64
  108.           rect = Rect.new(0, 0, 32, 32)
  109.           @tile_A.blt(x, y+192, get_corners(bx, by, temp_bmp), rect)
  110.         end
  111.       when 3
  112.         48.times do |j|
  113.           x = j % 8 * 32
  114.           y = j / 8 * 32
  115.           bx = j % 8 * 64
  116.           if (j/8)%2 == 0
  117.             by = j / 8 * 80
  118.             rect = Rect.new(bx, by, 32, 32)
  119.             @tile_A.blt(x, y+320, temp_bmp, rect)
  120.           else
  121.             by = (j/8-1) * 80+96
  122.             rect = Rect.new(0, 0, 32, 32)
  123.             @tile_A.blt(x, y+320, get_corners(bx, by, temp_bmp), rect)
  124.           end
  125.         end
  126.       when 4
  127.         rect = Rect.new(0, 0, 256, 512)
  128.         @tile_A.blt(0, 512, temp_bmp, rect)
  129.       end
  130.     end
  131.     rect = Rect.new(0, 0, 256, 1024)
  132.     self.contents.blt(0, 0, @tile_A, rect)
  133.   end
  134.   def get_corners(bx, by, bmp)
  135.     temp_bmp = Bitmap.new(32, 32)   
  136.     rect = Rect.new(bx, by, 16, 16)
  137.     temp_bmp.blt(0, 0, bmp, rect)   
  138.     rect = Rect.new(bx+48, by, 16, 16)
  139.     temp_bmp.blt(16, 0, bmp, rect)   
  140.     rect = Rect.new(bx, by+48, 16, 16)
  141.     temp_bmp.blt(0, 16, bmp, rect)   
  142.     rect = Rect.new(bx+48, by+48, 16, 16)
  143.     temp_bmp.blt(16, 16, bmp, rect)   
  144.     return temp_bmp
  145.   end
  146.   def cannot_set_tag
  147.     return true if @tile_ltr == "A" and @index == 136
  148.     return true if @tile_ltr == "B" and @index == 0
  149.     return false
  150.   end
  151.   def item_rect(index)
  152.     rect = Rect.new(0, 0, 32, 32)
  153.     rect.x = index % @column_max * (rect.width + @spacing)
  154.     rect.y = index / @column_max * 32
  155.     return rect
  156.   end
  157.   #--------------------------------------------------------------------------
  158.   # ● 獲取首行
  159.   #--------------------------------------------------------------------------
  160.   def top_row
  161.     return self.oy / 32
  162.   end
  163.   #--------------------------------------------------------------------------
  164.   # ● 設置首行
  165.   #     row : 顯示在最上的行
  166.   #--------------------------------------------------------------------------
  167.   def top_row=(row)
  168.     row = 0 if row < 0
  169.     row = row_max - 1 if row > row_max - 1
  170.     self.oy = row * 32
  171.   end
  172.   #--------------------------------------------------------------------------
  173.   # ● 獲取一頁能顯示的行數
  174.   #--------------------------------------------------------------------------
  175.   def page_row_max
  176.     return (self.height - 32) / 32
  177.   end
  178.   def load_tilemap
  179.     @tile_bitmaps = Array.new(9)
  180.     @tile_bitmaps[0] = Cache.system("TileA1")
  181.     @tile_bitmaps[1] = Cache.system("TileA2")
  182.     @tile_bitmaps[2] = Cache.system("TileA3")
  183.     @tile_bitmaps[3] = Cache.system("TileA4")
  184.     @tile_bitmaps[4] = Cache.system("TileA5")
  185.     @tile_bitmaps[5] = Cache.system("TileB")
  186.     @tile_bitmaps[6] = Cache.system("TileC")
  187.     @tile_bitmaps[7] = Cache.system("TileD")
  188.     @tile_bitmaps[8] = Cache.system("TileE")
  189.   end
  190. end
  191. module TerrainTag
  192.   TILESETS = ["A","B","C","D","E"]
  193.   Directory = "Terrain.txt"
  194. end
  195. class Scene_TerrainTag < Scene_Base
  196.   def start
  197.     @tag_window = Window_TerrainTag.new
  198.     @tag_window.active = true
  199.     @tile_window = Window_Command.new(120, ["A","B","C","D","E"])
  200.     @tile_window.index = 0
  201.     @tile_window.active = false
  202.     @help_window = Window_Base.new(392, -16, 168, 448)
  203.     @help_window.back_opacity = 0
  204.     @help_window.z = 0
  205.     @help_window.contents.font.size = 14
  206.     @help_window.contents.draw_text(4, 0, 170, 24, "A, S:切换图块")
  207.     @help_window.contents.draw_text(4, 24, 170, 24, "确定键:地形标志+1")
  208.     @help_window.contents.draw_text(4, 48, 170, 24, "取消键:地形标志-1")
  209.     @help_window.contents.draw_text(4, 72, 170, 24, "D 键:输出为文本")
  210.     update_tag
  211.   end
  212.   def update
  213.     @tag_window.update
  214.     @tile_window.update
  215.     if Input.trigger?(Input::X) or Input.trigger?(Input::Y)
  216.       @tile_window.index += 1 if Input.trigger?(Input::Y)
  217.       @tile_window.index -= 1 if Input.trigger?(Input::X)
  218.       @tile_window.index %= @tile_window.commands.size
  219.       update_tag
  220.     end
  221.     if Input.trigger?(Input::Z)
  222.       output_text
  223.     end
  224.   end
  225.   
  226.   def output_text
  227.     text_str = ""
  228.     TerrainTag::TILESETS.size.times do |i|
  229.       ltr = TerrainTag::TILESETS[i]
  230.       temp_tag = eval("$tile_#{ltr}_terrain_tag.sort")
  231.       text_str += "
  232. MAP_TILE_#{ltr}=#{temp_tag.inspect}
  233. MAP_TILE_#{ltr}.default = 0
  234. "
  235.     end
  236.     text_file = File.open(TerrainTag::Directory, "w")
  237.     text_file.write(text_str)
  238.     p "输出完毕"
  239.     exit
  240.   end
  241.   
  242.   def update_tag
  243.     @tag_window.tile_ltr = TerrainTag::TILESETS[@tile_window.index]
  244.     @tag_window.refresh
  245.   end
  246.   def terminate
  247.     @tag_window.dispose
  248.     @tile_window.dispose
  249.     @help_window.dispose
  250.   end
  251. end
复制代码

点评

LZ好强了,膜拜ing!!就是还没搞懂,覆盖哪里?【地形标志设置区】不知道在哪里?  发表于 2010-9-9 04:09
VA脚本开工中...
偷窃脚本1.0 - 已完成

Lv4.逐梦者

世界坑化协会

梦石
0
星屑
8963
在线时间
1581 小时
注册时间
2007-3-13
帖子
5555

极短26参与极短25参与极短23参与极短21参与开拓者贵宾第一届化妆舞会最佳服饰奖

2
发表于 2009-1-16 17:20:06 | 只看该作者
{/fd}结合使用啊~
忍卷NINMAKI游戏DEMO上线了~♪  点我下载  ☚
回复 支持 反对

使用道具 举报

Lv1.梦旅人

B

梦石
0
星屑
50
在线时间
26 小时
注册时间
2007-8-26
帖子
3693
3
发表于 2009-1-17 01:51:07 | 只看该作者
制作战棋的必备脚本啊~
回复 支持 反对

使用道具 举报

Lv1.梦旅人

龙皇

梦石
0
星屑
50
在线时间
83 小时
注册时间
2007-8-8
帖子
2956
4
发表于 2009-1-21 01:46:45 | 只看该作者
流星姐果然是做出来了!!
thanks!!

                签名图来自:無限のファンタジア
                 我的RMXP专题空间--龙使传说
回复 支持 反对

使用道具 举报

Lv2.观梦者

天仙

梦石
0
星屑
640
在线时间
184 小时
注册时间
2008-4-15
帖子
5023

贵宾

5
 楼主| 发表于 2009-1-21 04:17:51 | 只看该作者
以下引用TERENCE于2009-1-20 17:46:45的发言:
流星姐果然是做出来了!!
thanks!!

算A图块的座标算的我头昏眼花{/yun}
VA脚本开工中...
偷窃脚本1.0 - 已完成
回复 支持 反对

使用道具 举报

头像被屏蔽

Lv1.梦旅人 (禁止发言)

梦石
0
星屑
46
在线时间
10 小时
注册时间
2007-5-27
帖子
2558

第1届Title华丽大赛新人奖

6
发表于 2009-1-21 05:48:47 | 只看该作者
提示: 作者被禁止或删除 内容自动屏蔽
签名被屏蔽
回复 支持 反对

使用道具 举报

Lv1.梦旅人

龙皇

梦石
0
星屑
50
在线时间
83 小时
注册时间
2007-8-8
帖子
2956
7
发表于 2009-1-21 09:15:34 | 只看该作者
以下引用沉影不器于2009-1-20 21:48:47的发言:
TERENCE换电脑了?



* 领消费卷啊~现拿现用
(家人们合资消费卷买了一台新的了!)

                签名图来自:無限のファンタジア
                 我的RMXP专题空间--龙使传说
回复 支持 反对

使用道具 举报

Lv2.观梦者

天仙

梦石
0
星屑
640
在线时间
184 小时
注册时间
2008-4-15
帖子
5023

贵宾

8
 楼主| 发表于 2009-1-21 20:41:11 | 只看该作者
好棒
可惜我住国外没消费卷可以拿{/pz}
VA脚本开工中...
偷窃脚本1.0 - 已完成
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2025-7-21 23:12

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表