じ☆ve冰风 发表于 2024-4-20 00:03:04

【加工】行走图转换器(VA/VX -> XP)

之前写过一个脚本可以直接在XP上使用VA/VX的单个行走图,这个脚本用起来还凑合,主要的问题就是VX/VA的行走图有很多是8个人放在一张图上的,放到XP里面还得先裁剪。即便是单张4×3的行走图,在编辑器中显示也是怪怪的。最近锅盖要办什么事件剧情设计大赛,需要把VA行走图搞的XP上,于是就写了这个脚本。
用法十分简单,脚本里面已经附上说明。
RUBY 代码
#=========================================================================
# 行走图转换工具 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

defself.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 = []
      unlessFileTest.exist?(Dir_Out)
      Dir.mkdir(Dir_Out)
      end
      Dir.foreach(Dir_In)do |s|
      filenames_in
页: [1]
查看完整版本: 【加工】行走图转换器(VA/VX -> XP)