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

Project1

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

[已经过期] 二刀流脚本突然出错。

[复制链接]

Lv3.寻梦者

梦石
0
星屑
3065
在线时间
1429 小时
注册时间
2009-7-27
帖子
1448
跳转到指定楼层
1
发表于 2020-6-3 20:38:41 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
就是这个二刀流脚本一直没错的,今天突然出错了。不知道哪里出了问题。
ssss.7z (190.13 KB, 下载次数: 33)

博客:我的博客

Lv3.寻梦者

梦石
0
星屑
2650
在线时间
383 小时
注册时间
2015-8-8
帖子
436

R考场第七期纪念奖

2
发表于 2020-6-3 22:14:27 | 只看该作者
这个是不是要配合“增加显示属性数量”脚本使用
错误原因就在尝试显示8种属性,但是系统内只有3种,改了两行代码就行了。

以下覆盖原脚本即可
  1. #在属性栏中创建或者修改一个属性的名字,命名为“二刀流”.
  2. #==============================================================================
  3. module Special_Settings
  4.   INJURY_VALUE = 1.5         #第二把武器伤害值
  5.   ACTIVE_ANIMATION = false  #第二把武器行 动方动画   是否显示
  6.   TARGET_ANIMATION = false  #第二把武器行 对象方动画  是否显示
  7. end

  8. class Special_Element
  9.   #--------------------------------------------------------------------------
  10.   # ● 定义特殊属性的常量
  11.   #--------------------------------------------------------------------------
  12.   TWO_WEAPONS = "二刀流"
  13.   #--------------------------------------------------------------------------
  14.   # ● 获取全部特殊属性
  15.   #--------------------------------------------------------------------------
  16.   def self.special_elements
  17.     # 列举所有特殊属性
  18.     elements = [
  19.       TWO_WEAPONS
  20.     ]
  21.     return elements
  22.   end

  23.   #--------------------------------------------------------------------------
  24.   # ● 从属性名获得该属性的ID
  25.   #--------------------------------------------------------------------------
  26.   def self.get_index(name)
  27.     return $data_system.elements.index(name)
  28.   end
  29.   
  30.   #--------------------------------------------------------------------------
  31.   # ● 获得匹配正则表达式的所有属性的ID和匹配信息
  32.   #     返回值:二维阵列[n][0]中的ID,[n][1]中的匹配信息(MatchData)
  33.   #--------------------------------------------------------------------------
  34.   def self.get_indices(regexp)
  35.     indices = []
  36.     for i in 1...$data_system.elements.size
  37.       indices.push([i, $~]) if regexp =~ $data_system.elements[i]
  38.     end
  39.   end
  40.   
  41.   #--------------------------------------------------------------------------
  42.   # ● 删除特殊属性
  43.   #     element_set     : 删除之前的属性ID排列
  44.   #     ignore_elements : 可用要删除的属性ID、名称、正则表达式指定
  45.   #     返回值          : 删除结果的属性ID排列
  46.   #--------------------------------------------------------------------------
  47.   def self.delete(element_set)
  48.     result = element_set.dup
  49.     for ignore in Special_Element::special_elements
  50.       case ignore
  51.       when Integer
  52.         result.delete(ignore)
  53.       when String
  54.         result.delete(Special_Element::get_index(ignore))
  55.       when Regexp
  56.         for i in result
  57.           result[i] = nil if ignore =~ $data_system.elements[result[i]]
  58.         end
  59.         result.delete(nil)
  60.       end
  61.     end
  62.     return result
  63.   end
  64. end

  65. class Game_Battler
  66.   #--------------------------------------------------------------------------
  67.   # ● 属性校正计算
  68.   #     element_set : 属性
  69.   #--------------------------------------------------------------------------
  70.   def elements_correct(element_set)
  71.     # --- 更改部分 ---
  72.     element_set = Special_Element::delete(element_set)
  73.     # --- 完成修改 ---
  74.     # 无属性的情况
  75.     if element_set == []
  76.       # 100 返回
  77.       return 100
  78.     end
  79.     # 返回给定的属性中最弱的属性
  80.     # ※方法element_rate是从该类继承的Game_Actor
  81.     #   以及Game_Enemy类中定义的
  82.     weakest = -100
  83.     for i in element_set
  84.       weakest = [weakest, self.element_rate(i)].max
  85.     end
  86.     return weakest
  87.   end
  88. end

  89. class Game_Actor < Game_Battler
  90.   #--------------------------------------------------------------------------
  91.   # ● 公开实例变量
  92.   #--------------------------------------------------------------------------
  93.   attr_reader   :name                     # 名前
  94.   attr_reader   :character_name           # 角色文件名
  95.   attr_reader   :character_hue            # 角色 色相
  96.   attr_reader   :class_id                 # 类别 ID
  97.   attr_reader   :weapon_id                # 武器 ID
  98.   # --- 从这里追加部分 ---
  99.   attr_reader   :weapon2_id               # 二刀流武器 ID
  100.   # --- 添加部分结束 ---
  101.   attr_reader   :armor1_id                # 盾 ID
  102.   attr_reader   :armor2_id                # 頭防具 ID
  103.   attr_reader   :armor3_id                # 体防具 ID
  104.   attr_reader   :armor4_id                # 装飾品 ID
  105.   attr_reader   :level                    # 级别
  106.   attr_reader   :exp                      # EXP
  107.   attr_reader   :skills                   # 技能

  108.   #--------------------------------------------------------------------------
  109.   # ● 设置
  110.   #     actor_id : 角色 ID
  111.   #--------------------------------------------------------------------------
  112.   def setup(actor_id)
  113.     actor = $data_actors[actor_id]
  114.     @actor_id = actor_id
  115.     @name = actor.name
  116.     @character_name = actor.character_name
  117.     @character_hue = actor.character_hue
  118.     @battler_name = actor.battler_name
  119.     @battler_hue = actor.battler_hue
  120.     @class_id = actor.class_id
  121.     @weapon_id = actor.weapon_id
  122.     # --- 从这里追加部分 ---
  123.     @weapon2_id = 0
  124.     @weapon2_id = 1 if actor_id ==1
  125.     # --- 添加部分结束 ---
  126.     @armor1_id = actor.armor1_id
  127.     @armor2_id = actor.armor2_id
  128.     @armor3_id = actor.armor3_id
  129.     @armor4_id = actor.armor4_id
  130.     @level = actor.initial_level
  131.     @exp_list = Array.new(101)
  132.     make_exp_list
  133.     @exp = @exp_list[@level]
  134.     @skills = []
  135.     @hp = maxhp
  136.     @sp = maxsp
  137.     @states = []
  138.     @states_turn = {}
  139.     @maxhp_plus = 0
  140.     @maxsp_plus = 0
  141.     @str_plus = 0
  142.     @dex_plus = 0
  143.     @agi_plus = 0
  144.     @int_plus = 0
  145.     # 技能学习
  146.     for i in 1..@level
  147.       for j in $data_classes[@class_id].learnings
  148.         if j.level == i
  149.           learn_skill(j.skill_id)
  150.         end
  151.       end
  152.     end
  153.     # 更新自动状态
  154.     update_auto_state(nil, $data_armors[@armor1_id])
  155.     update_auto_state(nil, $data_armors[@armor2_id])
  156.     update_auto_state(nil, $data_armors[@armor3_id])
  157.     update_auto_state(nil, $data_armors[@armor4_id])
  158.   end

  159.   #--------------------------------------------------------------------------
  160.   # ● 获取普通攻击属性
  161.   #--------------------------------------------------------------------------
  162.   def element_set
  163.     weapon = $data_weapons[@weapon_id]
  164.     # ---从这里开始变更部分---
  165.     weapon2 = $data_weapons[@weapon2_id]
  166.     result = []
  167.     result.concat(weapon.element_set) if weapon != nil
  168.     result.concat(weapon2.element_set) if weapon2 != nil
  169.     return result
  170.     # ---修改部分结束---
  171.   end
  172.   #--------------------------------------------------------------------------
  173.   # ● 获取普通攻击状态变化 (+)
  174.   #--------------------------------------------------------------------------
  175.   def plus_state_set
  176.     weapon = $data_weapons[@weapon_id]
  177.     # ---从这里开始变更部分---
  178.     weapon2 = $data_weapons[@weapon2_id]
  179.     result = []
  180.     result.concat(weapon.plus_state_set) if weapon != nil
  181.     result.concat(weapon2.plus_state_set) if weapon2 != nil
  182.     return result
  183.     # ---修改部分结束---
  184.   end
  185.   #--------------------------------------------------------------------------
  186.   # ●  获取普通攻击状态变化 (-)
  187.   #--------------------------------------------------------------------------
  188.   def minus_state_set
  189.     weapon = $data_weapons[@weapon_id]
  190.     # ---从这里开始变更部分---
  191.     weapon2 = $data_weapons[@weapon2_id]
  192.     result = []
  193.     result.concat(weapon.minus_state_set) if weapon != nil
  194.     result.concat(weapon2.minus_state_set) if weapon2 != nil
  195.     return result
  196.     # ---修改部分结束---
  197.   end

  198.   #--------------------------------------------------------------------------
  199.   # ● 获取基本力量
  200.   #--------------------------------------------------------------------------
  201.   def base_str
  202.     n = $data_actors[@actor_id].parameters[2, @level] #某个角色级别自身力量
  203.     weapon = $data_weapons[@weapon_id] #武器所含力量
  204.     armor1 = $data_armors[@armor1_id]  #防具1所含力量
  205.     armor2 = $data_armors[@armor2_id]  #防具2所含力量
  206.     armor3 = $data_armors[@armor3_id]  #防具3所含力量
  207.     armor4 = $data_armors[@armor4_id]  #防具4所含力量
  208.     # ---从这里开始追加部分---
  209.     weapon2 = $data_weapons[@weapon2_id]
  210.     # 就那样加在一起的话太强了所以试着减半的测试
  211.     n += weapon2 != nil ? weapon2.str_plus / Special_Settings::INJURY_VALUE : 0
  212.     # ---追加部分结束---
  213.     n += weapon != nil ? weapon.str_plus : 0
  214.     n += armor1 != nil ? armor1.str_plus : 0
  215.     n += armor2 != nil ? armor2.str_plus : 0
  216.     n += armor3 != nil ? armor3.str_plus : 0
  217.     n += armor4 != nil ? armor4.str_plus : 0
  218.     return [[n, 1].max, 999].min
  219.   end

  220.   #--------------------------------------------------------------------------
  221.   # ● 基本灵巧取得
  222.   #--------------------------------------------------------------------------
  223.   def base_dex
  224.     n = $data_actors[@actor_id].parameters[3, @level]
  225.     weapon = $data_weapons[@weapon_id]
  226.     armor1 = $data_armors[@armor1_id]
  227.     armor2 = $data_armors[@armor2_id]
  228.     armor3 = $data_armors[@armor3_id]
  229.     armor4 = $data_armors[@armor4_id]
  230.     # --- 从这里开始追加部分 ---
  231.     weapon2 = $data_weapons[@weapon2_id]
  232.     # 就那样加在一起的话太强了所以试着减半的测试
  233.     n += weapon2 != nil ? weapon2.dex_plus / Special_Settings::INJURY_VALUE : 0
  234.     # --- 追加部分结束 ---
  235.     n += weapon != nil ? weapon.dex_plus : 0
  236.     n += armor1 != nil ? armor1.dex_plus : 0
  237.     n += armor2 != nil ? armor2.dex_plus : 0
  238.     n += armor3 != nil ? armor3.dex_plus : 0
  239.     n += armor4 != nil ? armor4.dex_plus : 0
  240.     return [[n, 1].max, 999].min
  241.   end

  242.   #--------------------------------------------------------------------------
  243.   # ● 获取基本速度
  244.   #--------------------------------------------------------------------------
  245.   def base_agi
  246.     n = $data_actors[@actor_id].parameters[4, @level]
  247.     weapon = $data_weapons[@weapon_id]
  248.     armor1 = $data_armors[@armor1_id]
  249.     armor2 = $data_armors[@armor2_id]
  250.     armor3 = $data_armors[@armor3_id]
  251.     armor4 = $data_armors[@armor4_id]
  252.     # --- 从这里追加部分 ---
  253.     weapon2 = $data_weapons[@weapon2_id]
  254.     # 就那样加在一起的话太强了所以试着减半的测试
  255.     n += weapon2 != nil ? weapon2.agi_plus / Special_Settings::INJURY_VALUE : 0
  256.     # --- 添加部分结束 ---
  257.     n += weapon != nil ? weapon.agi_plus : 0
  258.     n += armor1 != nil ? armor1.agi_plus : 0
  259.     n += armor2 != nil ? armor2.agi_plus : 0
  260.     n += armor3 != nil ? armor3.agi_plus : 0
  261.     n += armor4 != nil ? armor4.agi_plus : 0
  262.     return [[n, 1].max, 999].min
  263.   end

  264.   #--------------------------------------------------------------------------
  265.   # ● 获取基本魔力
  266.   #--------------------------------------------------------------------------
  267.   def base_int
  268.     n = $data_actors[@actor_id].parameters[5, @level]
  269.     weapon = $data_weapons[@weapon_id]
  270.     armor1 = $data_armors[@armor1_id]
  271.     armor2 = $data_armors[@armor2_id]
  272.     armor3 = $data_armors[@armor3_id]
  273.     armor4 = $data_armors[@armor4_id]
  274.     # --- 从这里追加部分 ---
  275.     weapon2 = $data_weapons[@weapon2_id]
  276.     # 就那样加在一起的话太强了所以试着减半的测试
  277.     n += weapon2 != nil ? weapon2.int_plus / Special_Settings::INJURY_VALUE : 0
  278.     # --- 添加部分结束 ---
  279.     n += weapon != nil ? weapon.int_plus : 0
  280.     n += armor1 != nil ? armor1.int_plus : 0
  281.     n += armor2 != nil ? armor2.int_plus : 0
  282.     n += armor3 != nil ? armor3.int_plus : 0
  283.     n += armor4 != nil ? armor4.int_plus : 0
  284.     return [[n, 1].max, 999].min
  285.   end

  286.   #--------------------------------------------------------------------------
  287.   # ● 获取基本攻击力
  288.   #--------------------------------------------------------------------------
  289.   def base_atk
  290.     weapon = $data_weapons[@weapon_id]
  291.     # --- 更改部分 ---
  292.     weapon2 = $data_weapons[@weapon2_id]
  293.     # 就那样加在一起的话太强了所以试着减半的测试
  294.     n = weapon2 != nil ? weapon2.atk / 2:0 #Special_Settings::INJURY_VALUE : 0
  295.     return weapon != nil ? weapon.atk + n : n
  296.     # --- 完成修改 ---
  297.   end

  298.   #--------------------------------------------------------------------------
  299.   # ● 获取基本物理防御
  300.   #--------------------------------------------------------------------------
  301.   def base_pdef
  302.     weapon = $data_weapons[@weapon_id]
  303.     armor1 = $data_armors[@armor1_id]
  304.     armor2 = $data_armors[@armor2_id]
  305.     armor3 = $data_armors[@armor3_id]
  306.     armor4 = $data_armors[@armor4_id]
  307.     pdef1 = weapon != nil ? weapon.pdef : 0
  308.     pdef2 = armor1 != nil ? armor1.pdef : 0
  309.     pdef3 = armor2 != nil ? armor2.pdef : 0
  310.     pdef4 = armor3 != nil ? armor3.pdef : 0
  311.     pdef5 = armor4 != nil ? armor4.pdef : 0
  312.     # --- 从这里追加部分 ---
  313.     weapon2 = $data_weapons[@weapon2_id]
  314.     # 就那样加在一起的话太强了所以试着减半的测试
  315.     pdef1 += weapon2 != nil ? weapon2.pdef / Special_Settings::INJURY_VALUE : 0
  316.     # --- 添加部分结束 ---
  317.     return pdef1 + pdef2 + pdef3 + pdef4 + pdef5
  318.   end

  319.   #--------------------------------------------------------------------------
  320.   # ● 获取基本魔法防御
  321.   #--------------------------------------------------------------------------
  322.   def base_mdef
  323.     weapon = $data_weapons[@weapon_id]
  324.     armor1 = $data_armors[@armor1_id]
  325.     armor2 = $data_armors[@armor2_id]
  326.     armor3 = $data_armors[@armor3_id]
  327.     armor4 = $data_armors[@armor4_id]
  328.     mdef1 = weapon != nil ? weapon.mdef : 0
  329.     mdef2 = armor1 != nil ? armor1.mdef : 0
  330.     mdef3 = armor2 != nil ? armor2.mdef : 0
  331.     mdef4 = armor3 != nil ? armor3.mdef : 0
  332.     mdef5 = armor4 != nil ? armor4.mdef : 0
  333.     # --- 从这里追加部分 ---
  334.     weapon2 = $data_weapons[@weapon2_id]
  335.     # 就那样加在一起的话太强了所以试着减半的测试
  336.     mdef1 += weapon2 != nil ? weapon2.mdef / Special_Settings::INJURY_VALUE : 0
  337.     # --- 添加部分结束 ---
  338.     return mdef1 + mdef2 + mdef3 + mdef4 + mdef5
  339.   end

  340.   #--------------------------------------------------------------------------
  341.   # ● 普通攻击 获取攻击方动画 ID
  342.   #--------------------------------------------------------------------------
  343.   def animation1_id
  344.     weapon = $data_weapons[@weapon_id]
  345.     # --- 更改部分 ---
  346.     weapon2 = $data_weapons[@weapon2_id]
  347.     animations = []
  348.     animations.push(weapon.animation1_id) if weapon != nil
  349.     animations.push(weapon2.animation1_id) if weapon2 != nil and Special_Settings::ACTIVE_ANIMATION
  350.     animations.delete(0)
  351.     return animations.empty? ? 0 : animations
  352.     # --- 完成修改 ---
  353.   end

  354.   #--------------------------------------------------------------------------
  355.   # ● 普通攻击 获取对像方动画 ID
  356.   #--------------------------------------------------------------------------
  357.   def animation2_id
  358.     weapon = $data_weapons[@weapon_id]
  359.     # --- 更改部分 ---
  360.     weapon2 = $data_weapons[@weapon2_id]
  361.     animations = []
  362.     animations.push(weapon.animation2_id) if weapon != nil
  363.     animations.push(weapon2.animation2_id) if weapon2 != nil and Special_Settings::TARGET_ANIMATION
  364.     animations.delete(0)
  365.     return animations.empty? ? 0 : animations
  366.     # --- 完成修改 ---
  367.   end

  368.   #--------------------------------------------------------------------------
  369.   # ● 装备固定判定
  370.   #     equip_type : 装备类型(变更点:-1是二刀流的盾部分的武器
  371.   #     id    : 武器 or 防具 ID  (0 装备解除)
  372.   #--------------------------------------------------------------------------
  373.   def equip(equip_type, id)
  374.     case equip_type
  375.     when 0  # 武器
  376.       if id == 0 or $game_party.weapon_number(id) > 0
  377.         $game_party.gain_weapon(@weapon_id, 1)
  378.         @weapon_id = id
  379.         $game_party.lose_weapon(id, 1)
  380.         # --- 从这里追加部分 ---
  381.         # 装备不是二刀武器的东西,取下盾的部分二刀武器
  382.         if id != 0 and !$data_weapons[id].element_set.include?(Special_Element::get_index(Special_Element::TWO_WEAPONS))
  383.           $game_party.gain_weapon(@weapon2_id, 1)
  384.           @weapon2_id = 0
  385.         end
  386.         # --- 添加部分结束 ---
  387.       end
  388.     when 1  # 盾
  389.       if id == 0 or $game_party.armor_number(id) > 0
  390.         update_auto_state($data_armors[@armor1_id], $data_armors[id])
  391.         $game_party.gain_armor(@armor1_id, 1)
  392.         @armor1_id = id
  393.         $game_party.lose_armor(id, 1)
  394.         # --- 从这里追加部分 ---
  395.         # 装备二刀武器时取下
  396.         if id != 0
  397.           $game_party.gain_weapon(@weapon2_id, 1)
  398.           @weapon2_id = 0
  399.         end
  400.         # --- 添加部分结束 ---
  401.       end
  402.     when 2  # 頭
  403.       if id == 0 or $game_party.armor_number(id) > 0
  404.         update_auto_state($data_armors[@armor2_id], $data_armors[id])
  405.         $game_party.gain_armor(@armor2_id, 1)
  406.         @armor2_id = id
  407.         $game_party.lose_armor(id, 1)
  408.       end
  409.     when 3  # 身体
  410.       if id == 0 or $game_party.armor_number(id) > 0
  411.         update_auto_state($data_armors[@armor3_id], $data_armors[id])
  412.         $game_party.gain_armor(@armor3_id, 1)
  413.         @armor3_id = id
  414.         $game_party.lose_armor(id, 1)
  415.       end
  416.     when 4  # 装飾品
  417.       if id == 0 or $game_party.armor_number(id) > 0
  418.         update_auto_state($data_armors[@armor4_id], $data_armors[id])
  419.         $game_party.gain_armor(@armor4_id, 1)
  420.         @armor4_id = id
  421.         $game_party.lose_armor(id, 1)
  422.       end
  423.       # --- 从这里追加部分 ---
  424.     when -1 # 二刀流盾部分的武器
  425.       if id == 0 or $game_party.weapon_number(id) > 0
  426.         $game_party.gain_weapon(@weapon2_id, 1)
  427.         @weapon2_id = id
  428.         $game_party.lose_weapon(id, 1)
  429.         # 取下盾牌
  430.         $game_party.gain_armor(@armor1_id, 1)
  431.         @armor1_id = 0
  432.         # 已经装备的武器不是二刀武器的情况除外
  433.         if id != 0 and @weapon_id != 0 and !$data_weapons[@weapon_id].element_set.include?(Special_Element::get_index(Special_Element::TWO_WEAPONS))
  434.           $game_party.gain_weapon(@weapon_id, 1)
  435.           @weapon_id = 0
  436.         end
  437.       end
  438.       # --- 添加部分结束 ---
  439.     end
  440.   end

  441.   #--------------------------------------------------------------------------
  442.   # ● 是否可以二刀流的角色
  443.   #--------------------------------------------------------------------------
  444.   def can_two_weapons?
  445.     return class_element_set.include?(Special_Element::get_index(Special_Element::TWO_WEAPONS))
  446.   end
  447.   #--------------------------------------------------------------------------
  448.   # ● 角色类属性获取A类属性
  449.   #--------------------------------------------------------------------------
  450.   def class_element_set
  451.     element_set = []
  452.     for i in 1...$data_classes[@class_id].element_ranks.xsize
  453.       element_set.push(i) if $data_classes[@class_id].element_ranks[i] == 1
  454.     end
  455.     return element_set
  456.   end
  457. end


  458. class Window_EquipRight < Window_Selectable
  459.   #--------------------------------------------------------------------------
  460.   # ● 刷新
  461.   #--------------------------------------------------------------------------
  462.   def refresh
  463.     self.contents.clear
  464.     @data = []
  465.     @data.push($data_weapons[@actor.weapon_id])
  466.     # --- 更改部分 ---
  467.     @data.push(@actor.weapon2_id != 0 ? $data_weapons[@actor.weapon2_id] : $data_armors[@actor.armor1_id])
  468.     # --- 完成修改 ---
  469.     @data.push($data_armors[@actor.armor2_id])
  470.     @data.push($data_armors[@actor.armor3_id])
  471.     @data.push($data_armors[@actor.armor4_id])
  472.     @item_max = @data.size
  473.     self.contents.font.color = system_color
  474.     self.contents.draw_text(4, 32 * 0, 92, 32, $data_system.words.weapon)
  475.     self.contents.draw_text(4, 32 * 1, 92, 32, $data_system.words.armor1)
  476.     self.contents.draw_text(4, 32 * 2, 92, 32, $data_system.words.armor2)
  477.     self.contents.draw_text(4, 32 * 3, 92, 32, $data_system.words.armor3)
  478.     self.contents.draw_text(5, 32 * 4, 92, 32, $data_system.words.armor4)
  479.     draw_item_name(@data[0], 92, 32 * 0)
  480.     draw_item_name(@data[1], 92, 32 * 1)
  481.     draw_item_name(@data[2], 92, 32 * 2)
  482.     draw_item_name(@data[3], 92, 32 * 3)
  483.     draw_item_name(@data[4], 92, 32 * 4)
  484.   end
  485. end

  486. class Window_EquipItem < Window_Selectable
  487.   #--------------------------------------------------------------------------
  488.   # ● 刷新
  489.   #--------------------------------------------------------------------------
  490.   def refresh
  491.     if self.contents != nil
  492.       self.contents.dispose
  493.       self.contents = nil
  494.     end
  495.     @data = []
  496.     # 添加可以装备的武器
  497.     if @equip_type == 0
  498.       weapon_set = $data_classes[@actor.class_id].weapon_set
  499.       for i in 1...$data_weapons.size
  500.         if $game_party.weapon_number(i) > 0 and weapon_set.include?(i)
  501.           @data.push($data_weapons[i])
  502.         end
  503.       end
  504.     end
  505.     # --- 从这里添加部分 ---
  506.     # 装备部位是盾的位置,可以二刀流的角色
  507.     if @equip_type == 1 and @actor.can_two_weapons?
  508.       weapon_set = $data_classes[@actor.class_id].weapon_set
  509.       for i in 1...$data_weapons.size
  510.         if $game_party.weapon_number(i) > 0 and weapon_set.include?(i) and $data_weapons[i].element_set.include?(Special_Element::get_index(Special_Element::TWO_WEAPONS))
  511.           @data.push($data_weapons[i])
  512.         end
  513.       end
  514.     end
  515.     # --- 添加部分结束 ---
  516.     # 添加可以装备的防具
  517.     if @equip_type != 0
  518.       armor_set = $data_classes[@actor.class_id].armor_set
  519.       for i in 1...$data_armors.size
  520.         if $game_party.armor_number(i) > 0 and armor_set.include?(i)
  521.           if $data_armors[i].kind == @equip_type-1
  522.             @data.push($data_armors[i])
  523.           end
  524.         end
  525.       end
  526.     end
  527.     # 添加空白
  528.     @data.push(nil)
  529.     # 创建位图,绘制所有项目
  530.     @item_max = @data.size
  531.     self.contents = Bitmap.new(width - 32, row_max * 32)
  532.     for i in 0...@item_max-1
  533.       draw_item(i)
  534.     end
  535.   end
  536. end

  537. class Scene_Equip
  538.   #--------------------------------------------------------------------------
  539.   # ● 刷新
  540.   #--------------------------------------------------------------------------
  541.   def refresh
  542.     # 项目窗口的可见状态设定
  543.     @item_window1.visible = (@right_window.index == 0)
  544.     @item_window2.visible = (@right_window.index == 1)
  545.     @item_window3.visible = (@right_window.index == 2)
  546.     @item_window4.visible = (@right_window.index == 3)
  547.     @item_window5.visible = (@right_window.index == 4)
  548.     # 获取当前装备中的项目
  549.     item1 = @right_window.item
  550.     # 将当前项目窗口设置为@item_window
  551.     case @right_window.index
  552.     when 0
  553.       @item_window = @item_window1
  554.     when 1
  555.       @item_window = @item_window2
  556.     when 2
  557.       @item_window = @item_window3
  558.     when 3
  559.       @item_window = @item_window4
  560.     when 4
  561.       @item_window = @item_window5
  562.     end
  563.     # 当激活右窗口时
  564.     if @right_window.active
  565.       # 删除变更装备后的能力(攻击力、物防、法防)      变更装备后的能力值设置
  566.       @left_window.set_new_parameters(nil, nil, nil)
  567.     end
  568.     # 物品窗口被激活的情况下
  569.     if @item_window.active
  570.       # 获取现在选中的物品
  571.       item2 = @item_window.item
  572.       # 变更装备
  573.       last_hp = @actor.hp
  574.       last_sp = @actor.sp
  575.       # --- 更改部分 ---
  576.       # 保存当前装备(增加装备种类时更改此处)
  577.       equipments = [@actor.weapon2_id, @actor.weapon_id, @actor.armor1_id, @actor.armor2_id, @actor.armor3_id, @actor.armor4_id]
  578.       # ★★★★★★★★★★★★★★★★---更改部分 ---★★★★★★★★★★★★★★★★
  579.       index = equip_type(@right_window.index, item2)
  580.       @actor.equip((index == -1 ? index : index.abs), item2 == nil ? 0 : item2.id)
  581.       # ★★★★★★★★★★★★★★★★---更改完成 ---★★★★★★★★★★★★★★★★
  582.       # equip(装备类型,武器ID)
  583.      #● 装备固定判定
  584.      #● equip_type : 装备类型(变更点:-1是二刀流的盾部分的武器
  585.      #● id    : 武器 or 防具 ID  (0 装备解除)
  586.      #● #如果是-1,则保持不变,其他情况取绝对值,
  587.      #● item2 物品栏id为nil,代表替换的是空白武器,则用0号ID,不是空的话则替换对应武器ID
  588.       # 获取变更装备后的能力值
  589.       new_atk = @actor.atk
  590.       new_pdef = @actor.pdef
  591.       new_mdef = @actor.mdef
  592.       new_eva = @actor.eva
  593.       new_str = @actor.str
  594.       new_dex = @actor.dex
  595.       new_agi = @actor.agi
  596.       new_int = @actor.int
  597.       # --- 更改部分 ---
  598.       # 返回到装备
  599.       for i in 0...equipments.size
  600.          @actor.equip(i - 1, equipments[i])
  601.       end
  602.       # --- 完成修改 ---
  603.       @actor.hp = last_hp
  604.       @actor.sp = last_sp
  605.       # 描画左窗口
  606.       @left_window.set_new_parameters(new_atk, new_pdef, new_mdef)
  607.     end
  608.   end

  609.   #--------------------------------------------------------------------------
  610.   # ● 刷新画面 (物品窗口被激活的情况下)
  611.   #--------------------------------------------------------------------------
  612.   def update_item
  613.     # 按下 B 键的情况下
  614.     if Input.trigger?(Input::B)
  615.       # 取消演奏SE
  616.       $game_system.se_play($data_system.cancel_se)
  617.       # 激活右侧窗口
  618.       @right_window.active = true
  619.       @item_window.active = false
  620.       @item_window.index = -1
  621.       return
  622.     end
  623.     # C按下按钮时
  624.     if Input.trigger?(Input::C)
  625.       # 演奏装备SE
  626.       $game_system.se_play($data_system.equip_se)
  627.       # 获取物品窗口现在选择的装备数据
  628.       item = @item_window.item
  629.       # --- 更改部分 ---
  630.       # ★★★★★★★★★★★★★★★★---更改部分 ---★★★★★★★★★★★★★★★★
  631.       index = equip_type(@right_window.index, item)
  632.       @actor.equip((index == -1 ? index : index.abs), item == nil ? 0 : item.id)
  633.       # ★★★★★★★★★★★★★★★★---更改完成 ---★★★★★★★★★★★★★★★★
  634.       # 激活右侧窗口
  635.       @right_window.active = true
  636.       @item_window.active = false
  637.       @item_window.index = -1
  638.       # 再生成右侧窗口、物品窗口的内容
  639.       @right_window.refresh
  640.       # --- 更改部分 ---
  641.       # 因为太麻烦了,所以刷新所有窗口
  642.       @item_window1.refresh
  643.       @item_window2.refresh
  644.       @item_window3.refresh
  645.       @item_window4.refresh
  646.       @item_window5.refresh
  647.       # --- 完成修改 ---
  648.       return
  649.     end
  650.   end
  651.   # --- 从这里追加部分 ---
  652.   #--------------------------------------------------------------------------
  653.   # ● 二刀流用的装备部位取得
  654.   #--------------------------------------------------------------------------
  655.   def equip_type(index, item)
  656.     #p item.is_a?(RPG::Armor) #如果是空的item,则是-1*index,所以造成无法卸载了。
  657.     return index * (item.is_a?(RPG::Armor) ? 1 : -1)
  658.   end
  659.   # --- 添加部分结束 ---
  660. end

  661. class Scene_Battle
  662.   #--------------------------------------------------------------------------
  663.   # ● 生成基本行动结果
  664.   #--------------------------------------------------------------------------
  665.   def make_basic_action_result
  666.     # 攻击的情况下
  667.     if @active_battler.current_action.basic == 0
  668.       # ★★★★★★★★★★★★★★★★---更改部分 ---★★★★★★★★★★★★★★★★
  669.       # 设置攻击 ID
  670.       @animation1_id = @active_battler.animation1_id.is_a?(Array) ? @active_battler.animation1_id.dup : @active_battler.animation1_id
  671.       @animation2_id = @active_battler.animation2_id.is_a?(Array) ? @active_battler.animation2_id.dup : @active_battler.animation2_id
  672.       # ★★★★★★★★★★★★★★★★---完成修改 ------★★★★★★★★★★★★★★★
  673.       # 行动方的战斗者是敌人的情况下
  674.       if @active_battler.is_a?(Game_Enemy)
  675.         if @active_battler.restriction == 3
  676.           target = $game_troop.random_target_enemy
  677.         elsif @active_battler.restriction == 2
  678.           target = $game_party.random_target_actor
  679.         else
  680.           index = @active_battler.current_action.target_index
  681.           target = $game_party.smooth_target_actor(index)
  682.         end
  683.       end
  684.       # 行动方的战斗者是角色的情况下
  685.       if @active_battler.is_a?(Game_Actor)
  686.         if @active_battler.restriction == 3
  687.           target = $game_party.random_target_actor
  688.         elsif @active_battler.restriction == 2
  689.           target = $game_troop.random_target_enemy
  690.         else
  691.           index = @active_battler.current_action.target_index
  692.           target = $game_troop.smooth_target_enemy(index)
  693.         end
  694.       end
  695.       # 设置对像方的战斗者序列
  696.       @target_battlers = [target]
  697.       # 应用通常攻击效果
  698.       for target in @target_battlers
  699.         target.attack_effect(@active_battler)
  700.       end
  701.       return
  702.     end
  703.     # 防御的场合
  704.     if @active_battler.current_action.basic == 1
  705.       # 帮助窗口显示"防御"
  706.       @help_window.set_text($data_system.words.guard, 1)
  707.       return
  708.     end
  709.     # 逃跑的情况下
  710.     if @active_battler.is_a?(Game_Enemy) and
  711.        @active_battler.current_action.basic == 2
  712.       # 帮助窗口"逃跑"显示
  713.       @help_window.set_text("逃跑", 1)
  714.       # 逃跑
  715.       @active_battler.escape
  716.       return
  717.     end
  718.     # 什么也不做的情况下
  719.     if @active_battler.current_action.basic == 3
  720.       # 清除强制行动对像的战斗者
  721.       $game_temp.forcing_battler = nil
  722.       # 移至步骤 1
  723.       @phase4_step = 1
  724.       return
  725.     end
  726.   end

  727.   #--------------------------------------------------------------------------
  728.   # ● 刷新画面 (主回合步骤 3 : 行动方动画)
  729.   #--------------------------------------------------------------------------
  730.   def update_phase4_step3
  731.     # ★★★★★★★★★★★★★★★★---更改部分 ---★★★★★★★★★★★★★★★★
  732.     # 开始动画排列
  733.     if @animation1_id.is_a?(Integer)
  734.       @animation1_id = [@animation1_id]
  735.     end
  736.     animation = @animation1_id.shift
  737.     # 行动方动画 (ID 为 0 的情况下是白色闪烁)
  738.     if animation == 0
  739.       @active_battler.white_flash = true
  740.     else
  741.       @active_battler.animation_id = animation
  742.       @active_battler.animation_hit = true
  743.     end
  744.     # 动画丢失后移至步骤4
  745.     @phase4_step = 4 if @animation1_id.empty?
  746.     # ★★★★★★★★★★★★★★★★---完成修改 ------★★★★★★★★★★★★★★★
  747.   end

  748.   #--------------------------------------------------------------------------
  749.   # ● 刷新画面 (主回合步骤 4 : 对像方动画)
  750.   #--------------------------------------------------------------------------
  751.   def update_phase4_step4
  752.     # ★★★★★★★★★★★★★★★★---更改部分 ---★★★★★★★★★★★★★★★★
  753.     # 开始动画排列
  754.     if @animation2_id.is_a?(Integer)
  755.       @animation2_id = [@animation2_id]
  756.     end
  757.     animation = @animation2_id.shift
  758.     # 对像方动画
  759.     for target in @target_battlers
  760.       target.animation_id = animation
  761.       target.animation_hit = (target.damage != "Miss")
  762.     end
  763.     # 不管动画长度如何,至少等8帧
  764.     @wait_count = 8
  765.     # 动画丢失后移至步骤5
  766.     @phase4_step = 5 if @animation2_id.empty?
  767.     # ★★★★★★★★★★★★★★★★---完成修改 ------★★★★★★★★★★★★★★★
  768.   end
  769. end
  770. #==============================================================================
  771. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  772. #==============================================================================
复制代码

点评

这个脚本可能和其他脚本有关联/冲突,如果你做了版本记录的话可以看看从哪个版本开始不行的。  发表于 2020-6-4 01:19
我很好奇,脚本已经测试过的了,一直不动它,也会突然出错的时候的吗?  发表于 2020-6-4 00:36
旧作《邵彦朝的大冒险》下载

默默无闻的论坛观察者
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-4-28 20:28

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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