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

Project1

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

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

[复制链接]

Lv4.逐梦者

梦石
0
星屑
7028
在线时间
878 小时
注册时间
2015-2-10
帖子
248
跳转到指定楼层
1
发表于 2021-10-9 10:30:09 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
20星屑
本帖最后由 fbeds 于 2021-10-9 18:55 编辑

我使用了一个可以增加装备栏数量的脚本,但这样我想用事件来更换角色装备时,我仍然只能选择原本默认的4个装备栏来更换,如何用脚本来实现更换新增的这些装备栏上的装备?
RUBY 代码复制
  1. #==============================================================================
  2. #
  3. # ▼ Yanfly Engine Ace - 装备系统 v1.06
  4. # -- 最后更新: 2014.05.01
  5. # -- 使用难度: 普通, 困难
  6. # -- 需要脚本: 无
  7. #
  8. #==============================================================================
  9.  
  10. $imported = {} if $imported.nil?
  11. $imported["YEA-AceEquipEngine"] = true
  12.  
  13. #==============================================================================
  14. # ▼ Updates
  15. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  16. # 2014.05.01 - Bug Fixed: Refresh Equip Item List when change slot.
  17. # 2012.02.02 - Bug Fixed: Crash when changing classes to different equip slots.
  18. # 2012.01.22 - Bug Fixed: <equip slot> notetags updated to factor in spaces.
  19. # 2012.01.05 - Compatibility Update: Equip Dynamic Stats
  20. # 2011.12.30 - Bug Fixed: Stats didn't update.
  21. # 2011.12.23 - Script efficiency optimized.
  22. # 2011.12.18 - Script efficiency optimized.
  23. # 2011.12.13 - Started Script and Finished.
  24. #
  25. #==============================================================================
  26. # ▼ 介绍
  27. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  28. # 默认的装备系统十分基础,本脚本为装备系统添加诸多功能,如指定角色装备类型(包
  29. # 括角色可以拥有多个相同的装备类型)、设定新的装备类型(这里说的装备类型不同于
  30. # 于数据库中的武器类型、护甲类型,可以说装备类型包括武器、防具、饰品等)。
  31. #
  32. #==============================================================================
  33. # ▼ 安装方式
  34. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  35. # 打开脚本编辑器,将本脚本拷贝/复制到一个在▼ 插件脚本之下▼ Main之上的新
  36. # 脚本页/槽中.记得保存你的工程以使脚本生效.
  37. #
  38. # -----------------------------------------------------------------------------
  39. # 角色备注 - 在数据库-角色中可以使用的备注.
  40. # -----------------------------------------------------------------------------
  41. # <装备槽>
  42. #  内容
  43. #  内容
  44. # </装备槽>
  45. # 设定该角色可装备的装备类型,及装备类型的顺序。将"内容"替换为该角色可用的装备
  46. # 类型名称(本脚本下面),该设定的优先级大于数据库中设定的优先级。为了说明清楚,
  47. # 你也可以将"内容"替换为"装备类型: x"x为0-4间的任意一个数字,数字代表的意思下面
  48. # 有讲。
  49. #
  50. # <初始装备: x>
  51. # <初始装备: x, x>
  52. # 设定该角色的初始装备类型,x为装备类型的id。在数据库中没有新装备槽的初始装备设
  53. # 定时可以使用。
  54. #
  55. # <固定装备: x>
  56. # <固定装备: x, x>
  57. # 固定该角色的x号装备类型。
  58. #
  59. # <禁用装备: x>
  60. # <禁用装备: x, x>
  61. # 禁用该角色的x号装备类型。意思是装备无法放置在该装备槽中。
  62. #
  63. # -----------------------------------------------------------------------------
  64. # 职业备注 - 在数据库-职业中可以使用的备注.
  65. # -----------------------------------------------------------------------------
  66. # <装备槽>
  67. #  内容
  68. #  内容
  69. # </装备槽>
  70. # 设定该职业可装备的装备类型,及装备类型的顺序。将"内容"替换为该职业可用的装备
  71. # 类型名称(本脚本下面),该设定的优先级大于数据库中设定的优先级。为了说明清楚,
  72. # 你也可以将"内容"替换为"装备类型: x"x为0-4间的任意一个数字,数字代表的意思下面
  73. # 有讲
  74. #
  75. # <固定装备: x>
  76. # <固定装备: x, x>
  77. # 固定该职业的x号装备类型。
  78. #
  79. # <禁用装备: x>
  80. # <禁用装备: x, x>
  81. # 禁用该职业的x号装备类型。意思是装备无法放置在该装备槽中。
  82. #
  83. # -----------------------------------------------------------------------------
  84. # 武器备注 - 在数据库-武器中可以使用的备注.
  85. # -----------------------------------------------------------------------------
  86. # <固定装备: x>
  87. # <固定装备: x, x>
  88. # 装备该武器后固定x号装备类型。
  89. #
  90. # <禁用装备: x>
  91. # <禁用装备: x, x>
  92. # 装备该武器后禁用该武器的x号装备类型。意思是装备无法放置在该装备槽中。
  93. #
  94. # -----------------------------------------------------------------------------
  95. # 护甲备注 - 在数据库-护甲中可以使用的备注.
  96. # -----------------------------------------------------------------------------
  97. # <装备类型: x>
  98. # <装备类型: 文本>
  99. # x替换为装备名称(本脚本下面)或装备类型ID,此备注将该护甲归类/视为x号装备类型
  100. #
  101. # <固定装备: x>
  102. # <固定装备: x, x>
  103. # 装备该护甲后固定x号装备类型。
  104. #
  105. # <禁用装备: x>
  106. # <禁用装备: x, x>
  107. # 装备该护甲后禁用该武器的x号装备类型。意思是装备无法放置在该装备槽中。
  108. #
  109. # -----------------------------------------------------------------------------
  110. # 状态备注 - 在数据库-状态中可以使用的备注.
  111. # -----------------------------------------------------------------------------
  112. # <固定装备: x>
  113. # <固定装备: x, x>
  114. # 获得该状态后固定x号装备类型。(配合脚本"战斗中更换装备")
  115. #
  116. # <禁用装备: x>
  117. # <禁用装备: x, x>
  118. # 获得该状态后禁用x号装备类型。意思是装备无法放置在该装备槽中。(配合脚本"战斗中
  119. # 更换装备")
  120. #
  121. #==============================================================================
  122. # ▼ 兼容性
  123. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  124. # 本脚本仅为RPG Maker VX Ace编写.极不可能在无任何修改的情况下运行于RPG Maker VX.
  125. #
  126. #==============================================================================
  127.  
  128. module YEA
  129.   module EQUIP
  130.  
  131.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  132.     # - 通用装备设置 -
  133.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  134.     # 调整默认装备设置,你可以添加新的装备类型,建议不要改得太多,以免出现问题。
  135.     # 下面是默认id对应的装备类型
  136.     #
  137.     # ID   装备类型
  138.     # ---  ------------
  139.     #  0   武器
  140.     #  1   盾牌
  141.     #  2   头盔
  142.     #  3   铠甲
  143.     #  4   饰品
  144.     #
  145.     # 无论你怎么修改以下顺序,武器双持的情况都是不变的:第二个装备类型变为武器(0).
  146.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  147.     # 下面这个数组是默认的可用装备槽即其顺序,应用于一切未通过备注自定义装备槽
  148.     # 的角色。
  149.     DEFAULT_BASE_SLOTS = [0,0,0,0,0,1,2,3,4,5,5,5,5,5]
  150.  
  151.     # 下面这个哈希表用来添加新的装备类型(id为 4+). 你还可以设定其能否被移除,
  152.     # 是否能通过"最强装备"自动选择最强的装备。
  153.     TYPES ={
  154.     # TypeID => ["类型名称", 能否移除?, 能否使用"最强装备"?],
  155.            0 => [   "心灵",       true,     false],
  156.            1 => [   "上衣",      false,     false],
  157.            2 => [   "下装",      false,     false],
  158.            3 => [   "袜子",      false,     false],
  159.            4 => [   "鞋子",      false,     false],
  160.            5 => [   "其它",      false,     false],
  161.            8 => [  "N技能",       true,     false],
  162.            9 => [  "M技能",       true,     false],
  163.           10 => [  "G技能",       true,     false],
  164.           11 => [   "品质",      false,     false],
  165.     } # 别动这个括号.
  166.  
  167.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  168.     # - 装备指令列表 -
  169.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  170.     # 在这里调整装备指令列表(甚至是移除某些指令)下面是指令的解释:
  171.     #
  172.     # -------------------------------------------------------------------------
  173.     # :指令            解释
  174.     # -------------------------------------------------------------------------
  175.     # :equip           激活装备选择窗口. 默认.
  176.     # :optimize        自动为角色选择最强装备. 默认.
  177.     # :clear           移除角色身上的全部装备. 默认
  178.     #
  179.     # 以上为默认的全部可用指令。
  180.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  181.     # 在数组中放置可用的指令.
  182.     COMMAND_LIST =[
  183.       :equip,
  184. #      :optimize,
  185.       :clear,
  186.     # :custom1,
  187.     # :custom2,
  188.     ] # 不要动这个括号.
  189.  
  190.     #--------------------------------------------------------------------------
  191.     # - 装备自定义指令 -
  192.     # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  193.     # 对于那些希望通过本脚本来为装备场景添加特殊效果的人,可以使用下面的哈希表
  194.     # 来管理装备场景中的指令。你可以使用开关来禁用/隐藏指令。如果你不想把指令与
  195.     # 开关相关联,把开关设定为0就行。
  196.     #--------------------------------------------------------------------------
  197.     CUSTOM_EQUIP_COMMANDS ={
  198.     # :指令    => [       "文本",     启用开关,   显示开关,       处理方法],
  199.       :custom1 => [ "自定义名称",            0,          0, :command_name1],
  200.       :custom2 => [ "自定义文本",            0,          0, :command_name2],
  201.     } # 不要动这个括号.
  202.  
  203.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  204.     # - 其他窗口设置 -
  205.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  206.     # 调整装备窗口的视觉效果.
  207.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  208.     # 改变右下角能力值数字的字体大小
  209.     STATUS_FONT_SIZE = 20
  210.  
  211.     # 在更换装备指令中,移除装备指令的图标和文本设定
  212.     REMOVE_EQUIP_ICON = 0
  213.     REMOVE_EQUIP_TEXT = "<移除装备>"
  214.  
  215.     # 装备槽中,无装备的图标和文本.
  216.     NOTHING_ICON = 0
  217.     NOTHING_TEXT = "<空>"
  218.  
  219.   end # EQUIP
  220. end # YEA
  221.  
  222. #==============================================================================
  223. # ▼ 编辑以下内容可能会出现电脑损坏、死机,电脑主人脑袋爆炸、昏迷、死亡或口臭
  224. # 所以编辑了后果自负。
  225. #==============================================================================
  226.  
  227. module YEA
  228.   module REGEXP
  229.   module BASEITEM
  230.  
  231.     EQUIP_SLOTS_ON  = /<(?:EQUIP_SLOTS|装备槽)>/i
  232.     EQUIP_SLOTS_OFF = /<\/(?:EQUIP_SLOTS|装备槽)>/i
  233.  
  234.     EQUIP_TYPE_INT = /<(?:EQUIP_TYPE|装备类型):[ ]*(\d+)>/i
  235.     EQUIP_TYPE_STR = /<(?:EQUIP_TYPE|装备类型):[ ]*(.*)>/i
  236.  
  237.     STARTING_GEAR = /<(?:STARTING_GEAR|初始装备):[ ](\d+(?:\s*,\s*\d+)*)>/i
  238.  
  239.     FIXED_EQUIP = /<(?:FIXED_EQUIP|固定装备):[ ](\d+(?:\s*,\s*\d+)*)>/i
  240.     SEALED_EQUIP = /<(?:SEALED_EQUIP|禁用装备):[ ](\d+(?:\s*,\s*\d+)*)>/i
  241.  
  242.   end # BASEITEM
  243.   end # REGEXP
  244. end # YEA
  245.  
  246. #==============================================================================
  247. # ■ Vocab
  248. #==============================================================================
  249.  
  250. module Vocab
  251.  
  252.   #--------------------------------------------------------------------------
  253.   # overwrite method: self.etype
  254.   #--------------------------------------------------------------------------
  255.   def self.etype(etype)
  256.     return $data_system.terms.etypes[etype] if [0,1,2,3,4].include?(etype)
  257.     return YEA::EQUIP::TYPES[etype][0] if YEA::EQUIP::TYPES.include?(etype)
  258.     return ""
  259.   end
  260.  
  261. end # Vocab
  262.  
  263. #==============================================================================
  264. # ■ Icon
  265. #==============================================================================
  266.  
  267. module Icon
  268.  
  269.   #--------------------------------------------------------------------------
  270.   # self.remove_equip
  271.   #--------------------------------------------------------------------------
  272.   def self.remove_equip; return YEA::EQUIP::REMOVE_EQUIP_ICON; end
  273.  
  274.   #--------------------------------------------------------------------------
  275.   # self.nothing_equip
  276.   #--------------------------------------------------------------------------
  277.   def self.nothing_equip; return YEA::EQUIP::NOTHING_ICON; end
  278.  
  279. end # Icon
  280.  
  281. #==============================================================================
  282. # ■ Numeric
  283. #==============================================================================
  284.  
  285. class Numeric
  286.  
  287.   #--------------------------------------------------------------------------
  288.   # new method: group_digits
  289.   #--------------------------------------------------------------------------
  290.   unless $imported["YEA-CoreEngine"]
  291.   def group; return self.to_s; end
  292.   end # $imported["YEA-CoreEngine"]
  293.  
  294. end # Numeric
  295.  
  296. #==============================================================================
  297. # ■ DataManager
  298. #==============================================================================
  299.  
  300. module DataManager
  301.  
  302.   #--------------------------------------------------------------------------
  303.   # alias method: load_database
  304.   #--------------------------------------------------------------------------
  305.   class <<self; alias load_database_aee load_database; end
  306.   def self.load_database
  307.     load_database_aee
  308.     load_notetags_aee
  309.   end
  310.  
  311.   #--------------------------------------------------------------------------
  312.   # new method: load_notetags_aee
  313.   #--------------------------------------------------------------------------
  314.   def self.load_notetags_aee
  315.     groups = [$data_actors, $data_classes, $data_weapons, $data_armors,
  316.       $data_states]
  317.     for group in groups
  318.       for obj in group
  319.         next if obj.nil?
  320.         obj.load_notetags_aee
  321.       end
  322.     end
  323.   end
  324.  
  325. end # DataManager
  326.  
  327. #==============================================================================
  328. # ■ RPG::BaseItem
  329. #==============================================================================
  330.  
  331. class RPG::BaseItem
  332.  
  333.   #--------------------------------------------------------------------------
  334.   # public instance variables
  335.   #--------------------------------------------------------------------------
  336.   attr_accessor :base_equip_slots
  337.   attr_accessor :fixed_equip_type
  338.   attr_accessor :sealed_equip_type
  339.   attr_accessor :extra_starting_equips
  340.  
  341.   #--------------------------------------------------------------------------
  342.   # common cache: load_notetags_aee
  343.   #--------------------------------------------------------------------------
  344.   def load_notetags_aee
  345.     @base_equip_slots = []
  346.     @equip_slots_on = false
  347.     @fixed_equip_type = []
  348.     @sealed_equip_type = []
  349.     @extra_starting_equips = []
  350.     #---
  351.     self.note.split(/[\r\n]+/).each { |line|
  352.       case line
  353.       #---
  354.       when YEA::REGEXP::BASEITEM::EQUIP_SLOTS_ON
  355.         next unless self.is_a?(RPG::Actor) ||self.is_a?(RPG::Class)
  356.         @equip_slots_on = true
  357.       when YEA::REGEXP::BASEITEM::EQUIP_SLOTS_OFF
  358.         next unless self.is_a?(RPG::Actor) ||self.is_a?(RPG::Class)
  359.         @equip_slots_on = false
  360.       #---
  361.       when YEA::REGEXP::BASEITEM::STARTING_GEAR
  362.         next unless self.is_a?(RPG::Actor)
  363.         $1.scan(/\d+/).each { |num|
  364.         @extra_starting_equips.push(num.to_i) if num.to_i > 0 }
  365.       when YEA::REGEXP::BASEITEM::FIXED_EQUIP
  366.         $1.scan(/\d+/).each { |num|
  367.         @fixed_equip_type.push(num.to_i) if num.to_i > 0 }
  368.       when YEA::REGEXP::BASEITEM::SEALED_EQUIP
  369.         $1.scan(/\d+/).each { |num|
  370.         @sealed_equip_type.push(num.to_i) if num.to_i > 0 }
  371.       #---
  372.       when YEA::REGEXP::BASEITEM::EQUIP_TYPE_INT
  373.         next unless self.is_a?(RPG::Armor)
  374.         @etype_id = [1, $1.to_i].max
  375.       when YEA::REGEXP::BASEITEM::EQUIP_TYPE_STR
  376.         next unless self.is_a?(RPG::Armor)
  377.         for key in YEA::EQUIP::TYPES
  378.           id = key[0]
  379.           next if YEA::EQUIP::TYPES[id][0].upcase != $1.to_s.upcase
  380.           @etype_id = [1, id].max
  381.           break
  382.         end
  383.       #---
  384.       else
  385.         if @equip_slots_on
  386.           case line.upcase
  387.           when /装备类型[ ](\d+)/i, /装备类型:[ ](\d+)/i
  388.             id = $1.to_i
  389.             @base_equip_slots.push(id) if [0,1,2,3,4].include?(id)
  390.             @base_equip_slots.push(id) if YEA::EQUIP::TYPES.include?(id)
  391.           when /WEAPON/i
  392.             @base_equip_slots.push(0)
  393.           when /SHIELD/i
  394.             @base_equip_slots.push(1)
  395.           when /HEAD/i
  396.             @base_equip_slots.push(2)
  397.           when /BODY/i, /ARMOR/i, /ARMOUR/i
  398.             @base_equip_slots.push(3)
  399.           when /ETC/i, /OTHER/i, /ACCESSOR/i
  400.             @base_equip_slots.push(4)
  401.           else
  402.             text = line.upcase.delete(" ")
  403.             for key in YEA::EQUIP::TYPES
  404.               id = key[0]
  405.               next if YEA::EQUIP::TYPES[id][0].upcase.delete(" ")!= text
  406.               @base_equip_slots.push(id)
  407.               break
  408.             end
  409.           end
  410.         end
  411.       end
  412.     } # self.note.split
  413.     #---
  414.     return unless self.is_a?(RPG::Class)
  415.     if @base_equip_slots.empty?
  416.       @base_equip_slots = YEA::EQUIP::DEFAULT_BASE_SLOTS.clone
  417.     end
  418.   end
  419.  
  420. end # RPG::BaseItem
  421.  
  422. #==============================================================================
  423. # ■ Game_Temp
  424. #==============================================================================
  425.  
  426. class Game_Temp
  427.  
  428.   #--------------------------------------------------------------------------
  429.   # public instance variables
  430.   #--------------------------------------------------------------------------
  431.   attr_accessor :eds_actor
  432.   attr_accessor :scene_equip_index
  433.   attr_accessor :scene_equip_oy
  434.  
  435. end # Game_Temp
  436.  
  437. #==============================================================================
  438. # ■ Game_BaseItem
  439. #==============================================================================
  440.  
  441. class Game_BaseItem
  442.  
  443.   #--------------------------------------------------------------------------
  444.   # public instance variables
  445.   #--------------------------------------------------------------------------
  446.   attr_accessor :item_id
  447.  
  448. end # Game_BaseItem
  449.  
  450. #==============================================================================
  451. # ■ Game_BattlerBase
  452. #==============================================================================
  453.  
  454. class Game_BattlerBase
  455.  
  456.   #--------------------------------------------------------------------------
  457.   # alias method: equip_type_fixed?
  458.   #--------------------------------------------------------------------------
  459.   alias game_battlerbase_equip_type_fixed_aee equip_type_fixed?
  460.   def equip_type_fixed?(etype_id)
  461.     return true if fixed_etypes.include?(etype_id) if actor?
  462.     return game_battlerbase_equip_type_fixed_aee(etype_id)
  463.   end
  464.  
  465.   #--------------------------------------------------------------------------
  466.   # alias method: equip_type_sealed?
  467.   #--------------------------------------------------------------------------
  468.   alias game_battlerbase_equip_type_sealed_aee equip_type_sealed?
  469.   def equip_type_sealed?(etype_id)
  470.     return true if sealed_etypes.include?(etype_id) if actor?
  471.     return game_battlerbase_equip_type_sealed_aee(etype_id)
  472.   end
  473.  
  474. end # Game_BattlerBase
  475.  
  476. #==============================================================================
  477. # ■ Game_Actor
  478. #==============================================================================
  479.  
  480. class Game_Actor < Game_Battler
  481.  
  482.   #--------------------------------------------------------------------------
  483.   # alias method: init_equips
  484.   #--------------------------------------------------------------------------
  485.   alias game_actor_init_equips_aee init_equips
  486.   def init_equips(equips)
  487.     game_actor_init_equips_aee(equips)
  488.     equip_extra_starting_equips
  489.   end
  490.  
  491.   #--------------------------------------------------------------------------
  492.   # new method: equip_extra_starting_equips
  493.   #--------------------------------------------------------------------------
  494.   def equip_extra_starting_equips
  495.     for equip_id in actor.extra_starting_equips
  496.       armour = $data_armors[equip_id]
  497.       next if armour.nil?
  498.       etype_id = armour.etype_id
  499.       next unless equip_slots.include?(etype_id)
  500.       slot_id = empty_slot(etype_id)
  501.       @equips[slot_id].set_equip(etype_id == 0, armour.id)
  502.     end
  503.     refresh
  504.   end
  505.  
  506.   #--------------------------------------------------------------------------
  507.   # overwrite method: equip_slots
  508.   #--------------------------------------------------------------------------
  509.   def equip_slots
  510.     return equip_slots_dual if dual_wield?
  511.     return equip_slots_normal
  512.   end
  513.  
  514.   #--------------------------------------------------------------------------
  515.   # new method: equip_slots_normal
  516.   #--------------------------------------------------------------------------
  517.   def equip_slots_normal
  518.     return self.actor.base_equip_slots if self.actor.base_equip_slots != []
  519.     return self.class.base_equip_slots
  520.   end
  521.  
  522.   #--------------------------------------------------------------------------
  523.   # new method: equip_slots_dual
  524.   #--------------------------------------------------------------------------
  525.   def equip_slots_dual
  526.     array = equip_slots_normal.clone
  527.     array[1] = 0 if array.size >= 2
  528.     return array
  529.   end
  530.  
  531.   #--------------------------------------------------------------------------
  532.   # new method: fixed_etypes
  533.   #--------------------------------------------------------------------------
  534.   def fixed_etypes
  535.     array = []
  536.     array |= self.actor.fixed_equip_type
  537.     array |= self.class.fixed_equip_type
  538.     for equip in equips
  539.       next if equip.nil?
  540.       array |= equip.fixed_equip_type
  541.     end
  542.     for state in states
  543.       next if state.nil?
  544.       array |= state.fixed_equip_type
  545.     end
  546.     return array
  547.   end
  548.  
  549.   #--------------------------------------------------------------------------
  550.   # new method: sealed_etypes
  551.   #--------------------------------------------------------------------------
  552.   def sealed_etypes
  553.     array = []
  554.     array |= self.actor.sealed_equip_type
  555.     array |= self.class.sealed_equip_type
  556.     for equip in equips
  557.       next if equip.nil?
  558.       array |= equip.sealed_equip_type
  559.     end
  560.     for state in states
  561.       next if state.nil?
  562.       array |= state.sealed_equip_type
  563.     end
  564.     return array
  565.   end
  566.  
  567.   #--------------------------------------------------------------------------
  568.   # alias method: change_equip
  569.   #--------------------------------------------------------------------------
  570.   alias game_actor_change_equip_aee change_equip
  571.   def change_equip(slot_id, item)
  572.     if item.nil? && !@optimize_clear
  573.       etype_id = equip_slots[slot_id]
  574.       return unless YEA::EQUIP::TYPES[etype_id][1]
  575.     elsif item.nil? && @optimize_clear
  576.       etype_id = equip_slots[slot_id]
  577.       return unless YEA::EQUIP::TYPES[etype_id][2]
  578.     end
  579.     @equips[slot_id] = Game_BaseItem.new if @equips[slot_id].nil?
  580.     game_actor_change_equip_aee(slot_id, item)
  581.   end
  582.  
  583.   #--------------------------------------------------------------------------
  584.   # overwrite method: optimize_equipments
  585.   #--------------------------------------------------------------------------
  586.   def optimize_equipments
  587.     $game_temp.eds_actor = self
  588.     @optimize_clear = true
  589.     clear_equipments
  590.     @optimize_clear = false
  591.     equip_slots.size.times do |i|
  592.       next if !equip_change_ok?(i)
  593.       next unless can_optimize?(i)
  594.       items = $game_party.equip_items.select do |item|
  595.         item.etype_id == equip_slots[i] &&
  596.         equippable?(item) && item.performance >= 0
  597.       end
  598.       change_equip(i, items.max_by {|item| item.performance })
  599.     end
  600.     $game_temp.eds_actor = nil
  601.   end
  602.  
  603.   #--------------------------------------------------------------------------
  604.   # new method: can_optimize?
  605.   #--------------------------------------------------------------------------
  606.   def can_optimize?(slot_id)
  607.     etype_id = equip_slots[slot_id]
  608.     return YEA::EQUIP::TYPES[etype_id][2]
  609.   end
  610.  
  611.   #--------------------------------------------------------------------------
  612.   # alias method: force_change_equip
  613.   #--------------------------------------------------------------------------
  614.   alias game_actor_force_change_equip_aee force_change_equip
  615.   def force_change_equip(slot_id, item)
  616.     @equips[slot_id] = Game_BaseItem.new if @equips[slot_id].nil?
  617.     game_actor_force_change_equip_aee(slot_id, item)
  618.   end
  619.  
  620.   #--------------------------------------------------------------------------
  621.   # alias method: weapons
  622.   #--------------------------------------------------------------------------
  623.   alias game_actor_weapons_aee weapons
  624.   def weapons
  625.     anti_crash_equips
  626.     return game_actor_weapons_aee
  627.   end
  628.  
  629.   #--------------------------------------------------------------------------
  630.   # alias method: armors
  631.   #--------------------------------------------------------------------------
  632.   alias game_actor_armors_aee armors
  633.   def armors
  634.     anti_crash_equips
  635.     return game_actor_armors_aee
  636.   end
  637.  
  638.   #--------------------------------------------------------------------------
  639.   # alias method: equips
  640.   #--------------------------------------------------------------------------
  641.   alias game_actor_equips_aee equips
  642.   def equips
  643.     anti_crash_equips
  644.     return game_actor_equips_aee
  645.   end
  646.  
  647.   #--------------------------------------------------------------------------
  648.   # new method: equips
  649.   #--------------------------------------------------------------------------
  650.   def anti_crash_equips
  651.     for i in 0...@equips.size
  652.       next unless @equips[i].nil?
  653.       @equips[i] = Game_BaseItem.new
  654.     end
  655.   end
  656.  
  657. end # Game_Actor
  658.  
  659. #==============================================================================
  660. # ■ Game_Interpreter
  661. #==============================================================================
  662.  
  663. class Game_Interpreter
  664.  
  665.   #--------------------------------------------------------------------------
  666.   # overwrite method: change equip
  667.   #--------------------------------------------------------------------------
  668.   def command_319
  669.     actor = $game_actors[@params[0]]
  670.     return if actor.nil?
  671.     if @params[1] == 0 && @params[2] != 0
  672.       item = $data_weapons[@params[2]]
  673.       return unless actor.equip_slots.include?(0)
  674.       slot_id = actor.empty_slot(0)
  675.     elsif @params[2] != 0
  676.       item = $data_armors[@params[2]]
  677.       return unless actor.equip_slots.include?(item.etype_id)
  678.       slot_id = actor.empty_slot(item.etype_id)
  679.     else
  680.       slot_id = @params[1]
  681.     end
  682.     actor.change_equip_by_id(slot_id, @params[2])
  683.   end
  684.  
  685. end # Game_Interpreter
  686.  
  687. #==============================================================================
  688. # ■ Window_EquipStatus
  689. #==============================================================================
  690.  
  691. class Window_EquipStatus < Window_Base
  692.  
  693.   #--------------------------------------------------------------------------
  694.   # overwrite method: initialize
  695.   #--------------------------------------------------------------------------
  696.   def initialize(dx, dy)
  697.     super(dx, dy, window_width, Graphics.height - dy)
  698.     @actor = nil
  699.     @temp_actor = nil
  700.     refresh
  701.   end
  702.  
  703.   #--------------------------------------------------------------------------
  704.   # overwrite method: window_width
  705.   #--------------------------------------------------------------------------
  706.   def window_width; return Graphics.width * 2 / 5; end
  707.  
  708.   #--------------------------------------------------------------------------
  709.   # overwrite method: refresh
  710.   #--------------------------------------------------------------------------
  711.   def refresh
  712.     contents.clear
  713.     8.times {|i| draw_item(0, line_height * i, i) }
  714.   end
  715.  
  716.   #--------------------------------------------------------------------------
  717.   # overwrite method: draw_item
  718.   #--------------------------------------------------------------------------
  719.   def draw_item(dx, dy, param_id)
  720.     draw_background_colour(dx, dy)
  721.     draw_param_name(dx + 4, dy, param_id)
  722.     draw_current_param(dx + 4, dy, param_id) if @actor
  723.     drx = (contents.width + 22) / 2
  724.     draw_right_arrow(drx, dy)
  725.     draw_new_param(drx + 22, dy, param_id) if @temp_actor
  726.     reset_font_settings
  727.   end
  728.  
  729.   #--------------------------------------------------------------------------
  730.   # new method: draw_background_colour
  731.   #--------------------------------------------------------------------------
  732.   def draw_background_colour(dx, dy)
  733.     colour = Color.new(0, 0, 0, translucent_alpha/2)
  734.     rect = Rect.new(dx+1, dy+1, contents.width - 2, line_height - 2)
  735.     contents.fill_rect(rect, colour)
  736.   end
  737.  
  738.   #--------------------------------------------------------------------------
  739.   # overwrite method: draw_param_name
  740.   #--------------------------------------------------------------------------
  741.   def draw_param_name(dx, dy, param_id)
  742.     contents.font.size = YEA::EQUIP::STATUS_FONT_SIZE
  743.     change_color(system_color)
  744.     draw_text(dx, dy, contents.width, line_height, Vocab::param(param_id))
  745.   end
  746.  
  747.   #--------------------------------------------------------------------------
  748.   # overwrite method: draw_current_param
  749.   #--------------------------------------------------------------------------
  750.   def draw_current_param(dx, dy, param_id)
  751.     change_color(normal_color)
  752.     dw = (contents.width + 22) / 2
  753.     draw_text(0, dy, dw, line_height, @actor.param(param_id).group, 2)
  754.     reset_font_settings
  755.   end
  756.  
  757.   #--------------------------------------------------------------------------
  758.   # overwrite method: draw_new_param
  759.   #--------------------------------------------------------------------------
  760.   def draw_new_param(dx, dy, param_id)
  761.     contents.font.size = YEA::EQUIP::STATUS_FONT_SIZE
  762.     new_value = @temp_actor.param(param_id)
  763.     change_color(param_change_color(new_value - @actor.param(param_id)))
  764.     draw_text(0, dy, contents.width-4, line_height, new_value.group, 2)
  765.     reset_font_settings
  766.   end
  767.  
  768. end # Window_EquipStatus
  769.  
  770. #==============================================================================
  771. # ■ Window_EquipCommand
  772. #==============================================================================
  773.  
  774. class Window_EquipCommand < Window_HorzCommand
  775.  
  776.   #--------------------------------------------------------------------------
  777.   # overwrite method: make_command_list
  778.   #--------------------------------------------------------------------------
  779.   def make_command_list
  780.     for command in YEA::EQUIP::COMMAND_LIST
  781.       case command
  782.       when :equip
  783.         add_command(Vocab::equip2, :equip)
  784. #      when :optimize
  785. #        add_command(Vocab::optimize, :optimize)
  786.       when :clear
  787.         add_command(Vocab::clear, :clear)
  788.       else
  789.         process_custom_command(command)
  790.       end
  791.     end
  792.   end
  793.  
  794.   #--------------------------------------------------------------------------
  795.   # process_ok
  796.   #--------------------------------------------------------------------------
  797.   def process_ok
  798.     $game_temp.scene_equip_index = index
  799.     $game_temp.scene_equip_oy = self.oy
  800.     super
  801.   end
  802.  
  803.   #--------------------------------------------------------------------------
  804.   # new method: process_custom_command
  805.   #--------------------------------------------------------------------------
  806.   def process_custom_command(command)
  807.     return unless YEA::EQUIP::CUSTOM_EQUIP_COMMANDS.include?(command)
  808.     show = YEA::EQUIP::CUSTOM_EQUIP_COMMANDS[command][2]
  809.     continue = show <= 0 ? true : $game_switches[show]
  810.     return unless continue
  811.     text = YEA::EQUIP::CUSTOM_EQUIP_COMMANDS[command][0]
  812.     switch = YEA::EQUIP::CUSTOM_EQUIP_COMMANDS[command][1]
  813.     enabled = switch <= 0 ? true : $game_switches[switch]
  814.     add_command(text, command, enabled)
  815.   end
  816.  
  817.   #--------------------------------------------------------------------------
  818.   # overwrite method: window_width
  819.   #--------------------------------------------------------------------------
  820.   def window_width; return 160; end
  821.  
  822.   #--------------------------------------------------------------------------
  823.   # overwrite method: contents_width
  824.   #--------------------------------------------------------------------------
  825.   def contents_width; return width - standard_padding * 2; end
  826.  
  827.   #--------------------------------------------------------------------------
  828.   # overwrite method: contents_height
  829.   #--------------------------------------------------------------------------
  830.   def contents_height
  831.     ch = height - standard_padding * 2
  832.     return [ch - ch % item_height, row_max * item_height].max
  833.   end
  834.  
  835.   #--------------------------------------------------------------------------
  836.   # overwrite method: visible_line_number
  837.   #--------------------------------------------------------------------------
  838.   def visible_line_number; return 4; end
  839.  
  840.   #--------------------------------------------------------------------------
  841.   # overwrite method: col_max
  842.   #--------------------------------------------------------------------------
  843.   def col_max; return 1; end
  844.  
  845.   #--------------------------------------------------------------------------
  846.   # overwrite method: item_rect
  847.   #--------------------------------------------------------------------------
  848.   def item_rect(index)
  849.     rect = Rect.new
  850.     rect.width = item_width
  851.     rect.height = item_height
  852.     rect.x = index % col_max * (item_width + spacing)
  853.     rect.y = index / col_max * item_height
  854.     rect
  855.   end
  856.  
  857.   #--------------------------------------------------------------------------
  858.   # overwrite method: ensure_cursor_visible
  859.   #--------------------------------------------------------------------------
  860.   def ensure_cursor_visible
  861.     self.top_row = row if row < top_row
  862.     self.bottom_row = row if row > bottom_row
  863.   end
  864.  
  865.   #--------------------------------------------------------------------------
  866.   # overwrite method: cursor_down
  867.   #--------------------------------------------------------------------------
  868.   def cursor_down(wrap = false)
  869.     if index < item_max - col_max || (wrap && col_max == 1)
  870.       select((index + col_max) % item_max)
  871.     end
  872.   end
  873.  
  874.   #--------------------------------------------------------------------------
  875.   # overwrite method: cursor_up
  876.   #--------------------------------------------------------------------------
  877.   def cursor_up(wrap = false)
  878.     if index >= col_max || (wrap && col_max == 1)
  879.       select((index - col_max + item_max) % item_max)
  880.     end
  881.   end
  882.  
  883.   #--------------------------------------------------------------------------
  884.   # overwrite method: process_pageup
  885.   #--------------------------------------------------------------------------
  886.   def process_pageup
  887.     Sound.play_cursor
  888.     Input.update
  889.     deactivate
  890.     call_handler(:pageup)
  891.   end
  892.  
  893.   #--------------------------------------------------------------------------
  894.   # overwrite method: process_pagedown
  895.   #--------------------------------------------------------------------------
  896.   def process_pagedown
  897.     Sound.play_cursor
  898.     Input.update
  899.     deactivate
  900.     call_handler(:pagedown)
  901.   end
  902.  
  903. end # Window_EquipCommand
  904.  
  905. #==============================================================================
  906. # ■ Window_EquipSlot
  907. #==============================================================================
  908.  
  909. class Window_EquipSlot < Window_Selectable
  910.  
  911.   #--------------------------------------------------------------------------
  912.   # overwrite method: initialize
  913.   #--------------------------------------------------------------------------
  914.   def initialize(dx, dy, dw)
  915.     super(dx, dy, dw, Graphics.height - dy)
  916.     @actor = nil
  917.     refresh
  918.   end
  919.  
  920.   #--------------------------------------------------------------------------
  921.   # overwrite method: window_height
  922.   #--------------------------------------------------------------------------
  923.   def window_height; return self.height; end
  924.  
  925.   #--------------------------------------------------------------------------
  926.   # overwrite method: visible_line_number
  927.   #--------------------------------------------------------------------------
  928.   def visible_line_number; return item_max; end
  929.  
  930.   #--------------------------------------------------------------------------
  931.   # overwrite method: refresh
  932.   #--------------------------------------------------------------------------
  933.   def refresh
  934.     create_contents
  935.     super
  936.   end
  937.  
  938.   #--------------------------------------------------------------------------
  939.   # overwrite method: draw_item
  940.   #--------------------------------------------------------------------------
  941.   def draw_item(index)
  942.     return unless @actor
  943.     rect = item_rect_for_text(index)
  944.     change_color(system_color, enable?(index))
  945.     draw_text(rect.x, rect.y, 92, line_height, slot_name(index))
  946.     item = @actor.equips[index]
  947.     dx = rect.x + 92
  948.     dw = contents.width - dx - 24
  949.     if item.nil?
  950.       draw_nothing_equip(dx, rect.y, false, dw)
  951.     else
  952.       draw_item_name(item, dx, rect.y, enable?(index), dw)
  953.     end
  954.   end
  955.  
  956.   #--------------------------------------------------------------------------
  957.   # new method: draw_nothing_equip
  958.   #--------------------------------------------------------------------------
  959.   def draw_nothing_equip(dx, dy, enabled, dw)
  960.     change_color(normal_color, enabled)
  961.     draw_icon(Icon.nothing_equip, dx, dy, enabled)
  962.     text = YEA::EQUIP::NOTHING_TEXT
  963.     draw_text(dx + 24, dy, dw - 24, line_height, text)
  964.   end
  965.  
  966. end # Window_EquipSlot
  967.  
  968. #==============================================================================
  969. # ■ Window_EquipItem
  970. #==============================================================================
  971.  
  972. class Window_EquipItem < Window_ItemList
  973.  
  974.   #--------------------------------------------------------------------------
  975.   # overwrite method: col_max
  976.   #--------------------------------------------------------------------------
  977.   def col_max; return 1; end
  978.  
  979.   #--------------------------------------------------------------------------
  980.   # overwrite method: slot_id=
  981.   #--------------------------------------------------------------------------
  982.   def slot_id=(slot_id)
  983.     return if @slot_id == slot_id
  984.     @slot_id = slot_id
  985.     @last_item = nil
  986.     self.oy = 0
  987.     refresh
  988.   end
  989.  
  990.   #--------------------------------------------------------------------------
  991.   # overwrite method: draw_item
  992.   #--------------------------------------------------------------------------
  993.   def draw_item(index)
  994.     item = @data[index]
  995.     rect = item_rect(index)
  996.     rect.width -= 4
  997.     if item.nil?
  998.       draw_remove_equip(rect)
  999.       return
  1000.     end
  1001.     dw = contents.width - rect.x - 24
  1002.     draw_item_name(item, rect.x, rect.y, enable?(item), dw)
  1003.     draw_item_number(rect, item)
  1004.   end
  1005.  
  1006.   #--------------------------------------------------------------------------
  1007.   # new method: draw_remove_equip
  1008.   #--------------------------------------------------------------------------
  1009.   def draw_remove_equip(rect)
  1010.     draw_icon(Icon.remove_equip, rect.x, rect.y)
  1011.     text = YEA::EQUIP::REMOVE_EQUIP_TEXT
  1012.     rect.x += 24
  1013.     rect.width -= 24
  1014.     draw_text(rect, text)
  1015.   end
  1016.  
  1017.   #--------------------------------------------------------------------------
  1018.   # overwrite method: include?
  1019.   #--------------------------------------------------------------------------
  1020.   def include?(item)
  1021.     if item.nil? && !@actor.nil?
  1022.       etype_id = @actor.equip_slots[@slot_id]
  1023.       return YEA::EQUIP::TYPES[etype_id][1]
  1024.     end
  1025.     return true if item.nil?
  1026.     return false unless item.is_a?(RPG::EquipItem)
  1027.     return false if @slot_id < 0
  1028.     return false if item.etype_id != @actor.equip_slots[@slot_id]
  1029.     return @actor.equippable?(item)
  1030.   end
  1031.  
  1032.   #--------------------------------------------------------------------------
  1033.   # overwrite method: enable?
  1034.   #--------------------------------------------------------------------------
  1035.   def enable?(item)
  1036.     if item.nil? && !@actor.nil?
  1037.       etype_id = @actor.equip_slots[@slot_id]
  1038.       return YEA::EQUIP::TYPES[etype_id][1]
  1039.     end
  1040.     return @actor.equippable?(item)
  1041.   end
  1042.  
  1043.   #--------------------------------------------------------------------------
  1044.   # new method: show
  1045.   #--------------------------------------------------------------------------
  1046.   def show
  1047.     @last_item = 0
  1048.     update_help
  1049.     super
  1050.   end
  1051.  
  1052.   #--------------------------------------------------------------------------
  1053.   # overwrite method: update_help
  1054.   #--------------------------------------------------------------------------
  1055.   def update_help
  1056.     super
  1057.     return if @actor.nil?
  1058.     return if @status_window.nil?
  1059.     return if @last_item == item
  1060.     @last_item = item
  1061.     temp_actor = Marshal.load(Marshal.dump(@actor))
  1062.     temp_actor.force_change_equip(@slot_id, item)
  1063.     @status_window.set_temp_actor(temp_actor)
  1064.   end
  1065.  
  1066. end # Window_EquipItem
  1067.  
  1068. #==============================================================================
  1069. # ■ Window_EquipActor
  1070. #==============================================================================
  1071.  
  1072. class Window_EquipActor < Window_Base
  1073.  
  1074.   #--------------------------------------------------------------------------
  1075.   # initialize
  1076.   #--------------------------------------------------------------------------
  1077.   def initialize(dx, dy)
  1078.     super(dx, dy, window_width, fitting_height(4))
  1079.     @actor = nil
  1080.   end
  1081.  
  1082.   #--------------------------------------------------------------------------
  1083.   # window_width
  1084.   #--------------------------------------------------------------------------
  1085.   def window_width; return Graphics.width - 160; end
  1086.  
  1087.   #--------------------------------------------------------------------------
  1088.   # actor=
  1089.   #--------------------------------------------------------------------------
  1090.   def actor=(actor)
  1091.     return if @actor == actor
  1092.     @actor = actor
  1093.     refresh
  1094.   end
  1095.  
  1096.   #--------------------------------------------------------------------------
  1097.   # refresh
  1098.   #--------------------------------------------------------------------------
  1099.   def refresh
  1100.     contents.clear
  1101.     return unless @actor
  1102.     draw_actor_face(@actor, 0, 0)
  1103.     draw_actor_simple_status(@actor, 108, line_height / 2)
  1104.   end
  1105.  
  1106. end # Window_EquipActor
  1107.  
  1108. #==============================================================================
  1109. # ■ Scene_Equip
  1110. #==============================================================================
  1111.  
  1112. class Scene_Equip < Scene_MenuBase
  1113.  
  1114.   #--------------------------------------------------------------------------
  1115.   # overwrite method: create_status_window
  1116.   #--------------------------------------------------------------------------
  1117.   def create_status_window
  1118.     wx = Graphics.width - (Graphics.width * 2 / 5)
  1119.     wy = @help_window.height + 120
  1120.     @status_window = Window_EquipStatus.new(wx, wy)
  1121.     @status_window.viewport = @viewport
  1122.     @status_window.actor = @actor
  1123.   end
  1124.  
  1125.   #--------------------------------------------------------------------------
  1126.   # overwrite method: create_command_window
  1127.   #--------------------------------------------------------------------------
  1128.   def create_command_window
  1129.     wx = 0
  1130.     wy = @help_window.height
  1131.     ww = 160
  1132.     @command_window = Window_EquipCommand.new(wx, wy, ww)
  1133.     @command_window.viewport = @viewport
  1134.     @command_window.help_window = @help_window
  1135.     if !$game_temp.scene_equip_index.nil?
  1136.       @command_window.select($game_temp.scene_equip_index)
  1137.       @command_window.oy = $game_temp.scene_equip_oy
  1138.     end
  1139.     $game_temp.scene_equip_index = nil
  1140.     $game_temp.scene_equip_oy = nil
  1141.     @command_window.set_handler(:equip,    method(:command_equip))
  1142. #    @command_window.set_handler(:optimize, method(:command_optimize))
  1143.     @command_window.set_handler(:clear,    method(:command_clear))
  1144.     @command_window.set_handler(:cancel,   method(:return_scene))
  1145.     @command_window.set_handler(:pagedown, method(:next_actor))
  1146.     @command_window.set_handler(:pageup,   method(:prev_actor))
  1147.     process_custom_equip_commands
  1148.     create_actor_window
  1149.   end
  1150.  
  1151.   #--------------------------------------------------------------------------
  1152.   # new method: create_actor_window
  1153.   #--------------------------------------------------------------------------
  1154.   def create_actor_window
  1155.     wy = @help_window.height
  1156.     @actor_window = Window_EquipActor.new(@command_window.width, wy)
  1157.     @actor_window.viewport = @viewport
  1158.     @actor_window.actor = @actor
  1159.   end
  1160.  
  1161.   #--------------------------------------------------------------------------
  1162.   # new method: process_custom_equip_commands
  1163.   #--------------------------------------------------------------------------
  1164.   def process_custom_equip_commands
  1165.     for command in YEA::EQUIP::COMMAND_LIST
  1166.       next unless YEA::EQUIP::CUSTOM_EQUIP_COMMANDS.include?(command)
  1167.       called_method = YEA::EQUIP::CUSTOM_EQUIP_COMMANDS[command][3]
  1168.       @command_window.set_handler(command, method(called_method))
  1169.     end
  1170.   end
  1171.  
  1172.   #--------------------------------------------------------------------------
  1173.   # overwrite method: create_slot_window
  1174.   #--------------------------------------------------------------------------
  1175.   def create_slot_window
  1176.     wx = 0
  1177.     wy = @command_window.y + @command_window.height
  1178.     ww = Graphics.width - @status_window.width
  1179.     @slot_window = Window_EquipSlot.new(wx, wy, ww)
  1180.     @slot_window.viewport = @viewport
  1181.     @slot_window.help_window = @help_window
  1182.     @slot_window.status_window = @status_window
  1183.     @slot_window.actor = @actor
  1184.     @slot_window.set_handler(:ok,       method(:on_slot_ok))
  1185.     @slot_window.set_handler(:cancel,   method(:on_slot_cancel))
  1186.   end
  1187.  
  1188.   #--------------------------------------------------------------------------
  1189.   # overwrite method: create_item_window
  1190.   #--------------------------------------------------------------------------
  1191.   def create_item_window
  1192.     wx = @slot_window.x
  1193.     wy = @slot_window.y
  1194.     ww = @slot_window.width
  1195.     wh = @slot_window.height
  1196.     @item_window = Window_EquipItem.new(wx, wy, ww, wh)
  1197.     @item_window.viewport = @viewport
  1198.     @item_window.help_window = @help_window
  1199.     @item_window.status_window = @status_window
  1200.     @item_window.actor = @actor
  1201.     @item_window.set_handler(:ok,     method(:on_item_ok))
  1202.     @item_window.set_handler(:cancel, method(:on_item_cancel))
  1203.     @slot_window.item_window = @item_window
  1204.     @item_window.hide
  1205.   end
  1206.  
  1207.   #--------------------------------------------------------------------------
  1208.   # alias method: command_optimize
  1209.   #--------------------------------------------------------------------------
  1210. #  alias scene_equip_command_optimize_aee command_optimize
  1211. # def command_optimize
  1212. #    scene_equip_command_optimize_aee
  1213. #    @actor_window.refresh
  1214. #  end
  1215.  
  1216.   #--------------------------------------------------------------------------
  1217.   # alias method: command_clear
  1218.   #--------------------------------------------------------------------------
  1219.   alias scene_equip_command_clear_aee command_clear
  1220.   def command_clear
  1221.     scene_equip_command_clear_aee
  1222.     @actor_window.refresh
  1223.   end
  1224.  
  1225.   #--------------------------------------------------------------------------
  1226.   # alias method: on_slot_ok
  1227.   #--------------------------------------------------------------------------
  1228.   alias scene_equip_on_slot_ok_aee on_slot_ok
  1229.   def on_slot_ok
  1230.     scene_equip_on_slot_ok_aee
  1231.     @slot_window.hide
  1232.     @item_window.refresh
  1233.     @item_window.show
  1234.   end
  1235.  
  1236.   #--------------------------------------------------------------------------
  1237.   # alias method: on_item_ok
  1238.   #--------------------------------------------------------------------------
  1239.   alias scene_equip_on_item_ok_aee on_item_ok
  1240.   def on_item_ok
  1241.     scene_equip_on_item_ok_aee
  1242.     @actor_window.refresh
  1243.     @slot_window.show
  1244.     @item_window.hide
  1245.   end
  1246.  
  1247.   #--------------------------------------------------------------------------
  1248.   # alias method: on_item_cancel
  1249.   #--------------------------------------------------------------------------
  1250.   alias scene_equip_on_item_cancel_aee on_item_cancel
  1251.   def on_item_cancel
  1252.     scene_equip_on_item_cancel_aee
  1253.     @slot_window.show
  1254.     @item_window.hide
  1255.   end
  1256.  
  1257.   #--------------------------------------------------------------------------
  1258.   # alias method: on_actor_change
  1259.   #--------------------------------------------------------------------------
  1260.   alias scene_equip_on_actor_change_aee on_actor_change
  1261.   def on_actor_change
  1262.     scene_equip_on_actor_change_aee
  1263.     @actor_window.actor = @actor
  1264.   end
  1265.  
  1266.   #--------------------------------------------------------------------------
  1267.   # new method: command_name1
  1268.   #--------------------------------------------------------------------------
  1269.   def command_name1
  1270.     # Do nothing.
  1271.   end
  1272.  
  1273.   #--------------------------------------------------------------------------
  1274.   # new method: command_name2
  1275.   #--------------------------------------------------------------------------
  1276.   def command_name2
  1277.     # Do nothing.
  1278.   end
  1279.  
  1280. end # Scene_Equip
  1281.  
  1282. #==============================================================================
  1283. #
  1284. # ▼ End of File
  1285. #
  1286. #==============================================================================

最佳答案

查看完整内容

先获得物品,然后事件脚本 $game_actors[x].change_equip_by_id(y, z) x为数据库角色编号 y为装备位置【从0开始】 z为数据库装备编号

Lv5.捕梦者 (版主)

梦石
22
星屑
11005
在线时间
7336 小时
注册时间
2011-7-2
帖子
380

极短24评委极短23评委极短22评委R考场第七期纪念奖开拓者

2
发表于 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》
-------------------------------------------------------------
回复

使用道具 举报

Lv5.捕梦者 (版主)

梦石
22
星屑
11005
在线时间
7336 小时
注册时间
2011-7-2
帖子
380

极短24评委极短23评委极短22评委R考场第七期纪念奖开拓者

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

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

使用道具 举报

Lv4.逐梦者

梦石
0
星屑
7028
在线时间
878 小时
注册时间
2015-2-10
帖子
248
4
 楼主| 发表于 2021-10-9 16:46:41 | 只看该作者
涅炎 发表于 2021-10-9 16:39
在数据库-角色或者职业的备注栏里,写上

装备类型: 0


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

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-4-29 07:42

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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