查看: 2282|回复: 3

[已经解决] 如何在装备栏数大于4时用脚本更换角色装备?

[复制链接]
梦石
0
星屑
10510
在线时间
1118 小时
注册时间
2015-2-10
回帖
164
发表于 2021-10-9 10:30:09 | 显示全部楼层 |阅读模式
悬赏20星屑已解决
本帖最后由 fbeds 于 2021-10-9 18:55 编辑

我使用了一个可以增加装备栏数量的脚本,但这样我想用事件来更换角色装备时,我仍然只能选择原本默认的4个装备栏来更换,如何用脚本来实现更换新增的这些装备栏上的装备?
  1. #==============================================================================
  2. #
  3. # ▼ Yanfly Engine Ace - 装备系统 v1.06
  4. # -- 最后更新: 2014.05.01
  5. # -- 使用难度: 普通, 困难
  6. # -- 需要脚本: 无
  7. #
  8. #==============================================================================

  9. $imported = {} if $imported.nil?
  10. $imported["YEA-AceEquipEngine"] = true

  11. #==============================================================================
  12. # ▼ Updates
  13. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  14. # 2014.05.01 - Bug Fixed: Refresh Equip Item List when change slot.
  15. # 2012.02.02 - Bug Fixed: Crash when changing classes to different equip slots.
  16. # 2012.01.22 - Bug Fixed: <equip slot> notetags updated to factor in spaces.
  17. # 2012.01.05 - Compatibility Update: Equip Dynamic Stats
  18. # 2011.12.30 - Bug Fixed: Stats didn't update.
  19. # 2011.12.23 - Script efficiency optimized.
  20. # 2011.12.18 - Script efficiency optimized.
  21. # 2011.12.13 - Started Script and Finished.
  22. #
  23. #==============================================================================
  24. # ▼ 介绍
  25. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  26. # 默认的装备系统十分基础,本脚本为装备系统添加诸多功能,如指定角色装备类型(包
  27. # 括角色可以拥有多个相同的装备类型)、设定新的装备类型(这里说的装备类型不同于
  28. # 于数据库中的武器类型、护甲类型,可以说装备类型包括武器、防具、饰品等)。
  29. #
  30. #==============================================================================
  31. # ▼ 安装方式
  32. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  33. # 打开脚本编辑器,将本脚本拷贝/复制到一个在▼ 插件脚本之下▼ Main之上的新
  34. # 脚本页/槽中.记得保存你的工程以使脚本生效.
  35. #
  36. # -----------------------------------------------------------------------------
  37. # 角色备注 - 在数据库-角色中可以使用的备注.
  38. # -----------------------------------------------------------------------------
  39. # <装备槽>
  40. #  内容
  41. #  内容
  42. # </装备槽>
  43. # 设定该角色可装备的装备类型,及装备类型的顺序。将"内容"替换为该角色可用的装备
  44. # 类型名称(本脚本下面),该设定的优先级大于数据库中设定的优先级。为了说明清楚,
  45. # 你也可以将"内容"替换为"装备类型: x"x为0-4间的任意一个数字,数字代表的意思下面
  46. # 有讲。
  47. #
  48. # <初始装备: x>
  49. # <初始装备: x, x>
  50. # 设定该角色的初始装备类型,x为装备类型的id。在数据库中没有新装备槽的初始装备设
  51. # 定时可以使用。
  52. #
  53. # <固定装备: x>
  54. # <固定装备: x, x>
  55. # 固定该角色的x号装备类型。
  56. #
  57. # <禁用装备: x>
  58. # <禁用装备: x, x>
  59. # 禁用该角色的x号装备类型。意思是装备无法放置在该装备槽中。
  60. #
  61. # -----------------------------------------------------------------------------
  62. # 职业备注 - 在数据库-职业中可以使用的备注.
  63. # -----------------------------------------------------------------------------
  64. # <装备槽>
  65. #  内容
  66. #  内容
  67. # </装备槽>
  68. # 设定该职业可装备的装备类型,及装备类型的顺序。将"内容"替换为该职业可用的装备
  69. # 类型名称(本脚本下面),该设定的优先级大于数据库中设定的优先级。为了说明清楚,
  70. # 你也可以将"内容"替换为"装备类型: x"x为0-4间的任意一个数字,数字代表的意思下面
  71. # 有讲
  72. #
  73. # <固定装备: x>
  74. # <固定装备: x, x>
  75. # 固定该职业的x号装备类型。
  76. #
  77. # <禁用装备: x>
  78. # <禁用装备: x, x>
  79. # 禁用该职业的x号装备类型。意思是装备无法放置在该装备槽中。
  80. #
  81. # -----------------------------------------------------------------------------
  82. # 武器备注 - 在数据库-武器中可以使用的备注.
  83. # -----------------------------------------------------------------------------
  84. # <固定装备: x>
  85. # <固定装备: x, x>
  86. # 装备该武器后固定x号装备类型。
  87. #
  88. # <禁用装备: x>
  89. # <禁用装备: x, x>
  90. # 装备该武器后禁用该武器的x号装备类型。意思是装备无法放置在该装备槽中。
  91. #
  92. # -----------------------------------------------------------------------------
  93. # 护甲备注 - 在数据库-护甲中可以使用的备注.
  94. # -----------------------------------------------------------------------------
  95. # <装备类型: x>
  96. # <装备类型: 文本>
  97. # x替换为装备名称(本脚本下面)或装备类型ID,此备注将该护甲归类/视为x号装备类型
  98. #
  99. # <固定装备: x>
  100. # <固定装备: x, x>
  101. # 装备该护甲后固定x号装备类型。
  102. #
  103. # <禁用装备: x>
  104. # <禁用装备: x, x>
  105. # 装备该护甲后禁用该武器的x号装备类型。意思是装备无法放置在该装备槽中。
  106. #
  107. # -----------------------------------------------------------------------------
  108. # 状态备注 - 在数据库-状态中可以使用的备注.
  109. # -----------------------------------------------------------------------------
  110. # <固定装备: x>
  111. # <固定装备: x, x>
  112. # 获得该状态后固定x号装备类型。(配合脚本"战斗中更换装备")
  113. #
  114. # <禁用装备: x>
  115. # <禁用装备: x, x>
  116. # 获得该状态后禁用x号装备类型。意思是装备无法放置在该装备槽中。(配合脚本"战斗中
  117. # 更换装备")
  118. #
  119. #==============================================================================
  120. # ▼ 兼容性
  121. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  122. # 本脚本仅为RPG Maker VX Ace编写.极不可能在无任何修改的情况下运行于RPG Maker VX.
  123. #
  124. #==============================================================================

  125. module YEA
  126.   module EQUIP
  127.    
  128.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  129.     # - 通用装备设置 -
  130.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  131.     # 调整默认装备设置,你可以添加新的装备类型,建议不要改得太多,以免出现问题。
  132.     # 下面是默认id对应的装备类型
  133.     #
  134.     # ID   装备类型
  135.     # ---  ------------
  136.     #  0   武器
  137.     #  1   盾牌
  138.     #  2   头盔
  139.     #  3   铠甲
  140.     #  4   饰品
  141.     #
  142.     # 无论你怎么修改以下顺序,武器双持的情况都是不变的:第二个装备类型变为武器(0).
  143.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  144.     # 下面这个数组是默认的可用装备槽即其顺序,应用于一切未通过备注自定义装备槽
  145.     # 的角色。
  146.     DEFAULT_BASE_SLOTS = [0,0,0,0,0,1,2,3,4,5,5,5,5,5]
  147.    
  148.     # 下面这个哈希表用来添加新的装备类型(id为 4+). 你还可以设定其能否被移除,
  149.     # 是否能通过"最强装备"自动选择最强的装备。
  150.     TYPES ={
  151.     # TypeID => ["类型名称", 能否移除?, 能否使用"最强装备"?],
  152.            0 => [   "心灵",       true,     false],
  153.            1 => [   "上衣",      false,     false],
  154.            2 => [   "下装",      false,     false],
  155.            3 => [   "袜子",      false,     false],
  156.            4 => [   "鞋子",      false,     false],
  157.            5 => [   "其它",      false,     false],
  158.            8 => [  "N技能",       true,     false],
  159.            9 => [  "M技能",       true,     false],
  160.           10 => [  "G技能",       true,     false],
  161.           11 => [   "品质",      false,     false],
  162.     } # 别动这个括号.
  163.    
  164.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  165.     # - 装备指令列表 -
  166.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  167.     # 在这里调整装备指令列表(甚至是移除某些指令)下面是指令的解释:
  168.     #
  169.     # -------------------------------------------------------------------------
  170.     # :指令            解释
  171.     # -------------------------------------------------------------------------
  172.     # :equip           激活装备选择窗口. 默认.
  173.     # :optimize        自动为角色选择最强装备. 默认.
  174.     # :clear           移除角色身上的全部装备. 默认
  175.     #
  176.     # 以上为默认的全部可用指令。
  177.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  178.     # 在数组中放置可用的指令.
  179.     COMMAND_LIST =[
  180.       :equip,
  181. #      :optimize,
  182.       :clear,
  183.     # :custom1,
  184.     # :custom2,
  185.     ] # 不要动这个括号.
  186.    
  187.     #--------------------------------------------------------------------------
  188.     # - 装备自定义指令 -
  189.     # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  190.     # 对于那些希望通过本脚本来为装备场景添加特殊效果的人,可以使用下面的哈希表
  191.     # 来管理装备场景中的指令。你可以使用开关来禁用/隐藏指令。如果你不想把指令与
  192.     # 开关相关联,把开关设定为0就行。
  193.     #--------------------------------------------------------------------------
  194.     CUSTOM_EQUIP_COMMANDS ={
  195.     # :指令    => [       "文本",     启用开关,   显示开关,       处理方法],
  196.       :custom1 => [ "自定义名称",            0,          0, :command_name1],
  197.       :custom2 => [ "自定义文本",            0,          0, :command_name2],
  198.     } # 不要动这个括号.
  199.    
  200.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  201.     # - 其他窗口设置 -
  202.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  203.     # 调整装备窗口的视觉效果.
  204.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  205.     # 改变右下角能力值数字的字体大小
  206.     STATUS_FONT_SIZE = 20
  207.    
  208.     # 在更换装备指令中,移除装备指令的图标和文本设定
  209.     REMOVE_EQUIP_ICON = 0
  210.     REMOVE_EQUIP_TEXT = "<移除装备>"
  211.    
  212.     # 装备槽中,无装备的图标和文本.
  213.     NOTHING_ICON = 0
  214.     NOTHING_TEXT = "<空>"
  215.    
  216.   end # EQUIP
  217. end # YEA

  218. #==============================================================================
  219. # ▼ 编辑以下内容可能会出现电脑损坏、死机,电脑主人脑袋爆炸、昏迷、死亡或口臭
  220. # 所以编辑了后果自负。
  221. #==============================================================================

  222. module YEA
  223.   module REGEXP
  224.   module BASEITEM
  225.    
  226.     EQUIP_SLOTS_ON  = /<(?:EQUIP_SLOTS|装备槽)>/i
  227.     EQUIP_SLOTS_OFF = /<\/(?:EQUIP_SLOTS|装备槽)>/i
  228.    
  229.     EQUIP_TYPE_INT = /<(?:EQUIP_TYPE|装备类型):[ ]*(\d+)>/i
  230.     EQUIP_TYPE_STR = /<(?:EQUIP_TYPE|装备类型):[ ]*(.*)>/i
  231.    
  232.     STARTING_GEAR = /<(?:STARTING_GEAR|初始装备):[ ](\d+(?:\s*,\s*\d+)*)>/i
  233.    
  234.     FIXED_EQUIP = /<(?:FIXED_EQUIP|固定装备):[ ](\d+(?:\s*,\s*\d+)*)>/i
  235.     SEALED_EQUIP = /<(?:SEALED_EQUIP|禁用装备):[ ](\d+(?:\s*,\s*\d+)*)>/i
  236.    
  237.   end # BASEITEM
  238.   end # REGEXP
  239. end # YEA

  240. #==============================================================================
  241. # ■ Vocab
  242. #==============================================================================

  243. module Vocab
  244.   
  245.   #--------------------------------------------------------------------------
  246.   # overwrite method: self.etype
  247.   #--------------------------------------------------------------------------
  248.   def self.etype(etype)
  249.     return $data_system.terms.etypes[etype] if [0,1,2,3,4].include?(etype)
  250.     return YEA::EQUIP::TYPES[etype][0] if YEA::EQUIP::TYPES.include?(etype)
  251.     return ""
  252.   end
  253.   
  254. end # Vocab

  255. #==============================================================================
  256. # ■ Icon
  257. #==============================================================================

  258. module Icon
  259.   
  260.   #--------------------------------------------------------------------------
  261.   # self.remove_equip
  262.   #--------------------------------------------------------------------------
  263.   def self.remove_equip; return YEA::EQUIP::REMOVE_EQUIP_ICON; end
  264.   
  265.   #--------------------------------------------------------------------------
  266.   # self.nothing_equip
  267.   #--------------------------------------------------------------------------
  268.   def self.nothing_equip; return YEA::EQUIP::NOTHING_ICON; end
  269.    
  270. end # Icon

  271. #==============================================================================
  272. # ■ Numeric
  273. #==============================================================================

  274. class Numeric
  275.   
  276.   #--------------------------------------------------------------------------
  277.   # new method: group_digits
  278.   #--------------------------------------------------------------------------
  279.   unless $imported["YEA-CoreEngine"]
  280.   def group; return self.to_s; end
  281.   end # $imported["YEA-CoreEngine"]
  282.    
  283. end # Numeric

  284. #==============================================================================
  285. # ■ DataManager
  286. #==============================================================================

  287. module DataManager
  288.   
  289.   #--------------------------------------------------------------------------
  290.   # alias method: load_database
  291.   #--------------------------------------------------------------------------
  292.   class <<self; alias load_database_aee load_database; end
  293.   def self.load_database
  294.     load_database_aee
  295.     load_notetags_aee
  296.   end
  297.   
  298.   #--------------------------------------------------------------------------
  299.   # new method: load_notetags_aee
  300.   #--------------------------------------------------------------------------
  301.   def self.load_notetags_aee
  302.     groups = [$data_actors, $data_classes, $data_weapons, $data_armors,
  303.       $data_states]
  304.     for group in groups
  305.       for obj in group
  306.         next if obj.nil?
  307.         obj.load_notetags_aee
  308.       end
  309.     end
  310.   end
  311.   
  312. end # DataManager

  313. #==============================================================================
  314. # ■ RPG::BaseItem
  315. #==============================================================================

  316. class RPG::BaseItem
  317.   
  318.   #--------------------------------------------------------------------------
  319.   # public instance variables
  320.   #--------------------------------------------------------------------------
  321.   attr_accessor :base_equip_slots
  322.   attr_accessor :fixed_equip_type
  323.   attr_accessor :sealed_equip_type
  324.   attr_accessor :extra_starting_equips
  325.   
  326.   #--------------------------------------------------------------------------
  327.   # common cache: load_notetags_aee
  328.   #--------------------------------------------------------------------------
  329.   def load_notetags_aee
  330.     @base_equip_slots = []
  331.     @equip_slots_on = false
  332.     @fixed_equip_type = []
  333.     @sealed_equip_type = []
  334.     @extra_starting_equips = []
  335.     #---
  336.     self.note.split(/[\r\n]+/).each { |line|
  337.       case line
  338.       #---
  339.       when YEA::REGEXP::BASEITEM::EQUIP_SLOTS_ON
  340.         next unless self.is_a?(RPG::Actor) ||self.is_a?(RPG::Class)
  341.         @equip_slots_on = true
  342.       when YEA::REGEXP::BASEITEM::EQUIP_SLOTS_OFF
  343.         next unless self.is_a?(RPG::Actor) ||self.is_a?(RPG::Class)
  344.         @equip_slots_on = false
  345.       #---
  346.       when YEA::REGEXP::BASEITEM::STARTING_GEAR
  347.         next unless self.is_a?(RPG::Actor)
  348.         $1.scan(/\d+/).each { |num|
  349.         @extra_starting_equips.push(num.to_i) if num.to_i > 0 }
  350.       when YEA::REGEXP::BASEITEM::FIXED_EQUIP
  351.         $1.scan(/\d+/).each { |num|
  352.         @fixed_equip_type.push(num.to_i) if num.to_i > 0 }
  353.       when YEA::REGEXP::BASEITEM::SEALED_EQUIP
  354.         $1.scan(/\d+/).each { |num|
  355.         @sealed_equip_type.push(num.to_i) if num.to_i > 0 }
  356.       #---
  357.       when YEA::REGEXP::BASEITEM::EQUIP_TYPE_INT
  358.         next unless self.is_a?(RPG::Armor)
  359.         @etype_id = [1, $1.to_i].max
  360.       when YEA::REGEXP::BASEITEM::EQUIP_TYPE_STR
  361.         next unless self.is_a?(RPG::Armor)
  362.         for key in YEA::EQUIP::TYPES
  363.           id = key[0]
  364.           next if YEA::EQUIP::TYPES[id][0].upcase != $1.to_s.upcase
  365.           @etype_id = [1, id].max
  366.           break
  367.         end
  368.       #---
  369.       else
  370.         if @equip_slots_on
  371.           case line.upcase
  372.           when /装备类型[ ](\d+)/i, /装备类型:[ ](\d+)/i
  373.             id = $1.to_i
  374.             @base_equip_slots.push(id) if [0,1,2,3,4].include?(id)
  375.             @base_equip_slots.push(id) if YEA::EQUIP::TYPES.include?(id)
  376.           when /WEAPON/i
  377.             @base_equip_slots.push(0)
  378.           when /SHIELD/i
  379.             @base_equip_slots.push(1)
  380.           when /HEAD/i
  381.             @base_equip_slots.push(2)
  382.           when /BODY/i, /ARMOR/i, /ARMOUR/i
  383.             @base_equip_slots.push(3)
  384.           when /ETC/i, /OTHER/i, /ACCESSOR/i
  385.             @base_equip_slots.push(4)
  386.           else
  387.             text = line.upcase.delete(" ")
  388.             for key in YEA::EQUIP::TYPES
  389.               id = key[0]
  390.               next if YEA::EQUIP::TYPES[id][0].upcase.delete(" ")!= text
  391.               @base_equip_slots.push(id)
  392.               break
  393.             end
  394.           end
  395.         end
  396.       end
  397.     } # self.note.split
  398.     #---
  399.     return unless self.is_a?(RPG::Class)
  400.     if @base_equip_slots.empty?
  401.       @base_equip_slots = YEA::EQUIP::DEFAULT_BASE_SLOTS.clone
  402.     end
  403.   end
  404.   
  405. end # RPG::BaseItem

  406. #==============================================================================
  407. # ■ Game_Temp
  408. #==============================================================================

  409. class Game_Temp
  410.   
  411.   #--------------------------------------------------------------------------
  412.   # public instance variables
  413.   #--------------------------------------------------------------------------
  414.   attr_accessor :eds_actor
  415.   attr_accessor :scene_equip_index
  416.   attr_accessor :scene_equip_oy
  417.   
  418. end # Game_Temp

  419. #==============================================================================
  420. # ■ Game_BaseItem
  421. #==============================================================================

  422. class Game_BaseItem
  423.   
  424.   #--------------------------------------------------------------------------
  425.   # public instance variables
  426.   #--------------------------------------------------------------------------
  427.   attr_accessor :item_id
  428.   
  429. end # Game_BaseItem

  430. #==============================================================================
  431. # ■ Game_BattlerBase
  432. #==============================================================================

  433. class Game_BattlerBase
  434.   
  435.   #--------------------------------------------------------------------------
  436.   # alias method: equip_type_fixed?
  437.   #--------------------------------------------------------------------------
  438.   alias game_battlerbase_equip_type_fixed_aee equip_type_fixed?
  439.   def equip_type_fixed?(etype_id)
  440.     return true if fixed_etypes.include?(etype_id) if actor?
  441.     return game_battlerbase_equip_type_fixed_aee(etype_id)
  442.   end
  443.   
  444.   #--------------------------------------------------------------------------
  445.   # alias method: equip_type_sealed?
  446.   #--------------------------------------------------------------------------
  447.   alias game_battlerbase_equip_type_sealed_aee equip_type_sealed?
  448.   def equip_type_sealed?(etype_id)
  449.     return true if sealed_etypes.include?(etype_id) if actor?
  450.     return game_battlerbase_equip_type_sealed_aee(etype_id)
  451.   end
  452.   
  453. end # Game_BattlerBase

  454. #==============================================================================
  455. # ■ Game_Actor
  456. #==============================================================================

  457. class Game_Actor < Game_Battler
  458.   
  459.   #--------------------------------------------------------------------------
  460.   # alias method: init_equips
  461.   #--------------------------------------------------------------------------
  462.   alias game_actor_init_equips_aee init_equips
  463.   def init_equips(equips)
  464.     game_actor_init_equips_aee(equips)
  465.     equip_extra_starting_equips
  466.   end
  467.   
  468.   #--------------------------------------------------------------------------
  469.   # new method: equip_extra_starting_equips
  470.   #--------------------------------------------------------------------------
  471.   def equip_extra_starting_equips
  472.     for equip_id in actor.extra_starting_equips
  473.       armour = $data_armors[equip_id]
  474.       next if armour.nil?
  475.       etype_id = armour.etype_id
  476.       next unless equip_slots.include?(etype_id)
  477.       slot_id = empty_slot(etype_id)
  478.       @equips[slot_id].set_equip(etype_id == 0, armour.id)
  479.     end
  480.     refresh
  481.   end
  482.   
  483.   #--------------------------------------------------------------------------
  484.   # overwrite method: equip_slots
  485.   #--------------------------------------------------------------------------
  486.   def equip_slots
  487.     return equip_slots_dual if dual_wield?
  488.     return equip_slots_normal
  489.   end
  490.   
  491.   #--------------------------------------------------------------------------
  492.   # new method: equip_slots_normal
  493.   #--------------------------------------------------------------------------
  494.   def equip_slots_normal
  495.     return self.actor.base_equip_slots if self.actor.base_equip_slots != []
  496.     return self.class.base_equip_slots
  497.   end
  498.   
  499.   #--------------------------------------------------------------------------
  500.   # new method: equip_slots_dual
  501.   #--------------------------------------------------------------------------
  502.   def equip_slots_dual
  503.     array = equip_slots_normal.clone
  504.     array[1] = 0 if array.size >= 2
  505.     return array
  506.   end
  507.   
  508.   #--------------------------------------------------------------------------
  509.   # new method: fixed_etypes
  510.   #--------------------------------------------------------------------------
  511.   def fixed_etypes
  512.     array = []
  513.     array |= self.actor.fixed_equip_type
  514.     array |= self.class.fixed_equip_type
  515.     for equip in equips
  516.       next if equip.nil?
  517.       array |= equip.fixed_equip_type
  518.     end
  519.     for state in states
  520.       next if state.nil?
  521.       array |= state.fixed_equip_type
  522.     end
  523.     return array
  524.   end
  525.   
  526.   #--------------------------------------------------------------------------
  527.   # new method: sealed_etypes
  528.   #--------------------------------------------------------------------------
  529.   def sealed_etypes
  530.     array = []
  531.     array |= self.actor.sealed_equip_type
  532.     array |= self.class.sealed_equip_type
  533.     for equip in equips
  534.       next if equip.nil?
  535.       array |= equip.sealed_equip_type
  536.     end
  537.     for state in states
  538.       next if state.nil?
  539.       array |= state.sealed_equip_type
  540.     end
  541.     return array
  542.   end
  543.   
  544.   #--------------------------------------------------------------------------
  545.   # alias method: change_equip
  546.   #--------------------------------------------------------------------------
  547.   alias game_actor_change_equip_aee change_equip
  548.   def change_equip(slot_id, item)
  549.     if item.nil? && !@optimize_clear
  550.       etype_id = equip_slots[slot_id]
  551.       return unless YEA::EQUIP::TYPES[etype_id][1]
  552.     elsif item.nil? && @optimize_clear
  553.       etype_id = equip_slots[slot_id]
  554.       return unless YEA::EQUIP::TYPES[etype_id][2]
  555.     end
  556.     @equips[slot_id] = Game_BaseItem.new if @equips[slot_id].nil?
  557.     game_actor_change_equip_aee(slot_id, item)
  558.   end
  559.   
  560.   #--------------------------------------------------------------------------
  561.   # overwrite method: optimize_equipments
  562.   #--------------------------------------------------------------------------
  563.   def optimize_equipments
  564.     $game_temp.eds_actor = self
  565.     @optimize_clear = true
  566.     clear_equipments
  567.     @optimize_clear = false
  568.     equip_slots.size.times do |i|
  569.       next if !equip_change_ok?(i)
  570.       next unless can_optimize?(i)
  571.       items = $game_party.equip_items.select do |item|
  572.         item.etype_id == equip_slots[i] &&
  573.         equippable?(item) && item.performance >= 0
  574.       end
  575.       change_equip(i, items.max_by {|item| item.performance })
  576.     end
  577.     $game_temp.eds_actor = nil
  578.   end
  579.   
  580.   #--------------------------------------------------------------------------
  581.   # new method: can_optimize?
  582.   #--------------------------------------------------------------------------
  583.   def can_optimize?(slot_id)
  584.     etype_id = equip_slots[slot_id]
  585.     return YEA::EQUIP::TYPES[etype_id][2]
  586.   end
  587.   
  588.   #--------------------------------------------------------------------------
  589.   # alias method: force_change_equip
  590.   #--------------------------------------------------------------------------
  591.   alias game_actor_force_change_equip_aee force_change_equip
  592.   def force_change_equip(slot_id, item)
  593.     @equips[slot_id] = Game_BaseItem.new if @equips[slot_id].nil?
  594.     game_actor_force_change_equip_aee(slot_id, item)
  595.   end
  596.   
  597.   #--------------------------------------------------------------------------
  598.   # alias method: weapons
  599.   #--------------------------------------------------------------------------
  600.   alias game_actor_weapons_aee weapons
  601.   def weapons
  602.     anti_crash_equips
  603.     return game_actor_weapons_aee
  604.   end
  605.   
  606.   #--------------------------------------------------------------------------
  607.   # alias method: armors
  608.   #--------------------------------------------------------------------------
  609.   alias game_actor_armors_aee armors
  610.   def armors
  611.     anti_crash_equips
  612.     return game_actor_armors_aee
  613.   end
  614.   
  615.   #--------------------------------------------------------------------------
  616.   # alias method: equips
  617.   #--------------------------------------------------------------------------
  618.   alias game_actor_equips_aee equips
  619.   def equips
  620.     anti_crash_equips
  621.     return game_actor_equips_aee
  622.   end
  623.   
  624.   #--------------------------------------------------------------------------
  625.   # new method: equips
  626.   #--------------------------------------------------------------------------
  627.   def anti_crash_equips
  628.     for i in 0...@equips.size
  629.       next unless @equips[i].nil?
  630.       @equips[i] = Game_BaseItem.new
  631.     end
  632.   end
  633.   
  634. end # Game_Actor

  635. #==============================================================================
  636. # ■ Game_Interpreter
  637. #==============================================================================

  638. class Game_Interpreter
  639.   
  640.   #--------------------------------------------------------------------------
  641.   # overwrite method: change equip
  642.   #--------------------------------------------------------------------------
  643.   def command_319
  644.     actor = $game_actors[@params[0]]
  645.     return if actor.nil?
  646.     if @params[1] == 0 && @params[2] != 0
  647.       item = $data_weapons[@params[2]]
  648.       return unless actor.equip_slots.include?(0)
  649.       slot_id = actor.empty_slot(0)
  650.     elsif @params[2] != 0
  651.       item = $data_armors[@params[2]]
  652.       return unless actor.equip_slots.include?(item.etype_id)
  653.       slot_id = actor.empty_slot(item.etype_id)
  654.     else
  655.       slot_id = @params[1]
  656.     end
  657.     actor.change_equip_by_id(slot_id, @params[2])
  658.   end
  659.   
  660. end # Game_Interpreter

  661. #==============================================================================
  662. # ■ Window_EquipStatus
  663. #==============================================================================

  664. class Window_EquipStatus < Window_Base
  665.   
  666.   #--------------------------------------------------------------------------
  667.   # overwrite method: initialize
  668.   #--------------------------------------------------------------------------
  669.   def initialize(dx, dy)
  670.     super(dx, dy, window_width, Graphics.height - dy)
  671.     @actor = nil
  672.     @temp_actor = nil
  673.     refresh
  674.   end
  675.   
  676.   #--------------------------------------------------------------------------
  677.   # overwrite method: window_width
  678.   #--------------------------------------------------------------------------
  679.   def window_width; return Graphics.width * 2 / 5; end
  680.   
  681.   #--------------------------------------------------------------------------
  682.   # overwrite method: refresh
  683.   #--------------------------------------------------------------------------
  684.   def refresh
  685.     contents.clear
  686.     8.times {|i| draw_item(0, line_height * i, i) }
  687.   end
  688.   
  689.   #--------------------------------------------------------------------------
  690.   # overwrite method: draw_item
  691.   #--------------------------------------------------------------------------
  692.   def draw_item(dx, dy, param_id)
  693.     draw_background_colour(dx, dy)
  694.     draw_param_name(dx + 4, dy, param_id)
  695.     draw_current_param(dx + 4, dy, param_id) if @actor
  696.     drx = (contents.width + 22) / 2
  697.     draw_right_arrow(drx, dy)
  698.     draw_new_param(drx + 22, dy, param_id) if @temp_actor
  699.     reset_font_settings
  700.   end
  701.   
  702.   #--------------------------------------------------------------------------
  703.   # new method: draw_background_colour
  704.   #--------------------------------------------------------------------------
  705.   def draw_background_colour(dx, dy)
  706.     colour = Color.new(0, 0, 0, translucent_alpha/2)
  707.     rect = Rect.new(dx+1, dy+1, contents.width - 2, line_height - 2)
  708.     contents.fill_rect(rect, colour)
  709.   end
  710.   
  711.   #--------------------------------------------------------------------------
  712.   # overwrite method: draw_param_name
  713.   #--------------------------------------------------------------------------
  714.   def draw_param_name(dx, dy, param_id)
  715.     contents.font.size = YEA::EQUIP::STATUS_FONT_SIZE
  716.     change_color(system_color)
  717.     draw_text(dx, dy, contents.width, line_height, Vocab::param(param_id))
  718.   end
  719.   
  720.   #--------------------------------------------------------------------------
  721.   # overwrite method: draw_current_param
  722.   #--------------------------------------------------------------------------
  723.   def draw_current_param(dx, dy, param_id)
  724.     change_color(normal_color)
  725.     dw = (contents.width + 22) / 2
  726.     draw_text(0, dy, dw, line_height, @actor.param(param_id).group, 2)
  727.     reset_font_settings
  728.   end
  729.   
  730.   #--------------------------------------------------------------------------
  731.   # overwrite method: draw_new_param
  732.   #--------------------------------------------------------------------------
  733.   def draw_new_param(dx, dy, param_id)
  734.     contents.font.size = YEA::EQUIP::STATUS_FONT_SIZE
  735.     new_value = @temp_actor.param(param_id)
  736.     change_color(param_change_color(new_value - @actor.param(param_id)))
  737.     draw_text(0, dy, contents.width-4, line_height, new_value.group, 2)
  738.     reset_font_settings
  739.   end
  740.   
  741. end # Window_EquipStatus

  742. #==============================================================================
  743. # ■ Window_EquipCommand
  744. #==============================================================================

  745. class Window_EquipCommand < Window_HorzCommand
  746.   
  747.   #--------------------------------------------------------------------------
  748.   # overwrite method: make_command_list
  749.   #--------------------------------------------------------------------------
  750.   def make_command_list
  751.     for command in YEA::EQUIP::COMMAND_LIST
  752.       case command
  753.       when :equip
  754.         add_command(Vocab::equip2, :equip)
  755. #      when :optimize
  756. #        add_command(Vocab::optimize, :optimize)
  757.       when :clear
  758.         add_command(Vocab::clear, :clear)
  759.       else
  760.         process_custom_command(command)
  761.       end
  762.     end
  763.   end
  764.   
  765.   #--------------------------------------------------------------------------
  766.   # process_ok
  767.   #--------------------------------------------------------------------------
  768.   def process_ok
  769.     $game_temp.scene_equip_index = index
  770.     $game_temp.scene_equip_oy = self.oy
  771.     super
  772.   end
  773.   
  774.   #--------------------------------------------------------------------------
  775.   # new method: process_custom_command
  776.   #--------------------------------------------------------------------------
  777.   def process_custom_command(command)
  778.     return unless YEA::EQUIP::CUSTOM_EQUIP_COMMANDS.include?(command)
  779.     show = YEA::EQUIP::CUSTOM_EQUIP_COMMANDS[command][2]
  780.     continue = show <= 0 ? true : $game_switches[show]
  781.     return unless continue
  782.     text = YEA::EQUIP::CUSTOM_EQUIP_COMMANDS[command][0]
  783.     switch = YEA::EQUIP::CUSTOM_EQUIP_COMMANDS[command][1]
  784.     enabled = switch <= 0 ? true : $game_switches[switch]
  785.     add_command(text, command, enabled)
  786.   end
  787.   
  788.   #--------------------------------------------------------------------------
  789.   # overwrite method: window_width
  790.   #--------------------------------------------------------------------------
  791.   def window_width; return 160; end
  792.   
  793.   #--------------------------------------------------------------------------
  794.   # overwrite method: contents_width
  795.   #--------------------------------------------------------------------------
  796.   def contents_width; return width - standard_padding * 2; end
  797.   
  798.   #--------------------------------------------------------------------------
  799.   # overwrite method: contents_height
  800.   #--------------------------------------------------------------------------
  801.   def contents_height
  802.     ch = height - standard_padding * 2
  803.     return [ch - ch % item_height, row_max * item_height].max
  804.   end
  805.   
  806.   #--------------------------------------------------------------------------
  807.   # overwrite method: visible_line_number
  808.   #--------------------------------------------------------------------------
  809.   def visible_line_number; return 4; end
  810.   
  811.   #--------------------------------------------------------------------------
  812.   # overwrite method: col_max
  813.   #--------------------------------------------------------------------------
  814.   def col_max; return 1; end
  815.    
  816.   #--------------------------------------------------------------------------
  817.   # overwrite method: item_rect
  818.   #--------------------------------------------------------------------------
  819.   def item_rect(index)
  820.     rect = Rect.new
  821.     rect.width = item_width
  822.     rect.height = item_height
  823.     rect.x = index % col_max * (item_width + spacing)
  824.     rect.y = index / col_max * item_height
  825.     rect
  826.   end
  827.   
  828.   #--------------------------------------------------------------------------
  829.   # overwrite method: ensure_cursor_visible
  830.   #--------------------------------------------------------------------------
  831.   def ensure_cursor_visible
  832.     self.top_row = row if row < top_row
  833.     self.bottom_row = row if row > bottom_row
  834.   end
  835.    
  836.   #--------------------------------------------------------------------------
  837.   # overwrite method: cursor_down
  838.   #--------------------------------------------------------------------------
  839.   def cursor_down(wrap = false)
  840.     if index < item_max - col_max || (wrap && col_max == 1)
  841.       select((index + col_max) % item_max)
  842.     end
  843.   end
  844.   
  845.   #--------------------------------------------------------------------------
  846.   # overwrite method: cursor_up
  847.   #--------------------------------------------------------------------------
  848.   def cursor_up(wrap = false)
  849.     if index >= col_max || (wrap && col_max == 1)
  850.       select((index - col_max + item_max) % item_max)
  851.     end
  852.   end
  853.   
  854.   #--------------------------------------------------------------------------
  855.   # overwrite method: process_pageup
  856.   #--------------------------------------------------------------------------
  857.   def process_pageup
  858.     Sound.play_cursor
  859.     Input.update
  860.     deactivate
  861.     call_handler(:pageup)
  862.   end
  863.   
  864.   #--------------------------------------------------------------------------
  865.   # overwrite method: process_pagedown
  866.   #--------------------------------------------------------------------------
  867.   def process_pagedown
  868.     Sound.play_cursor
  869.     Input.update
  870.     deactivate
  871.     call_handler(:pagedown)
  872.   end
  873.   
  874. end # Window_EquipCommand

  875. #==============================================================================
  876. # ■ Window_EquipSlot
  877. #==============================================================================

  878. class Window_EquipSlot < Window_Selectable
  879.   
  880.   #--------------------------------------------------------------------------
  881.   # overwrite method: initialize
  882.   #--------------------------------------------------------------------------
  883.   def initialize(dx, dy, dw)
  884.     super(dx, dy, dw, Graphics.height - dy)
  885.     @actor = nil
  886.     refresh
  887.   end
  888.   
  889.   #--------------------------------------------------------------------------
  890.   # overwrite method: window_height
  891.   #--------------------------------------------------------------------------
  892.   def window_height; return self.height; end
  893.   
  894.   #--------------------------------------------------------------------------
  895.   # overwrite method: visible_line_number
  896.   #--------------------------------------------------------------------------
  897.   def visible_line_number; return item_max; end
  898.   
  899.   #--------------------------------------------------------------------------
  900.   # overwrite method: refresh
  901.   #--------------------------------------------------------------------------
  902.   def refresh
  903.     create_contents
  904.     super
  905.   end
  906.   
  907.   #--------------------------------------------------------------------------
  908.   # overwrite method: draw_item
  909.   #--------------------------------------------------------------------------
  910.   def draw_item(index)
  911.     return unless @actor
  912.     rect = item_rect_for_text(index)
  913.     change_color(system_color, enable?(index))
  914.     draw_text(rect.x, rect.y, 92, line_height, slot_name(index))
  915.     item = @actor.equips[index]
  916.     dx = rect.x + 92
  917.     dw = contents.width - dx - 24
  918.     if item.nil?
  919.       draw_nothing_equip(dx, rect.y, false, dw)
  920.     else
  921.       draw_item_name(item, dx, rect.y, enable?(index), dw)
  922.     end
  923.   end
  924.   
  925.   #--------------------------------------------------------------------------
  926.   # new method: draw_nothing_equip
  927.   #--------------------------------------------------------------------------
  928.   def draw_nothing_equip(dx, dy, enabled, dw)
  929.     change_color(normal_color, enabled)
  930.     draw_icon(Icon.nothing_equip, dx, dy, enabled)
  931.     text = YEA::EQUIP::NOTHING_TEXT
  932.     draw_text(dx + 24, dy, dw - 24, line_height, text)
  933.   end
  934.   
  935. end # Window_EquipSlot

  936. #==============================================================================
  937. # ■ Window_EquipItem
  938. #==============================================================================

  939. class Window_EquipItem < Window_ItemList
  940.   
  941.   #--------------------------------------------------------------------------
  942.   # overwrite method: col_max
  943.   #--------------------------------------------------------------------------
  944.   def col_max; return 1; end
  945.   
  946.   #--------------------------------------------------------------------------
  947.   # overwrite method: slot_id=
  948.   #--------------------------------------------------------------------------
  949.   def slot_id=(slot_id)
  950.     return if @slot_id == slot_id
  951.     @slot_id = slot_id
  952.     @last_item = nil
  953.     self.oy = 0
  954.     refresh
  955.   end
  956.   
  957.   #--------------------------------------------------------------------------
  958.   # overwrite method: draw_item
  959.   #--------------------------------------------------------------------------
  960.   def draw_item(index)
  961.     item = @data[index]
  962.     rect = item_rect(index)
  963.     rect.width -= 4
  964.     if item.nil?
  965.       draw_remove_equip(rect)
  966.       return
  967.     end
  968.     dw = contents.width - rect.x - 24
  969.     draw_item_name(item, rect.x, rect.y, enable?(item), dw)
  970.     draw_item_number(rect, item)
  971.   end
  972.   
  973.   #--------------------------------------------------------------------------
  974.   # new method: draw_remove_equip
  975.   #--------------------------------------------------------------------------
  976.   def draw_remove_equip(rect)
  977.     draw_icon(Icon.remove_equip, rect.x, rect.y)
  978.     text = YEA::EQUIP::REMOVE_EQUIP_TEXT
  979.     rect.x += 24
  980.     rect.width -= 24
  981.     draw_text(rect, text)
  982.   end
  983.   
  984.   #--------------------------------------------------------------------------
  985.   # overwrite method: include?
  986.   #--------------------------------------------------------------------------
  987.   def include?(item)
  988.     if item.nil? && !@actor.nil?
  989.       etype_id = @actor.equip_slots[@slot_id]
  990.       return YEA::EQUIP::TYPES[etype_id][1]
  991.     end
  992.     return true if item.nil?
  993.     return false unless item.is_a?(RPG::EquipItem)
  994.     return false if @slot_id < 0
  995.     return false if item.etype_id != @actor.equip_slots[@slot_id]
  996.     return @actor.equippable?(item)
  997.   end
  998.   
  999.   #--------------------------------------------------------------------------
  1000.   # overwrite method: enable?
  1001.   #--------------------------------------------------------------------------
  1002.   def enable?(item)
  1003.     if item.nil? && !@actor.nil?
  1004.       etype_id = @actor.equip_slots[@slot_id]
  1005.       return YEA::EQUIP::TYPES[etype_id][1]
  1006.     end
  1007.     return @actor.equippable?(item)
  1008.   end
  1009.   
  1010.   #--------------------------------------------------------------------------
  1011.   # new method: show
  1012.   #--------------------------------------------------------------------------
  1013.   def show
  1014.     @last_item = 0
  1015.     update_help
  1016.     super
  1017.   end
  1018.   
  1019.   #--------------------------------------------------------------------------
  1020.   # overwrite method: update_help
  1021.   #--------------------------------------------------------------------------
  1022.   def update_help
  1023.     super
  1024.     return if @actor.nil?
  1025.     return if @status_window.nil?
  1026.     return if @last_item == item
  1027.     @last_item = item
  1028.     temp_actor = Marshal.load(Marshal.dump(@actor))
  1029.     temp_actor.force_change_equip(@slot_id, item)
  1030.     @status_window.set_temp_actor(temp_actor)
  1031.   end
  1032.   
  1033. end # Window_EquipItem

  1034. #==============================================================================
  1035. # ■ Window_EquipActor
  1036. #==============================================================================

  1037. class Window_EquipActor < Window_Base
  1038.   
  1039.   #--------------------------------------------------------------------------
  1040.   # initialize
  1041.   #--------------------------------------------------------------------------
  1042.   def initialize(dx, dy)
  1043.     super(dx, dy, window_width, fitting_height(4))
  1044.     @actor = nil
  1045.   end
  1046.   
  1047.   #--------------------------------------------------------------------------
  1048.   # window_width
  1049.   #--------------------------------------------------------------------------
  1050.   def window_width; return Graphics.width - 160; end
  1051.   
  1052.   #--------------------------------------------------------------------------
  1053.   # actor=
  1054.   #--------------------------------------------------------------------------
  1055.   def actor=(actor)
  1056.     return if @actor == actor
  1057.     @actor = actor
  1058.     refresh
  1059.   end
  1060.   
  1061.   #--------------------------------------------------------------------------
  1062.   # refresh
  1063.   #--------------------------------------------------------------------------
  1064.   def refresh
  1065.     contents.clear
  1066.     return unless @actor
  1067.     draw_actor_face(@actor, 0, 0)
  1068.     draw_actor_simple_status(@actor, 108, line_height / 2)
  1069.   end
  1070.   
  1071. end # Window_EquipActor

  1072. #==============================================================================
  1073. # ■ Scene_Equip
  1074. #==============================================================================

  1075. class Scene_Equip < Scene_MenuBase
  1076.   
  1077.   #--------------------------------------------------------------------------
  1078.   # overwrite method: create_status_window
  1079.   #--------------------------------------------------------------------------
  1080.   def create_status_window
  1081.     wx = Graphics.width - (Graphics.width * 2 / 5)
  1082.     wy = @help_window.height + 120
  1083.     @status_window = Window_EquipStatus.new(wx, wy)
  1084.     @status_window.viewport = @viewport
  1085.     @status_window.actor = @actor
  1086.   end
  1087.   
  1088.   #--------------------------------------------------------------------------
  1089.   # overwrite method: create_command_window
  1090.   #--------------------------------------------------------------------------
  1091.   def create_command_window
  1092.     wx = 0
  1093.     wy = @help_window.height
  1094.     ww = 160
  1095.     @command_window = Window_EquipCommand.new(wx, wy, ww)
  1096.     @command_window.viewport = @viewport
  1097.     @command_window.help_window = @help_window
  1098.     if !$game_temp.scene_equip_index.nil?
  1099.       @command_window.select($game_temp.scene_equip_index)
  1100.       @command_window.oy = $game_temp.scene_equip_oy
  1101.     end
  1102.     $game_temp.scene_equip_index = nil
  1103.     $game_temp.scene_equip_oy = nil
  1104.     @command_window.set_handler(:equip,    method(:command_equip))
  1105. #    @command_window.set_handler(:optimize, method(:command_optimize))
  1106.     @command_window.set_handler(:clear,    method(:command_clear))
  1107.     @command_window.set_handler(:cancel,   method(:return_scene))
  1108.     @command_window.set_handler(:pagedown, method(:next_actor))
  1109.     @command_window.set_handler(:pageup,   method(:prev_actor))
  1110.     process_custom_equip_commands
  1111.     create_actor_window
  1112.   end
  1113.   
  1114.   #--------------------------------------------------------------------------
  1115.   # new method: create_actor_window
  1116.   #--------------------------------------------------------------------------
  1117.   def create_actor_window
  1118.     wy = @help_window.height
  1119.     @actor_window = Window_EquipActor.new(@command_window.width, wy)
  1120.     @actor_window.viewport = @viewport
  1121.     @actor_window.actor = @actor
  1122.   end
  1123.   
  1124.   #--------------------------------------------------------------------------
  1125.   # new method: process_custom_equip_commands
  1126.   #--------------------------------------------------------------------------
  1127.   def process_custom_equip_commands
  1128.     for command in YEA::EQUIP::COMMAND_LIST
  1129.       next unless YEA::EQUIP::CUSTOM_EQUIP_COMMANDS.include?(command)
  1130.       called_method = YEA::EQUIP::CUSTOM_EQUIP_COMMANDS[command][3]
  1131.       @command_window.set_handler(command, method(called_method))
  1132.     end
  1133.   end
  1134.   
  1135.   #--------------------------------------------------------------------------
  1136.   # overwrite method: create_slot_window
  1137.   #--------------------------------------------------------------------------
  1138.   def create_slot_window
  1139.     wx = 0
  1140.     wy = @command_window.y + @command_window.height
  1141.     ww = Graphics.width - @status_window.width
  1142.     @slot_window = Window_EquipSlot.new(wx, wy, ww)
  1143.     @slot_window.viewport = @viewport
  1144.     @slot_window.help_window = @help_window
  1145.     @slot_window.status_window = @status_window
  1146.     @slot_window.actor = @actor
  1147.     @slot_window.set_handler(:ok,       method(:on_slot_ok))
  1148.     @slot_window.set_handler(:cancel,   method(:on_slot_cancel))
  1149.   end
  1150.   
  1151.   #--------------------------------------------------------------------------
  1152.   # overwrite method: create_item_window
  1153.   #--------------------------------------------------------------------------
  1154.   def create_item_window
  1155.     wx = @slot_window.x
  1156.     wy = @slot_window.y
  1157.     ww = @slot_window.width
  1158.     wh = @slot_window.height
  1159.     @item_window = Window_EquipItem.new(wx, wy, ww, wh)
  1160.     @item_window.viewport = @viewport
  1161.     @item_window.help_window = @help_window
  1162.     @item_window.status_window = @status_window
  1163.     @item_window.actor = @actor
  1164.     @item_window.set_handler(:ok,     method(:on_item_ok))
  1165.     @item_window.set_handler(:cancel, method(:on_item_cancel))
  1166.     @slot_window.item_window = @item_window
  1167.     @item_window.hide
  1168.   end
  1169.   
  1170.   #--------------------------------------------------------------------------
  1171.   # alias method: command_optimize
  1172.   #--------------------------------------------------------------------------
  1173. #  alias scene_equip_command_optimize_aee command_optimize
  1174. # def command_optimize
  1175. #    scene_equip_command_optimize_aee
  1176. #    @actor_window.refresh
  1177. #  end
  1178.   
  1179.   #--------------------------------------------------------------------------
  1180.   # alias method: command_clear
  1181.   #--------------------------------------------------------------------------
  1182.   alias scene_equip_command_clear_aee command_clear
  1183.   def command_clear
  1184.     scene_equip_command_clear_aee
  1185.     @actor_window.refresh
  1186.   end
  1187.   
  1188.   #--------------------------------------------------------------------------
  1189.   # alias method: on_slot_ok
  1190.   #--------------------------------------------------------------------------
  1191.   alias scene_equip_on_slot_ok_aee on_slot_ok
  1192.   def on_slot_ok
  1193.     scene_equip_on_slot_ok_aee
  1194.     @slot_window.hide
  1195.     @item_window.refresh
  1196.     @item_window.show
  1197.   end
  1198.   
  1199.   #--------------------------------------------------------------------------
  1200.   # alias method: on_item_ok
  1201.   #--------------------------------------------------------------------------
  1202.   alias scene_equip_on_item_ok_aee on_item_ok
  1203.   def on_item_ok
  1204.     scene_equip_on_item_ok_aee
  1205.     @actor_window.refresh
  1206.     @slot_window.show
  1207.     @item_window.hide
  1208.   end
  1209.   
  1210.   #--------------------------------------------------------------------------
  1211.   # alias method: on_item_cancel
  1212.   #--------------------------------------------------------------------------
  1213.   alias scene_equip_on_item_cancel_aee on_item_cancel
  1214.   def on_item_cancel
  1215.     scene_equip_on_item_cancel_aee
  1216.     @slot_window.show
  1217.     @item_window.hide
  1218.   end
  1219.   
  1220.   #--------------------------------------------------------------------------
  1221.   # alias method: on_actor_change
  1222.   #--------------------------------------------------------------------------
  1223.   alias scene_equip_on_actor_change_aee on_actor_change
  1224.   def on_actor_change
  1225.     scene_equip_on_actor_change_aee
  1226.     @actor_window.actor = @actor
  1227.   end
  1228.   
  1229.   #--------------------------------------------------------------------------
  1230.   # new method: command_name1
  1231.   #--------------------------------------------------------------------------
  1232.   def command_name1
  1233.     # Do nothing.
  1234.   end
  1235.   
  1236.   #--------------------------------------------------------------------------
  1237.   # new method: command_name2
  1238.   #--------------------------------------------------------------------------
  1239.   def command_name2
  1240.     # Do nothing.
  1241.   end
  1242.   
  1243. end # Scene_Equip

  1244. #==============================================================================
  1245. #
  1246. # ▼ End of File
  1247. #
  1248. #==============================================================================
复制代码

最佳答案

查看完整内容

先获得物品,然后事件脚本 $game_actors[x].change_equip_by_id(y, z) x为数据库角色编号 y为装备位置【从0开始】 z为数据库装备编号
梦石
24
星屑
14433
在线时间
8323 小时
注册时间
2011-7-2
回帖
452

超评测评委极短28评委极短27评委MZ评测员极短26评委极短25评委极短24评委极短23评委极短22评委R考场第七期纪念奖开拓者

发表于 2021-10-9 10:30:10 | 显示全部楼层
本帖最后由 涅炎 于 2021-10-9 19:47 编辑
fbeds 发表于 2021-10-9 16:46
我是说,在游戏进行的过程中,更换角色的装备。原本的“更换装备”的事件里只能更换原本有的武器和4个防 ...


先获得物品,然后事件脚本
$game_actors[x].change_equip_by_id(y, z)

x为数据库角色编号
y为装备位置【从0开始】
z为数据库装备编号

评分

参与人数 1星屑 +80 收起 理由
alexncf125 + 80 认可答案

查看全部评分

【探索解谜游戏】《NULL》
-------------------------------------------------------------
回复

使用道具 举报

梦石
24
星屑
14433
在线时间
8323 小时
注册时间
2011-7-2
回帖
452

超评测评委极短28评委极短27评委MZ评测员极短26评委极短25评委极短24评委极短23评委极短22评委R考场第七期纪念奖开拓者

发表于 2021-10-9 16:39:15 | 显示全部楼层
在数据库-角色或者职业的备注栏里,写上
<装备槽>
装备类型: 0
装备类型: 1
装备类型: 2
装备类型: 3
装备类型: 4
装备类型: 5
装备类型: 8
装备类型: 9
装备类型: 10
装备类型: 11
</装备槽>

数据库-防具的备注栏里备注
<装备类型: x> x为你要的装备类型数字ID
【探索解谜游戏】《NULL》
-------------------------------------------------------------
回复

使用道具 举报

梦石
0
星屑
10510
在线时间
1118 小时
注册时间
2015-2-10
回帖
164
 楼主| 发表于 2021-10-9 16:46:41 | 显示全部楼层
涅炎 发表于 2021-10-9 16:39
在数据库-角色或者职业的备注栏里,写上

装备类型: 0


我是说,在游戏进行的过程中,更换角色的装备。原本的“更换装备”的事件里只能更换原本有的武器和4个防具,现在我想做到能更换新增的这几个装备槽的装备。
回复

使用道具 举报

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

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部