设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 3069|回复: 10
打印 上一主题 下一主题

[已经过期] 关于角色

[复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
35 小时
注册时间
2014-3-27
帖子
52
跳转到指定楼层
1
发表于 2014-4-26 08:56:26 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有帐号?注册会员

x
如何判断角色面前是否有事件?

Lv2.观梦者

梦石
0
星屑
324
在线时间
890 小时
注册时间
2009-10-12
帖子
1829
2
发表于 2014-4-26 09:22:36 | 只看该作者
你是不是想问:
如果角色面前有事件,就触发事件。。。这样的话就是与主角接触即可

如果不是触发,另议
回复 支持 反对

使用道具 举报

Lv5.捕梦者

梦石
0
星屑
33131
在线时间
5105 小时
注册时间
2012-11-19
帖子
4878

开拓者

3
发表于 2014-4-27 08:33:05 | 只看该作者
  1. #==============================================================================
  2. case $game_player.direction   # 角色朝向分支判断。
  3. when 2                        # 向下。
  4.   a_x = $game_player.x        # 获取角色面前坐标(a_x, a_y)。
  5.   a_y = $game_player.y + 1
  6. when 4                        #向左
  7.   a_x = $game_player.x - 1
  8.   a_y = $game_player.y
  9. when 6                        #向右
  10.   a_x = $game_player.x + 1
  11.   a_y = $game_player.y
  12. when 8                        #向上
  13.   a_x = $game_player.x
  14.   a_y = $game_player.y - 1
  15. end
  16. for i in $game_map.events.keys  #循环全部地图事件。
  17.   event = $game_map.events[i]
  18.   # 如果有事件的坐标等于角色面前坐标,返回 true 。
  19.   return true if event.x == a_x and event.y == a_y
  20. end
  21. return false  # 返回 false 。
  22. #==============================================================================
复制代码
xp vx va mv  va mz 各类型脚本/插件定制
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
35 小时
注册时间
2014-3-27
帖子
52
4
 楼主| 发表于 2014-4-27 09:05:12 | 只看该作者
芯☆淡茹水 发表于 2014-4-27 08:33

那怎么使用呢?我想要的是先判断角色前方是否有事件,如果有的话,并且事件的名称=npc,或者事件里面的注释=npc,然后启动对话。如果不=npc,那么就显示文章,面前没有人。求求你了,帮忙帮到底,谢谢。

点评

哦哦  发表于 2014-4-27 10:56
留QQ是违反版规的,请注意。  发表于 2014-4-27 10:33
那你加一下我QQ呗:1711044261,到时候好联系啊  发表于 2014-4-27 10:05
最近较忙,正准备一个 ARPG 系统。大概过了 5月10号 比较有空吧。  发表于 2014-4-27 10:03
回复 支持 反对

使用道具 举报

Lv5.捕梦者

梦石
0
星屑
33131
在线时间
5105 小时
注册时间
2012-11-19
帖子
4878

开拓者

5
发表于 2014-4-27 09:50:27 | 只看该作者
范例:
Project1.zip (202.49 KB, 下载次数: 45)

点评

我是想把这个功能写在菜单里的  发表于 2014-4-27 09:57
我是想把这个功能写在菜单里的  发表于 2014-4-27 09:56
可是问题还没有完全解决,你加我QQ吧:1711044261  发表于 2014-4-27 09:56
真棒,谢谢啊。  发表于 2014-4-27 09:53
xp vx va mv  va mz 各类型脚本/插件定制
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
35 小时
注册时间
2014-3-27
帖子
52
6
 楼主| 发表于 2014-4-27 10:00:01 | 只看该作者

点评

请勿连贴,善用编辑。  发表于 2014-4-27 10:34
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
35 小时
注册时间
2014-3-27
帖子
52
7
 楼主| 发表于 2014-4-27 10:08:50 | 只看该作者
  1. when 0  # 对话
  2.         $game_system.se_play($data_system.decision_se)
  3.         
  4.         $scene = Scene_Map.new
复制代码
中间应该怎么写?

点评

不太会用论坛....  发表于 2014-4-27 10:42
.....  发表于 2014-4-27 10:41
你不用回复功能的话,芯大是看不见的。。  发表于 2014-4-27 10:34
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
35 小时
注册时间
2014-3-27
帖子
52
8
 楼主| 发表于 2014-4-27 10:42:20 | 只看该作者
芯☆淡茹水 发表于 2014-4-27 09:50
范例:


when 0  # 对话
        $game_system.se_play($data_system.decision_se)
        
        $scene = Scene_Map.new
复制代码
中间应该怎么写?

点评

最好把整个菜单脚本发出来。  发表于 2014-4-27 10:47
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
35 小时
注册时间
2014-3-27
帖子
52
9
 楼主| 发表于 2014-4-27 10:52:14 | 只看该作者
芯☆淡茹水 发表于 2014-4-27 09:50
范例:
  1. #==============================================================================
  2. # ■ Scene_菜单系统
  3. #------------------------------------------------------------------------------
  4. #  处理菜单画面的类。
  5. #==============================================================================

  6. class Scene_菜单系统
  7.   #--------------------------------------------------------------------------
  8.   # ● 初始化对像
  9.   #     menu_index : 命令光标的初期位置
  10.   #--------------------------------------------------------------------------
  11.   def initialize(menu_index = 0)
  12.     @menu_index = menu_index
  13.   end
  14.   #--------------------------------------------------------------------------
  15.   # ● 主处理
  16.   #--------------------------------------------------------------------------
  17.   def main
  18.     # 生成活动块
  19.     @spriteset = Spriteset_Map.new
  20.     # 生成命令窗口
  21.     s1 = "对话"
  22.     s2 = "乘降"
  23.     s3 = "强度"
  24.     s4 = "工具"
  25.     s5 = "装备"
  26.     s6 = "炮弹"
  27.     s7 = "调查"
  28.     s8 = "模式"
  29.     @command_window = Window_窗口命令.new(200, [s1, s2, s3, s4, s5, s6, s7, s8],2,35)
  30.     @command_window.index = 0

  31.     # 同伴人数为 0 的情况下
  32.     if $game_party.actors.size == 0
  33.       # 物品、特技、装备、状态无效化
  34.       @command_window.disable_item(0)
  35.       @command_window.disable_item(1)
  36.       @command_window.disable_item(2)
  37.       @command_window.disable_item(3)
  38.     end
  39.     # 生成金钱窗口
  40.     @gold_window = Window_Gold.new
  41.     @gold_window.x = 482
  42.     @gold_window.y = - 2
  43.     # 生成状态窗口
  44.     @status_window = Window_MenuStatus.new
  45.     @status_window.x = 186
  46.     @status_window.y = 312
  47.     # 生成地图名窗口
  48.     @mapname_window = Window_Mapname.new
  49.     @mapname_window.x = -2
  50.     @mapname_window.y = -2
  51.     # 执行过渡
  52.     Graphics.transition
  53.     # 主循环
  54.     loop do
  55.       # 刷新游戏画面
  56.       Graphics.update
  57.       # 刷新输入信息
  58.       Input.update
  59.       # 刷新画面
  60.       update
  61.       # 如果切换画面就中断循环
  62.       if $scene != self
  63.         if map_load_move_can? == false
  64.           $game_switches[19] = true
  65.         else
  66.           $game_switches[19] = false
  67.         end
  68.         break
  69.       end
  70.     end
  71.     # 准备过渡
  72.     Graphics.freeze
  73.     # 释放窗口
  74.     @command_window.dispose
  75.     @gold_window.dispose
  76.     @status_window.dispose
  77.     @mapname_window.dispose
  78.     @spriteset.dispose

  79.    

  80.   end
  81.   #--------------------------------------------------------------------------
  82.   # ● 刷新画面
  83.   #--------------------------------------------------------------------------
  84.   def update
  85.     # 刷新窗口
  86.     @command_window.update
  87.     @status_window.update
  88.     $game_player.update
  89.     # 命令窗口被激活的情况下: 调用 update_command
  90.     if @command_window.active
  91.       update_command
  92.       return
  93.     end
  94.     # 状态窗口被激活的情况下: 调用 update_status
  95.     if @status_window.active
  96.       update_status
  97.       return
  98.     end
  99.   end
  100.   #--------------------------------------------------------------------------
  101.   # ● 刷新画面 (命令窗口被激活的情况下)
  102.   #--------------------------------------------------------------------------
  103.   def update_command
  104.     # 按下 B 键的情况下
  105.     if Input.trigger?(Input::B)
  106.       # 演奏取消 SE
  107.       $game_system.se_play($data_system.cancel_se)
  108.       # 切换的地图画面
  109.       $scene = Scene_Map.new
  110.       return
  111.     end
  112.     # 按下 C 键的情况下
  113.     if Input.trigger?(Input::C)
  114.       # 同伴人数为 0、存档、游戏结束以外的场合
  115.       if $game_party.actors.size == 0 and @command_window.index < 4
  116.         # 演奏冻结 SE
  117.         $game_system.se_play($data_system.buzzer_se)
  118.         return
  119.       end
  120.       # 命令窗口的光标位置分支
  121.       case @command_window.index
  122.       when 0  # 对话
  123.         $game_system.se_play($data_system.decision_se)

  124.         $scene = Scene_Map.new
  125.       when 1  # 乘降
  126.         $game_system.se_play($data_system.decision_se)
  127.         $game_temp.common_event_id = 3
  128.         $scene = Scene_Map.new
  129.       when 2  # 强度
  130.         # 演奏确定 SE
  131.         $game_system.se_play($data_system.decision_se)
  132.         # 激活状态窗口
  133.          $scene = Scene_Status.new
  134.     #@status_window.index = 0
  135.       when 3  # 物品
  136.         # 演奏确定 SE
  137.         $game_system.se_play($data_system.decision_se)
  138.         # 切换到物品画面
  139.         $scene = Scene_Item.new
  140.         when 4  # 装备
  141.         # 演奏确定 SE
  142.         $game_system.se_play($data_system.decision_se)
  143.         # 激活状态窗口
  144.         @command_window.active = false
  145.         @status_window.active = true
  146.         @status_window.index = 0
  147.       when 5  # 特技
  148.         # 演奏确定 SE
  149.         $game_system.se_play($data_system.decision_se)
  150.         $game_temp.common_event_id = 4
  151.                
  152.       when 6  # 调查
  153.         $game_system.se_play($data_system.decision_se)
  154.         if check_event_trigger_here([0]) == true or check_event_trigger_there([0,1,2]) == true
  155.           check_event_trigger_here([0])
  156.           check_event_trigger_there([0,1,2])
  157.         else
  158.           if $game_switches[1] == false #开关控制
  159.             $game_player.animation_id = 93
  160.             $game_temp.message_text = "这里什么也没有。"
  161.           end
  162.         end
  163.         $scene = Scene_Map.new
  164.       when 7  # 系统
  165.         # 演奏确定 SE
  166.         
  167.         # 切换到游戏结束画面
  168.         $scene = Scene_End.new      
  169.       end
  170.       return
  171.     end
  172.   end
  173.   #-----------------------------------------------------------------------------
  174. def check_event_trigger_there(triggers)
  175.     @players[0].check_event_trigger_there(triggers)
  176.   end
  177.   #--------------------------------------------------------------------------
  178.   # ● 同位置的事件启动判定
  179.   #--------------------------------------------------------------------------
  180.   def check_event_trigger_here(triggers)
  181.     result = false
  182.     # 事件执行中的情况下
  183.     if $game_system.map_interpreter.running?
  184.       return result
  185.     end
  186.     # 全部事件的循环
  187.     for event in $game_map.events.values
  188.       # 事件坐标与目标一致的情况下
  189.       if event.x == $game_player.x and event.y == $game_player.y and triggers.include?(event.trigger)
  190.         # 跳跃中以外的情况下、启动判定是同位置的事件
  191.         if not event.jumping? and event.over_trigger?
  192.           event.start
  193.           result = true
  194.         end
  195.       end
  196.     end
  197.     return result
  198.   end
  199.   #--------------------------------------------------------------------------
  200.   # ● 正面事件的启动判定
  201.   #--------------------------------------------------------------------------
  202.   def check_event_trigger_there(triggers)
  203.     result = false
  204.     # 事件执行中的情况下
  205.     if $game_system.map_interpreter.running?
  206.       return result
  207.     end
  208.     # 计算正面坐标
  209.     new_x = $game_player.x  + ($game_player.direction == 6 ? 1 : $game_player.direction == 4 ? -1 : 0)
  210.     new_y = $game_player.y + ($game_player.direction == 2 ? 1 : $game_player.direction == 8 ? -1 : 0)
  211.     # 全部事件的循环
  212.     for event in $game_map.events.values
  213.       # 事件坐标与目标一致的情况下
  214.       if event.x == new_x and event.y == new_y and
  215.          triggers.include?(event.trigger)
  216.         # 跳跃中以外的情况下、启动判定是正面的事件
  217.         if not event.jumping? and not event.over_trigger?
  218.           event.start
  219.           result = true
  220.         end
  221.       end
  222.     end
  223.     # 找不到符合条件的事件的情况下
  224.     if result == false
  225.       # 正面的元件是计数器的情况下
  226.       if $game_map.counter?(new_x, new_y)
  227.         # 计算 1 元件里侧的坐标
  228.         new_x += ($game_player.direction == 6 ? 1 : $game_player.direction == 4 ? -1 : 0)
  229.         new_y += ($game_player.direction == 2 ? 1 : $game_player.direction == 8 ? -1 : 0)
  230.         # 全事件的循环
  231.         for event in $game_map.events.values
  232.           # 事件坐标与目标一致的情况下
  233.           if event.x == new_x and event.y == new_y and
  234.              triggers.include?(event.trigger)
  235.             # 跳跃中以外的情况下、启动判定是正面的事件
  236.             if not event.jumping? and not event.over_trigger?
  237.               event.start
  238.               result = true
  239.             end
  240.           end
  241.         end
  242.       end
  243.     end
  244.     return result
  245.   end
  246.   #--------------------------------------------------------------------------
  247.   # ● 刷新画面 (状态窗口被激活的情况下)
  248.   #--------------------------------------------------------------------------
  249.   def update_status
  250.     # 按下 B 键的情况下
  251.     if Input.trigger?(Input::B)
  252.       # 演奏取消 SE
  253.       $game_system.se_play($data_system.cancel_se)
  254.       # 激活命令窗口
  255.       @command_window.active = true
  256.       @status_window.active = false
  257.       @status_window.index = -1
  258.       return
  259.     end
  260.     # 按下 C 键的情况下
  261.     if Input.trigger?(Input::C)
  262.       # 命令窗口的光标位置分支
  263.       case @command_window.index
  264.       when 5  # 特技
  265.         # 本角色的行动限制在 2 以上的情况下
  266.         if $game_party.actors[@status_window.index].restriction >= 2
  267.           # 演奏冻结 SE
  268.           $game_system.se_play($data_system.buzzer_se)
  269.           return
  270.         end
  271.         # 演奏确定 SE
  272.         $game_system.se_play($data_system.decision_se)
  273.         # 切换到特技画面
  274.         $scene = Scene_Skill.new(@status_window.index)
  275.       when 4  # 装备
  276.         # 演奏确定 SE
  277.         $game_system.se_play($data_system.decision_se)
  278.         # 切换的装备画面
  279.         $scene = Scene_Equip.new(@status_window.index)
  280.       when 2  # 状态
  281.         # 演奏确定 SE
  282.         $game_system.se_play($data_system.decision_se)
  283.         # 切换到状态画面
  284.         $scene = Scene_Status.new(@status_window.index)
  285.       end
  286.       return
  287.     end
  288.   end
  289.   #--------------------------------------------------------------------------
  290.   # ● 是否超重判定
  291.   #--------------------------------------------------------------------------
  292.   def map_load_move_can?
  293.     # 主人公乘车载重判定
  294.     if $game_variables[41] > 0
  295.       weight = 0
  296.       load = 0
  297.       actor = $game_actors[$game_variables[41] + 20]
  298.       return false if actor.hp == 0
  299.       if actor.weapon_id >= 1
  300.         weight += $data_weapons[actor.weapon_id + 2].agi_plus if $data_weapons[actor.weapon_id].atk != 0
  301.         weight += $data_weapons[actor.weapon_id + 1].agi_plus if $data_weapons[actor.weapon_id].atk == 0
  302.       end
  303.       if actor.armor1_id >= 1
  304.         weight += $data_armors[actor.armor1_id + 2].agi_plus if $data_armors[actor.armor1_id].str_plus != 0
  305.         weight += $data_armors[actor.armor1_id + 1].agi_plus if $data_armors[actor.armor1_id].str_plus == 0
  306.       end
  307.       if actor.armor2_id >= 1
  308.         weight += $data_armors[actor.armor2_id + 2].agi_plus if $data_armors[actor.armor2_id].int_plus != 0
  309.         weight += $data_armors[actor.armor2_id + 1].agi_plus if $data_armors[actor.armor2_id].int_plus == 0
  310.       end
  311.       if actor.armor4_id >= 1
  312.         load += $data_armors[actor.armor4_id + 2].agi_plus if $data_armors[actor.armor4_id].eva != 0
  313.         load += $data_armors[actor.armor4_id + 1].agi_plus if $data_armors[actor.armor4_id].eva == 0
  314.       else
  315.         return false
  316.       end
  317.       if actor.armor3_id >= 1
  318.         weight += $data_armors[actor.armor3_id + 2].agi_plus if $data_armors[actor.armor3_id].dex_plus != 0
  319.         weight += $data_armors[actor.armor3_id + 1].agi_plus if $data_armors[actor.armor3_id].dex_plus == 0
  320.       else
  321.         return false
  322.       end
  323.       if actor.armor5_id >= 1
  324.         weight += $data_armors[actor.armor5_id + 1].agi_plus
  325.       end
  326.       weight += $game_actors[actor.id + 50].agi
  327.       load *= 10
  328.       weight *= 10
  329.       weight += actor.hp - $game_actors[actor.id + 50].maxhp if actor.hp >= $game_actors[actor.id + 50].maxhp
  330.       a = load - weight
  331.       return false if a < 0
  332.     end
  333.     # 二号位置乘车载重判定
  334.     if $game_variables[42] > 0 and $game_variables[11] > 0
  335.       actor = $game_actors[$game_variables[42] + 20]
  336.       weight = 0
  337.       load = 0
  338.       return false if actor.hp == 0
  339.       if actor.weapon_id >= 1
  340.         weight += $data_weapons[actor.weapon_id + 2].agi_plus if $data_weapons[actor.weapon_id].atk != 0
  341.         weight += $data_weapons[actor.weapon_id + 1].agi_plus if $data_weapons[actor.weapon_id].atk == 0
  342.       end
  343.       if actor.armor1_id >= 1
  344.         weight += $data_armors[actor.armor1_id + 2].agi_plus if $data_armors[actor.armor1_id].str_plus != 0
  345.         weight += $data_armors[actor.armor1_id + 1].agi_plus if $data_armors[actor.armor1_id].str_plus == 0
  346.       end
  347.       if actor.armor2_id >= 1
  348.         weight += $data_armors[actor.armor2_id + 2].agi_plus if $data_armors[actor.armor2_id].int_plus != 0
  349.         weight += $data_armors[actor.armor2_id + 1].agi_plus if $data_armors[actor.armor2_id].int_plus == 0
  350.       end
  351.       if actor.armor4_id >= 1
  352.         load += $data_armors[actor.armor4_id + 2].agi_plus if $data_armors[actor.armor4_id].eva != 0
  353.         load += $data_armors[actor.armor4_id + 1].agi_plus if $data_armors[actor.armor4_id].eva == 0
  354.       else
  355.         return false
  356.       end
  357.       if actor.armor3_id >= 1
  358.         weight += $data_armors[actor.armor3_id + 2].agi_plus if $data_armors[actor.armor3_id].dex_plus != 0
  359.         weight += $data_armors[actor.armor3_id + 1].agi_plus if $data_armors[actor.armor3_id].dex_plus == 0
  360.       else
  361.         return false
  362.       end
  363.       if actor.armor5_id >= 1
  364.         weight += $data_armors[actor.armor5_id + 1].agi_plus
  365.       end
  366.       weight += $game_actors[actor.id + 50].agi
  367.       load *= 10
  368.       weight *= 10
  369.       weight += actor.hp - $game_actors[actor.id + 50].maxhp if actor.hp >= $game_actors[actor.id + 50].maxhp
  370.       a = load - weight
  371.       return false if a < 0
  372.     end
  373.     # 三号位置乘车载重判定
  374.     if $game_variables[43] > 0 and $game_variables[12] > 0
  375.       actor = $game_actors[$game_variables[43] + 20]
  376.       weight = 0
  377.       load = 0
  378.       return false if actor.hp == 0
  379.       if actor.weapon_id >= 1
  380.         weight += $data_weapons[actor.weapon_id + 2].agi_plus if $data_weapons[actor.weapon_id].atk != 0
  381.         weight += $data_weapons[actor.weapon_id + 1].agi_plus if $data_weapons[actor.weapon_id].atk == 0
  382.       end
  383.       if actor.armor1_id >= 1
  384.         weight += $data_armors[actor.armor1_id + 2].agi_plus if $data_armors[actor.armor1_id].str_plus != 0
  385.         weight += $data_armors[actor.armor1_id + 1].agi_plus if $data_armors[actor.armor1_id].str_plus == 0
  386.       end
  387.       if actor.armor2_id >= 1
  388.         weight += $data_armors[actor.armor2_id + 2].agi_plus if $data_armors[actor.armor2_id].int_plus != 0
  389.         weight += $data_armors[actor.armor2_id + 1].agi_plus if $data_armors[actor.armor2_id].int_plus == 0
  390.       end
  391.       if actor.armor4_id >= 1
  392.         load += $data_armors[actor.armor4_id + 2].agi_plus if $data_armors[actor.armor4_id].eva != 0
  393.         load += $data_armors[actor.armor4_id + 1].agi_plus if $data_armors[actor.armor4_id].eva == 0
  394.       else
  395.         return false
  396.       end
  397.       if actor.armor3_id >= 1
  398.         weight += $data_armors[actor.armor3_id + 2].agi_plus if $data_armors[actor.armor3_id].dex_plus != 0
  399.         weight += $data_armors[actor.armor3_id + 1].agi_plus if $data_armors[actor.armor3_id].dex_plus == 0
  400.       else
  401.         return false
  402.       end
  403.       if actor.armor5_id >= 1
  404.         weight += $data_armors[actor.armor5_id + 1].agi_plus
  405.       end
  406.       weight += $game_actors[actor.id + 50].agi
  407.       load *= 10
  408.       weight *= 10
  409.       weight += actor.hp - $game_actors[actor.id + 50].maxhp if actor.hp >= $game_actors[actor.id + 50].maxhp
  410.       a = load - weight
  411.       return false if a < 0
  412.     end
  413.     return true
  414.   end
  415. end
复制代码
回复 支持 反对

使用道具 举报

Lv5.捕梦者

梦石
0
星屑
33131
在线时间
5105 小时
注册时间
2012-11-19
帖子
4878

开拓者

10
发表于 2014-4-27 11:01:11 | 只看该作者
由于没有其他脚本,不能测试,只能估摸着改
  1. #==============================================================================
  2. # ■ Scene_菜单系统
  3. #------------------------------------------------------------------------------
  4. #  处理菜单画面的类。
  5. #==============================================================================

  6. class Scene_菜单系统
  7.   #--------------------------------------------------------------------------
  8.   # ● 初始化对像
  9.   #     menu_index : 命令光标的初期位置
  10.   #--------------------------------------------------------------------------
  11.   def initialize(menu_index = 0)
  12.     @menu_index = menu_index
  13.   end
  14.   #--------------------------------------------------------------------------
  15.   # ● 主处理
  16.   #--------------------------------------------------------------------------
  17.   def main
  18.     # 生成活动块
  19.     @spriteset = Spriteset_Map.new
  20.     # 生成命令窗口
  21.     s1 = "对话"
  22.     s2 = "乘降"
  23.     s3 = "强度"
  24.     s4 = "工具"
  25.     s5 = "装备"
  26.     s6 = "炮弹"
  27.     s7 = "调查"
  28.     s8 = "模式"
  29.     @command_window = Window_窗口命令.new(200, [s1, s2, s3, s4, s5, s6, s7, s8],2,35)
  30.     @command_window.index = 0

  31.     # 同伴人数为 0 的情况下
  32.     if $game_party.actors.size == 0
  33.       # 物品、特技、装备、状态无效化
  34.       @command_window.disable_item(0)
  35.       @command_window.disable_item(1)
  36.       @command_window.disable_item(2)
  37.       @command_window.disable_item(3)
  38.     end
  39.     # 生成金钱窗口
  40.     @gold_window = Window_Gold.new
  41.     @gold_window.x = 482
  42.     @gold_window.y = - 2
  43.     # 生成状态窗口
  44.     @status_window = Window_MenuStatus.new
  45.     @status_window.x = 186
  46.     @status_window.y = 312
  47.     # 生成地图名窗口
  48.     @mapname_window = Window_Mapname.new
  49.     @mapname_window.x = -2
  50.     @mapname_window.y = -2
  51.     # 执行过渡
  52.     Graphics.transition
  53.     # 主循环
  54.     loop do
  55.       # 刷新游戏画面
  56.       Graphics.update
  57.       # 刷新输入信息
  58.       Input.update
  59.       # 刷新画面
  60.       update
  61.       # 如果切换画面就中断循环
  62.       if $scene != self
  63.         if map_load_move_can? == false
  64.           $game_switches[19] = true
  65.         else
  66.           $game_switches[19] = false
  67.         end
  68.         break
  69.       end
  70.     end
  71.     # 准备过渡
  72.     Graphics.freeze
  73.     # 释放窗口
  74.     @command_window.dispose
  75.     @gold_window.dispose
  76.     @status_window.dispose
  77.     @mapname_window.dispose
  78.     @spriteset.dispose

  79.    

  80.   end
  81.   #--------------------------------------------------------------------------
  82.   # ● 刷新画面
  83.   #--------------------------------------------------------------------------
  84.   def update
  85.     # 刷新窗口
  86.     @command_window.update
  87.     @status_window.update
  88.     $game_player.update
  89.     # 命令窗口被激活的情况下: 调用 update_command
  90.     if @command_window.active
  91.       update_command
  92.       return
  93.     end
  94.     # 状态窗口被激活的情况下: 调用 update_status
  95.     if @status_window.active
  96.       update_status
  97.       return
  98.     end
  99.   end
  100.   #--------------------------------------------------------------------------
  101.   # ● 刷新画面 (命令窗口被激活的情况下)
  102.   #--------------------------------------------------------------------------
  103.   def update_command
  104.     # 按下 B 键的情况下
  105.     if Input.trigger?(Input::B)
  106.       # 演奏取消 SE
  107.       $game_system.se_play($data_system.cancel_se)
  108.       # 切换的地图画面
  109.       $scene = Scene_Map.new
  110.       return
  111.     end
  112.     # 按下 C 键的情况下
  113.     if Input.trigger?(Input::C)
  114.       # 同伴人数为 0、存档、游戏结束以外的场合
  115.       if $game_party.actors.size == 0 and @command_window.index < 4
  116.         # 演奏冻结 SE
  117.         $game_system.se_play($data_system.buzzer_se)
  118.         return
  119.       end
  120.       # 命令窗口的光标位置分支
  121.       case @command_window.index
  122.       when 0  # 对话
  123.         $game_system.se_play($data_system.decision_se)
  124.         check_event_trigger_here([0])
  125.         check_event_trigger_there([0,1,2])
  126.         $scene = Scene_Map.new
  127.       when 1  # 乘降
  128.         $game_system.se_play($data_system.decision_se)
  129.         $game_temp.common_event_id = 3
  130.         $scene = Scene_Map.new
  131.       when 2  # 强度
  132.         # 演奏确定 SE
  133.         $game_system.se_play($data_system.decision_se)
  134.         # 激活状态窗口
  135.          $scene = Scene_Status.new
  136.     #@status_window.index = 0
  137.       when 3  # 物品
  138.         # 演奏确定 SE
  139.         $game_system.se_play($data_system.decision_se)
  140.         # 切换到物品画面
  141.         $scene = Scene_Item.new
  142.         when 4  # 装备
  143.         # 演奏确定 SE
  144.         $game_system.se_play($data_system.decision_se)
  145.         # 激活状态窗口
  146.         @command_window.active = false
  147.         @status_window.active = true
  148.         @status_window.index = 0
  149.       when 5  # 特技
  150.         # 演奏确定 SE
  151.         $game_system.se_play($data_system.decision_se)
  152.         $game_temp.common_event_id = 4
  153.                
  154.       when 6  # 调查
  155.         $game_system.se_play($data_system.decision_se)
  156.         if check_event_trigger_here([0]) == true or check_event_trigger_there([0,1,2]) == true
  157.           check_event_trigger_here([0])
  158.           check_event_trigger_there([0,1,2])
  159.         else
  160.           if $game_switches[1] == false #开关控制
  161.             $game_player.animation_id = 93
  162.             $game_temp.message_text = "这里什么也没有。"
  163.           end
  164.         end
  165.         $scene = Scene_Map.new
  166.       when 7  # 系统
  167.         # 演奏确定 SE
  168.         
  169.         # 切换到游戏结束画面
  170.         $scene = Scene_End.new      
  171.       end
  172.       return
  173.     end
  174.   end
  175.   #-----------------------------------------------------------------------------
  176. def check_event_trigger_there(triggers)
  177.     @players[0].check_event_trigger_there(triggers)
  178.   end
  179.   #--------------------------------------------------------------------------
  180.   # ● 同位置的事件启动判定
  181.   #--------------------------------------------------------------------------
  182.   def check_event_trigger_here(triggers)
  183.     result = false
  184.     # 事件执行中的情况下
  185.     if $game_system.map_interpreter.running?
  186.       return result
  187.     end
  188.     # 全部事件的循环
  189.     for event in $game_map.events.values
  190.       # 事件坐标与目标一致的情况下
  191.       if event.x == $game_player.x and event.y == $game_player.y and triggers.include?(event.trigger)
  192.         # 跳跃中以外的情况下、启动判定是同位置的事件
  193.         if not event.jumping? and event.over_trigger? and event.is_npc?
  194.           event.start
  195.           result = true
  196.         end
  197.       end
  198.     end
  199.     $game_temp.message_text = "面前没有人!" unless result
  200.     return result
  201.   end
  202.   #--------------------------------------------------------------------------
  203.   # ● 正面事件的启动判定
  204.   #--------------------------------------------------------------------------
  205.   def check_event_trigger_there(triggers)
  206.     result = false
  207.     # 事件执行中的情况下
  208.     if $game_system.map_interpreter.running?
  209.       return result
  210.     end
  211.     # 计算正面坐标
  212.     new_x = $game_player.x  + ($game_player.direction == 6 ? 1 : $game_player.direction == 4 ? -1 : 0)
  213.     new_y = $game_player.y + ($game_player.direction == 2 ? 1 : $game_player.direction == 8 ? -1 : 0)
  214.     # 全部事件的循环
  215.     for event in $game_map.events.values
  216.       # 事件坐标与目标一致的情况下
  217.       if event.x == new_x and event.y == new_y and
  218.          triggers.include?(event.trigger)
  219.         # 跳跃中以外的情况下、启动判定是正面的事件
  220.         if not event.jumping? and not event.over_trigger? and event.is_npc?
  221.           event.start
  222.           result = true
  223.         end
  224.       end
  225.     end
  226.     # 找不到符合条件的事件的情况下
  227.     if result == false
  228.       # 正面的元件是计数器的情况下
  229.       if $game_map.counter?(new_x, new_y)
  230.         # 计算 1 元件里侧的坐标
  231.         new_x += ($game_player.direction == 6 ? 1 : $game_player.direction == 4 ? -1 : 0)
  232.         new_y += ($game_player.direction == 2 ? 1 : $game_player.direction == 8 ? -1 : 0)
  233.         # 全事件的循环
  234.         for event in $game_map.events.values
  235.           # 事件坐标与目标一致的情况下
  236.           if event.x == new_x and event.y == new_y and
  237.              triggers.include?(event.trigger)
  238.             # 跳跃中以外的情况下、启动判定是正面的事件
  239.             if not event.jumping? and not event.over_trigger? and event.is_npc?
  240.               event.start
  241.               result = true
  242.             end
  243.           end
  244.         end
  245.       end
  246.     end
  247.     $game_temp.message_text = "面前没有人!" unless result
  248.     return result
  249.   end
  250.   #--------------------------------------------------------------------------
  251.   # ● 刷新画面 (状态窗口被激活的情况下)
  252.   #--------------------------------------------------------------------------
  253.   def update_status
  254.     # 按下 B 键的情况下
  255.     if Input.trigger?(Input::B)
  256.       # 演奏取消 SE
  257.       $game_system.se_play($data_system.cancel_se)
  258.       # 激活命令窗口
  259.       @command_window.active = true
  260.       @status_window.active = false
  261.       @status_window.index = -1
  262.       return
  263.     end
  264.     # 按下 C 键的情况下
  265.     if Input.trigger?(Input::C)
  266.       # 命令窗口的光标位置分支
  267.       case @command_window.index
  268.       when 5  # 特技
  269.         # 本角色的行动限制在 2 以上的情况下
  270.         if $game_party.actors[@status_window.index].restriction >= 2
  271.           # 演奏冻结 SE
  272.           $game_system.se_play($data_system.buzzer_se)
  273.           return
  274.         end
  275.         # 演奏确定 SE
  276.         $game_system.se_play($data_system.decision_se)
  277.         # 切换到特技画面
  278.         $scene = Scene_Skill.new(@status_window.index)
  279.       when 4  # 装备
  280.         # 演奏确定 SE
  281.         $game_system.se_play($data_system.decision_se)
  282.         # 切换的装备画面
  283.         $scene = Scene_Equip.new(@status_window.index)
  284.       when 2  # 状态
  285.         # 演奏确定 SE
  286.         $game_system.se_play($data_system.decision_se)
  287.         # 切换到状态画面
  288.         $scene = Scene_Status.new(@status_window.index)
  289.       end
  290.       return
  291.     end
  292.   end
  293.   #--------------------------------------------------------------------------
  294.   # ● 是否超重判定
  295.   #--------------------------------------------------------------------------
  296.   def map_load_move_can?
  297.     # 主人公乘车载重判定
  298.     if $game_variables[41] > 0
  299.       weight = 0
  300.       load = 0
  301.       actor = $game_actors[$game_variables[41] + 20]
  302.       return false if actor.hp == 0
  303.       if actor.weapon_id >= 1
  304.         weight += $data_weapons[actor.weapon_id + 2].agi_plus if $data_weapons[actor.weapon_id].atk != 0
  305.         weight += $data_weapons[actor.weapon_id + 1].agi_plus if $data_weapons[actor.weapon_id].atk == 0
  306.       end
  307.       if actor.armor1_id >= 1
  308.         weight += $data_armors[actor.armor1_id + 2].agi_plus if $data_armors[actor.armor1_id].str_plus != 0
  309.         weight += $data_armors[actor.armor1_id + 1].agi_plus if $data_armors[actor.armor1_id].str_plus == 0
  310.       end
  311.       if actor.armor2_id >= 1
  312.         weight += $data_armors[actor.armor2_id + 2].agi_plus if $data_armors[actor.armor2_id].int_plus != 0
  313.         weight += $data_armors[actor.armor2_id + 1].agi_plus if $data_armors[actor.armor2_id].int_plus == 0
  314.       end
  315.       if actor.armor4_id >= 1
  316.         load += $data_armors[actor.armor4_id + 2].agi_plus if $data_armors[actor.armor4_id].eva != 0
  317.         load += $data_armors[actor.armor4_id + 1].agi_plus if $data_armors[actor.armor4_id].eva == 0
  318.       else
  319.         return false
  320.       end
  321.       if actor.armor3_id >= 1
  322.         weight += $data_armors[actor.armor3_id + 2].agi_plus if $data_armors[actor.armor3_id].dex_plus != 0
  323.         weight += $data_armors[actor.armor3_id + 1].agi_plus if $data_armors[actor.armor3_id].dex_plus == 0
  324.       else
  325.         return false
  326.       end
  327.       if actor.armor5_id >= 1
  328.         weight += $data_armors[actor.armor5_id + 1].agi_plus
  329.       end
  330.       weight += $game_actors[actor.id + 50].agi
  331.       load *= 10
  332.       weight *= 10
  333.       weight += actor.hp - $game_actors[actor.id + 50].maxhp if actor.hp >= $game_actors[actor.id + 50].maxhp
  334.       a = load - weight
  335.       return false if a < 0
  336.     end
  337.     # 二号位置乘车载重判定
  338.     if $game_variables[42] > 0 and $game_variables[11] > 0
  339.       actor = $game_actors[$game_variables[42] + 20]
  340.       weight = 0
  341.       load = 0
  342.       return false if actor.hp == 0
  343.       if actor.weapon_id >= 1
  344.         weight += $data_weapons[actor.weapon_id + 2].agi_plus if $data_weapons[actor.weapon_id].atk != 0
  345.         weight += $data_weapons[actor.weapon_id + 1].agi_plus if $data_weapons[actor.weapon_id].atk == 0
  346.       end
  347.       if actor.armor1_id >= 1
  348.         weight += $data_armors[actor.armor1_id + 2].agi_plus if $data_armors[actor.armor1_id].str_plus != 0
  349.         weight += $data_armors[actor.armor1_id + 1].agi_plus if $data_armors[actor.armor1_id].str_plus == 0
  350.       end
  351.       if actor.armor2_id >= 1
  352.         weight += $data_armors[actor.armor2_id + 2].agi_plus if $data_armors[actor.armor2_id].int_plus != 0
  353.         weight += $data_armors[actor.armor2_id + 1].agi_plus if $data_armors[actor.armor2_id].int_plus == 0
  354.       end
  355.       if actor.armor4_id >= 1
  356.         load += $data_armors[actor.armor4_id + 2].agi_plus if $data_armors[actor.armor4_id].eva != 0
  357.         load += $data_armors[actor.armor4_id + 1].agi_plus if $data_armors[actor.armor4_id].eva == 0
  358.       else
  359.         return false
  360.       end
  361.       if actor.armor3_id >= 1
  362.         weight += $data_armors[actor.armor3_id + 2].agi_plus if $data_armors[actor.armor3_id].dex_plus != 0
  363.         weight += $data_armors[actor.armor3_id + 1].agi_plus if $data_armors[actor.armor3_id].dex_plus == 0
  364.       else
  365.         return false
  366.       end
  367.       if actor.armor5_id >= 1
  368.         weight += $data_armors[actor.armor5_id + 1].agi_plus
  369.       end
  370.       weight += $game_actors[actor.id + 50].agi
  371.       load *= 10
  372.       weight *= 10
  373.       weight += actor.hp - $game_actors[actor.id + 50].maxhp if actor.hp >= $game_actors[actor.id + 50].maxhp
  374.       a = load - weight
  375.       return false if a < 0
  376.     end
  377.     # 三号位置乘车载重判定
  378.     if $game_variables[43] > 0 and $game_variables[12] > 0
  379.       actor = $game_actors[$game_variables[43] + 20]
  380.       weight = 0
  381.       load = 0
  382.       return false if actor.hp == 0
  383.       if actor.weapon_id >= 1
  384.         weight += $data_weapons[actor.weapon_id + 2].agi_plus if $data_weapons[actor.weapon_id].atk != 0
  385.         weight += $data_weapons[actor.weapon_id + 1].agi_plus if $data_weapons[actor.weapon_id].atk == 0
  386.       end
  387.       if actor.armor1_id >= 1
  388.         weight += $data_armors[actor.armor1_id + 2].agi_plus if $data_armors[actor.armor1_id].str_plus != 0
  389.         weight += $data_armors[actor.armor1_id + 1].agi_plus if $data_armors[actor.armor1_id].str_plus == 0
  390.       end
  391.       if actor.armor2_id >= 1
  392.         weight += $data_armors[actor.armor2_id + 2].agi_plus if $data_armors[actor.armor2_id].int_plus != 0
  393.         weight += $data_armors[actor.armor2_id + 1].agi_plus if $data_armors[actor.armor2_id].int_plus == 0
  394.       end
  395.       if actor.armor4_id >= 1
  396.         load += $data_armors[actor.armor4_id + 2].agi_plus if $data_armors[actor.armor4_id].eva != 0
  397.         load += $data_armors[actor.armor4_id + 1].agi_plus if $data_armors[actor.armor4_id].eva == 0
  398.       else
  399.         return false
  400.       end
  401.       if actor.armor3_id >= 1
  402.         weight += $data_armors[actor.armor3_id + 2].agi_plus if $data_armors[actor.armor3_id].dex_plus != 0
  403.         weight += $data_armors[actor.armor3_id + 1].agi_plus if $data_armors[actor.armor3_id].dex_plus == 0
  404.       else
  405.         return false
  406.       end
  407.       if actor.armor5_id >= 1
  408.         weight += $data_armors[actor.armor5_id + 1].agi_plus
  409.       end
  410.       weight += $game_actors[actor.id + 50].agi
  411.       load *= 10
  412.       weight *= 10
  413.       weight += actor.hp - $game_actors[actor.id + 50].maxhp if actor.hp >= $game_actors[actor.id + 50].maxhp
  414.       a = load - weight
  415.       return false if a < 0
  416.     end
  417.     return true
  418.   end
  419. end
  420. #==============================================================================
  421. class Game_Event < Game_Character
  422.   #--------------------------------------------------------------------------
  423.   def is_npc?
  424.     return true if @event.name == "npc"
  425.     return true if @list[0].code == 108 and @list[0].parameters[0] == "npc"
  426.     return false
  427.   end
  428. end
  429. #==============================================================================
复制代码
xp vx va mv  va mz 各类型脚本/插件定制
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-9-30 21:19

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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