调式模式时按F8会进入公共事件调式,
若调用公共事件会强制停止地图上的事件。
(注释仅是随便加了一点 -_-|| )
范例:
脚本:
- # ◆ 公共事件调式系统 Common Event Debug# 调式模式时按F8会进入公共事件调式,若调用公共事件会强制停止地图上的事件。# (注释仅是随便加了一点 -_-|| )class Scene_Map alias scene_map_update update def update # 添加F8开启按键 if $DEBUG and Input.press?(Input::F8) $scene = Scene_CED.new end scene_map_update endendclass Window_CED < Window_Selectable # 初始化 def initialize super(0, 64, 340, 416) self.index = 0 @item_max = 0 if self.contents != nil self.contents.dispose self.contents = nil end # 算出公共事件的数量 for i in 1..999 if $data_common_events[i] != nil @item_max += 1 end end # 描绘公共事件 self.contents = Bitmap.new(width - 32, @item_max * 32) for i in 0...@item_max common_id = sprintf("%03d: ",i+1) text = common_id + $data_common_events[i+1].name self.contents.draw_text(4, i * 32, 320, 32, text) end endendclass Scene_CED # 主处理 def main # 生成各种窗口 @help_window = Window_Help.new @help_window.set_text("公共事件调式系统,按确定键执行公共事件。") @info_window = Window_Base.new(340,64,300,416) @info_window.contents = Bitmap.new(250,350) @ced_window = Window_CED.new Graphics.transition loop do Graphics.update Input.update update # 刷新公共事件说明 update_info if $scene != self break end end Graphics.freeze $game_map.refresh # 释放各种窗口 @info_window.dispose @help_window.dispose @ced_window.dispose end # 刷新 def update @ced_window.update if Input.trigger?(Input::B) $scene = Scene_Map.new return end if Input.trigger?(Input::C) # 强制停止地图上的事件 $game_system.map_interpreter.command_end $scene = Scene_Map.new # 调用公共事件 $game_temp.common_event_id = (@ced_window.index + 1) return end end # 刷新公共事件说明 def update_info @info_window.contents.clear # 描绘公共事件说明 @info_window.contents.font.color = Color.new(192, 224, 255, 255) text_id = "ID :" text_name = "名称:" text_trigger = "目标:" text_switch_id = "条件:" @info_window.contents.draw_text(4,0,250,32,text_id) @info_window.contents.draw_text(4,32,250,32,text_name) @info_window.contents.draw_text(4,64,250,32,text_trigger) @info_window.contents.draw_text(4,96,250,32,text_switch_id) @info_window.contents.font.color = Color.new(255, 255, 255, 255) id = sprintf("%03d",@ced_window.index + 1) name = $data_common_events[@ced_window.index + 1].name if $data_common_events[@ced_window.index + 1].trigger == 0 trigger = "无" elsif $data_common_events[@ced_window.index + 1].trigger == 1 trigger = "自动执行" else trigger = "并行处理" end if $data_common_events[@ced_window.index + 1].trigger != 0 switch_id = sprintf("开关 %04d",$data_common_events[@ced_window.index + 1].switch_id) else switch_id = "无" end @info_window.contents.draw_text(65,0,250,32,id) @info_window.contents.draw_text(65,32,250,32,name) @info_window.contents.draw_text(65,64,250,32,trigger) @info_window.contents.draw_text(65,96,250,32,switch_id) endend复制代码
复制代码 本帖来自P1论坛作者EngShun,因Project1站服务器在国外有时候访问缓慢不方便作者交流学习,经联系P1站长fux2同意署名转载一起分享游戏制作经验,共同为国内独立游戏作者共同创造良好交流环境,原文地址:
https://rpg.blue/forum.php?mod=viewthread&tid=162664 若有侵权,发帖作者可联系底部站长QQ在线咨询功能删除,谢谢。