查看: 1907|回复: 0

[VIPArcher] 【装备栏风格扩展】

[复制链接]

无限の剣制

梦石
0
星屑
10460
在线时间
5019 小时
注册时间
2013-2-28
回帖
4942

开拓者贵宾

发表于 2014-9-18 12:23:12 | 显示全部楼层 |阅读模式

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

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

×
本帖最后由 VIPArcher 于 2015-1-22 01:37 编辑

VA自带的装备风格只有普通和双持武器。你可以用这个脚本进行扩充。使用方法看注释。
  1. #==============================================================================
  2. # +++ 装备栏风格扩展 +++
  3. #------------------------------------------------------------------------------
  4. #  -- 本脚本来自 https://rpg.blue 使用或转载请保留以上信息。
  5. #==============================================================================
  6. #  ■ 新增装备风格
  7. #  by:VIPArcher
  8. # 使用说明:在角色备注栏/职业备注栏里备注 <slot_type:x> 则角色变为x号装备风格,
  9. #   一个角色有多个风同时存在时最终返回x编号最大的那个风格。
  10. #   在防具上备注<etype_id:x>则把该防具设置为第x种类型,默认占用了0-4,追加的由5开始
  11. #   在任何有备注框的地方备注 <fix_equips:x> 固定该位置的装备,固定多个则换行再写
  12. #   在任何有备注框的地方备注 <seal_equips:x> 禁用该位置的装备,禁用多个则换行再写
  13. #   在角色备注栏备注<ini_equips:[a,b,c...n]> 初始化初始装备(此备注将使数据库的初
  14. #   始装备设置失效,并且请把装备对应好位置和确认装备该位置可以装备该装备。)
  15. #   在角色备注栏备注<add_equips:[h,i,j...n]> 追加初始装备(和上面是一样的意思,
  16. #   但是这种不会让数据库的设置无效,只会在后面追加上初始装备。)具体请自己摸索吧
  17. #==============================================================================
  18. $VIPArcherScript ||= {};$VIPArcherScript[:slot_type] = 20140803
  19. #==============================================================================
  20. # ★ 设定部分 ★
  21. #==============================================================================
  22. module VIPArcher

  23.   ETYPE_ADD_NAME = ["腰带", "鞋子"] #设置要增加的装备位置的名字

  24.   SLOT_TYPE = {
  25.   0 => [0,1,2,3,4],    # 普通  
  26.   1 => [0,0,2,3,4],    # 双持武器 (这两个是默认的风格)
  27.   # 从这里开始添加装备风格
  28.   2 => [0,0,0,2,3,4,5],  # 看我索爷三刀流
  29.   3 => [4],            # 窝只是个需要保护的NPC装备只要首饰就够了吧。
  30.   4 => [0,2,3,3],       # 233
  31.   5 => [0,1,2,3,4,5,6] # 这里的5,6对应的类型就是上面追加的类型
  32.   # 在这里继续添加类型。编号越大,优先级越高。

  33.   } # <= 这个大括号不能删
  34.   #--------------------------------------------------------------------------
  35.   # ● 追加装备位置用语
  36.   #--------------------------------------------------------------------------
  37.   def Vocab.etype(etype_id)
  38.     etype_name = $data_system.terms.etypes + ETYPE_ADD_NAME
  39.     etype_name[etype_id]
  40.   end
  41. end
  42. #--------------------------------------------------------------------------------
  43. class RPG::Actor < RPG::BaseItem
  44.   #--------------------------------------------------------------------------
  45.   # ● 初始装备数组
  46.   #--------------------------------------------------------------------------
  47.   alias vip_20141119_equips equips
  48.   def equips
  49.     add_equips = []
  50.     $1.split(",").each {|item|add_equips.push item.to_i} if
  51.     @note =~ /<(?:ini_equips|初始装备)[:]\[(.+?)\]>/i
  52.     return add_equips if add_equips != []
  53.     $1.split(",").each {|item|add_equips.push item.to_i} if
  54.     @note =~ /<(?:add_equips|追加初始装备)[:]\[(.+?)\]>/i
  55.     vip_20141119_equips.clone + add_equips
  56.   end
  57. end
  58. #--------------------------------------------------------------------------------
  59. class RPG::Armor < RPG::EquipItem
  60.   #--------------------------------------------------------------------------
  61.   # ● 装备类型
  62.   #--------------------------------------------------------------------------
  63.   def etype_id
  64.     return @note =~ /<(?:etype_id|装备类型)[:]\s*(.*)>/i ? $1.to_i : @etype_id
  65.   end
  66. end
  67. #--------------------------------------------------------------------------------
  68. class Game_BattlerBase
  69.   #--------------------------------------------------------------------------
  70.   # ● 获取装备风格
  71.   #--------------------------------------------------------------------------
  72.   def slot_type
  73.     slot =[]
  74.     feature_objects.each {|obj| slot.push $1.to_i if
  75.     obj.note  =~ /<(?:slot_type|装备风格)[:]\s*(.*)>/i }
  76.     return slot.max || 0
  77.   end
  78.   #--------------------------------------------------------------------------
  79.   # ● 判定是否固定装备
  80.   #--------------------------------------------------------------------------
  81.   alias vip_20141119_equip_type_fixed? equip_type_fixed?
  82.   def equip_type_fixed?(etype_id)
  83.     fixed_type = []
  84.     feature_objects.each {|obj| obj.note.split(/[\r\n]+/).each {|line|
  85.     fixed_type.push $1.to_i if line =~ /<(?:fix_equips|固定装备)[:]\s*(.*)>/i}}
  86.     fixed_type.include?(etype_id) || vip_20141119_equip_type_fixed?(etype_id)
  87.   end
  88.   #--------------------------------------------------------------------------
  89.   # ● 判定装备是否被禁用
  90.   #--------------------------------------------------------------------------
  91.   alias vip_20141119_equip_type_sealed? equip_type_sealed?
  92.   def equip_type_sealed?(etype_id)
  93.     sealed_type = []
  94.     feature_objects.each {|obj| obj.note.split(/[\r\n]+/).each {|line|
  95.     sealed_type.push $1.to_i if line =~ /<(?:seal_equips|禁用装备)[:]\s*(.*)>/i}}
  96.     sealed_type.include?(etype_id) || vip_20141119_equip_type_sealed?(etype_id)
  97.   end
  98. end
  99. #--------------------------------------------------------------------------------
  100. class Game_Actor < Game_Battler
  101.   #--------------------------------------------------------------------------
  102.   # ● 初始化装备
  103.   #     # 方法覆盖,可能引起冲突
  104.   #--------------------------------------------------------------------------
  105.   def init_equips(equips)
  106.     type_size = VIPArcher::SLOT_TYPE.values.max_by{|type|type.size}.size
  107.     @equips = Array.new(type_size) { Game_BaseItem.new }
  108.     equips.each_with_index do |item_id, i|
  109.       etype_id = index_to_etype_id(i)
  110.       slot_id = empty_slot(etype_id)
  111.       @equips[slot_id].set_equip(etype_id == 0, item_id) if slot_id
  112.     end
  113.     refresh
  114.   end
  115.   #--------------------------------------------------------------------------
  116.   # ● 获取装备栏的数组
  117.   #--------------------------------------------------------------------------
  118.   alias vip_20140803_es equip_slots
  119.   def equip_slots
  120.     return VIPArcher::SLOT_TYPE[slot_type] if
  121.     VIPArcher::SLOT_TYPE[slot_type] != nil
  122.     vip_20140803_es
  123.   end
  124. end
  125. #--------------------------------------------------------------------------------
  126. class Scene_Equip < Scene_MenuBase
  127.   #--------------------------------------------------------------------------
  128.   # ● 生成装备栏窗口
  129.   #--------------------------------------------------------------------------
  130.   alias slot_vip_create_slot_window create_slot_window
  131.   def create_slot_window
  132.     slot_vip_create_slot_window
  133.     @slot_window.create_contents
  134.     @slot_window.refresh
  135.   end
  136.   #--------------------------------------------------------------------------
  137.   # ● 物品“确定”
  138.   #--------------------------------------------------------------------------
  139.   alias slot_vip_on_item_ok on_item_ok
  140.   def on_item_ok
  141.     slot_vip_on_item_ok
  142.     @slot_window.create_contents
  143.     @slot_window.refresh
  144.   end
  145.   #--------------------------------------------------------------------------
  146.   # ● 指令“全部卸下”
  147.   #--------------------------------------------------------------------------
  148.   alias slot_vip_command_clear command_clear
  149.   def command_clear
  150.     slot_vip_command_clear
  151.     @slot_window.create_contents
  152.     @slot_window.refresh
  153.   end
  154.   #--------------------------------------------------------------------------
  155.   # ● 指令“最强装备”
  156.   #--------------------------------------------------------------------------
  157.   alias slot_vip_command_optimize command_optimize
  158.   def command_optimize
  159.     slot_vip_command_optimize
  160.     @slot_window.create_contents
  161.     @slot_window.refresh
  162.   end
  163.   #--------------------------------------------------------------------------
  164.   # ● 切换角色
  165.   #--------------------------------------------------------------------------
  166.   alias slot_vip_on_actor_change on_actor_change
  167.   def on_actor_change
  168.     slot_vip_on_actor_change
  169.     @slot_window.create_contents
  170.     @slot_window.refresh
  171.   end
  172. end
复制代码

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

在本发帖返回顶部