| 这个可以啊 羡慕会脚本的人 |
alexncf125 发表于 2021-12-15 17:21 多谢了,我还是脚本小白,刚刚才想到Ruby脚本可以在外部追加类方法定义。真是糗大了…… ![]() |
|
本帖最后由 alexncf125 于 2023-4-23 20:05 编辑 欢迎新大佬~ 我这把改动的部分提了出来~ 並用alias消除了可能会出现冲突的地方~ 把 def refresh 改成 def draw_block1 还小修了def armor_name 和 def state_effect 大佬不会介意吧~ 期望大佬下次写的脚本能方便他人使用~ [pre lang="ruby"]module Cache #-------------------------------------------------------------------------- # ● 显示会变更人物图的状态index #-------------------------------------------------------------------------- State_actor = [18, 19] #-------------------------------------------------------------------------- # ● 获取全身像+铠甲名+状态 #-------------------------------------------------------------------------- def self.body(filename, armor_name, state) load_bitmap("Graphics/Characters_/", filename + armor_name + state.to_s) end end class Window_Base < Window #-------------------------------------------------------------------------- # ● 描绘全身像 # enabled : 有效的标志。 false 的时候使用半透明效果绘制 #-------------------------------------------------------------------------- def draw_body(body_name, armor_name, state, x, y, enabled = true) bitmap = Cache.body(body_name, armor_name, state) rect = Rect.new(0, 0, bitmap.width, bitmap.height) contents.blt(x, y, bitmap, rect, enabled ? 255 : translucent_alpha) bitmap.dispose end #-------------------------------------------------------------------------- # ● 取得铠甲名字 #-------------------------------------------------------------------------- def armor_name @actor.equips[3] ? @actor.equips[3].name : "none" end #-------------------------------------------------------------------------- # ● actor的全身像描画 #-------------------------------------------------------------------------- def draw_actor_body(actor, armor_name, state_effect, x, y, enabled = true) draw_body(actor.name, armor_name, state_effect, x, y, enabled) end #-------------------------------------------------------------------------- # ● 取得状态index #-------------------------------------------------------------------------- def state_effect Cache::State_actor.each do |state_index| return state_index if @actor.state_icons.include?(state_index) end return 0 end end class Window_Status < Window_Selectable #-------------------------------------------------------------------------- # ● 绘制区域 1 #-------------------------------------------------------------------------- alias body_draw_block1 draw_block1 def draw_block1(y) draw_actor_body(@actor, armor_name, state_effect, 400, 150) body_draw_block1(y) end end class Window_ActorCommand < Window_Command #-------------------------------------------------------------------------- # ● 初始化对象 #-------------------------------------------------------------------------- alias body_initialize initialize def initialize body_initialize @body = Sprite.new end #-------------------------------------------------------------------------- # ● 设置 #-------------------------------------------------------------------------- alias body_setup setup def setup(actor) body_setup(actor) @body.bitmap = Cache.body(@actor.name, armor_name, state_effect) @body.x = 12; @body.y = 160 end #-------------------------------------------------------------------------- # ● 可視设置 #-------------------------------------------------------------------------- def visible(visible = true) @body.visible = visible end end class Scene_Battle < Scene_Base #-------------------------------------------------------------------------- # ● 开始角色指令的选择 #-------------------------------------------------------------------------- alias body_start_actor_command_selection start_actor_command_selection def start_actor_command_selection body_start_actor_command_selection @actor_command_window.visible(true) end #-------------------------------------------------------------------------- # ● 回合开始 #-------------------------------------------------------------------------- alias body_turn_start turn_start def turn_start body_turn_start @actor_command_window.visible(false) end end[/pre] |