| 赞 | 189 |
| VIP | |
| 好人卡 | |
| 积分 | 96 |
| 经验 | |
| 最后登录 | 2026-5-4 |
| 在线时间 | 5074 小时 |
- 梦石
- 0
- 星屑
- 9557
- 在线时间
- 5074 小时
- 注册时间
- 2013-6-21
- 回帖
- 3459
  
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有账号?注册会员
×
本帖最后由 RyanBern 于 2016-5-8 17:38 编辑
之前写过一个脚本可以直接在XP上使用VA/VX的单个行走图,这个脚本用起来还凑合,主要的问题就是VX/VA的行走图有很多是8个人放在一张图上的,放到XP里面还得先裁剪。即便是单张4×3的行走图,在编辑器中显示也是怪怪的。最近锅盖要办什么事件剧情设计大赛,需要把VA行走图搞的XP上,于是就写了这个脚本。
用法十分简单,脚本里面已经附上说明。
- #=========================================================================
- # 行走图转换工具 VA->XP Ver 1.0
- #-------------------------------------------------------------------------
- # @Author : RyanBern
- #-------------------------------------------------------------------------
- # 用法:
- # 将待转换的 VA 行走图放入工程根目录的 vx_chara_s 文件夹下,并新建一个
- # 文件夹 xp_chara_s 用于存放转换好的 XP 行走图。新的行走图文件名会命名
- # 为 原行走图_00~原行走图_07.png,必要时请设置横向和纵向格栅数。
- # 然后将此脚本插入到 Main 组之前,运行游戏工程,在标题画面按下 Z 键即可
- # 进行批量转换。使用完毕后,可以将此脚本删除(附带的MGC_PNG.dll如果用不
- # 到也可以删掉)
- #=========================================================================
- module Char_VA2XP
- # VA 行走图文件夹(输入)
- Dir_In = "vx_chara_s"
-
- # XP 行走图文件夹(输出)
- Dir_Out = "xp_chara_s"
-
- # 横向格栅数(即一张图横向有多少个角色)
- NUMS_X = 4
-
- # 纵向格栅数(即一张图纵向有多少个角色)
- NUMS_Y = 2
-
- def self.start_covert
- $scene = Scene_Char_Convert
- end
- class Window_Progress < ::Window_Base
- def initialize
- super(0, 0, 288, 96)
- @curr = @tol = 0
- self.contents = Bitmap.new(width - 32, height - 32)
- self.x = 320 - width / 2
- self.y = 240 - height / 2
- self.opacity = 0
- refresh
- end
- def refresh
- self.contents.clear
- refresh_words
- refresh_progress
- end
- def refresh_words
- self.contents.draw_text(4, 0, width - 36, 32, "Converting...Please wait...")
- end
- def refresh_progress
- self.contents.fill_rect(0, 32, width - 32, 32, Color.new(0, 0, 0, 0))
- self.contents.draw_text(96, 32, 48, 32, @curr.to_s, 2)
- self.contents.draw_text(144, 32, 24, 32, "/", 1)
- self.contents.draw_text(168, 32, 48, 32, @tol.to_s)
- end
- def set(curr, tol)
- if @curr != curr || @tol != tol
- @curr, @tol = curr, tol
- refresh_progress
- end
- end
- end
- class Scene_Char_Convert
- def main
- @progress_window = Window_Progress.new
- Graphics.transition
- start_convert
- Graphics.freeze
- @progress_window.dispose
- print "done"
- exit
- end
- def start_convert
- filenames_in = []
- unless FileTest.exist?(Dir_Out)
- Dir.mkdir(Dir_Out)
- end
- Dir.foreach(Dir_In) do |s|
- filenames_in << s if s != "." && s != ".."
- end
- tol = NUMS_X * NUMS_Y
- curr = 0
- @progress_window.set(curr, tol)
- Graphics.update
- filenames_in.each do |filename|
- filename_out_base = filename.split(/\./)[0]
- src_bitmap = Bitmap.new(Dir_In + "/" + filename)
- (0...tol).each do |i|
- w = src_bitmap.width / NUMS_X
- h = src_bitmap.height / NUMS_Y
- x = i % NUMS_X * w
- y = i / NUMS_X * h
- out_bitmap = Bitmap.new(w / 3 * 4, h)
- src_rect1 = Rect.new(x, y, w, h)
- src_rect2 = Rect.new(x + w / 3, y, w / 3, h)
- out_bitmap.blt(0, 0, src_bitmap, src_rect2)
- out_bitmap.blt(w / 3, 0, src_bitmap, src_rect1)
- filename_out = sprintf("%s_%02d.png", filename_out_base, i)
- out_bitmap.save_as_png(Dir_Out + "/" + filename_out)
- curr += 1
- @progress_window.set(curr, tol * filenames_in.size)
- Graphics.update
- out_bitmap.dispose
- end
- src_bitmap.dispose
- end
- end
- end
- end
- class Scene_Title
- alias rb_update_20160202 update
- def update
- if Input.trigger?(Input::A)
- $scene = Char_VA2XP::Scene_Char_Convert.new
- return
- end
- rb_update_20160202
- end
- end
- #==============================================================================
- # ■ Bitmap
- #------------------------------------------------------------------------------
- # 关联到Bitmap。
- #==============================================================================
- class Bitmap
- #--------------------------------------------------------------------------
- # * Constantes
- #--------------------------------------------------------------------------
- CREATE_PNG = Win32API.new("MGC_PNG", "createPNG", "ll", "l")
- #--------------------------------------------------------------------------
- # * Méthode d'appel pour créer un fichier PNG
- # chemin : chemin + nom du fichier à créer
- #--------------------------------------------------------------------------
- def save_as_png(chemin)
- unless chemin[/\//] then chemin = './' << chemin end
- CREATE_PNG.call(self.__id__, chemin.__id__)
- end
- end
复制代码
范例还是照常附上:
Char_Va2XP.7z
(985.05 KB, 下载次数: 337)
|
评分
-
查看全部评分
|