扫描二维码关注官方公众号
返回列表
+ 发新帖
查看: 98|回复: 0

[转载发布] DEBUG功能调用公共事件

[复制链接]
累计送礼:
0 个
累计收礼:
0 个
  • TA的每日心情
    开心
    昨天 18:01
  • 签到天数: 114 天

    连续签到: 4 天

    [LV.6]常住居民II

    2338

    主题

    403

    回帖

    1万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

    VIP
    6
    卡币
    10632
    OK点
    16
    推广点
    0
    同能卷
    0
    积分
    13401

    灌水之王

    发表于 2024-4-19 18:50:36 | 显示全部楼层 |阅读模式
    调式模式时按F8会进入公共事件调式,
    若调用公共事件会强制停止地图上的事件。
    (注释仅是随便加了一点 -_-|| )
    范例:
    脚本:
    1. #  ◆ 公共事件调式系统 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在线咨询功能删除,谢谢。

    本帖子中包含更多资源

    您需要 登录 才可以下载或查看,没有账号?立即注册

    x
    天天去同能,天天有童年!
    回复 送礼论坛版权

    使用道具 举报

    文明发言,和谐互动
    文明发言,和谐互动
    高级模式
    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    关闭

    幸运抽奖

    社区每日抽奖来袭,快来试试你是欧皇还是非酋~

    立即查看

    聊天机器人
    Loading...

    QQ|Archiver|手机版|小黑屋|同能RPG制作大师 ( 沪ICP备12027754号-3 )

    GMT+8, 2025-3-15 04:32 , Processed in 0.114175 second(s), 55 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

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