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

Project1

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

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

[复制链接]

无限の剣制

梦石
0
星屑
9956
在线时间
5019 小时
注册时间
2013-2-28
帖子
5030

开拓者贵宾

跳转到指定楼层
1
发表于 2014-9-18 12:23:12 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

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

VA自带的装备风格只有普通和双持武器。你可以用这个脚本进行扩充。使用方法看注释。
RUBY 代码复制
  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.  
  24.   ETYPE_ADD_NAME = ["腰带", "鞋子"] #设置要增加的装备位置的名字
  25.  
  26.   SLOT_TYPE = {
  27.   0 => [0,1,2,3,4],    # 普通  
  28.   1 => [0,0,2,3,4],    # 双持武器 (这两个是默认的风格)
  29.   # 从这里开始添加装备风格
  30.   2 => [0,0,0,2,3,4,5],  # 看我索爷三刀流
  31.   3 => [4],            # 窝只是个需要保护的NPC装备只要首饰就够了吧。
  32.   4 => [0,2,3,3],       # 233
  33.   5 => [0,1,2,3,4,5,6] # 这里的5,6对应的类型就是上面追加的类型
  34.   # 在这里继续添加类型。编号越大,优先级越高。
  35.  
  36.   } # <= 这个大括号不能删
  37.   #--------------------------------------------------------------------------
  38.   # ● 追加装备位置用语
  39.   #--------------------------------------------------------------------------
  40.   def Vocab.etype(etype_id)
  41.     etype_name = $data_system.terms.etypes + ETYPE_ADD_NAME
  42.     etype_name[etype_id]
  43.   end
  44. end
  45. #--------------------------------------------------------------------------------
  46. class RPG::Actor < RPG::BaseItem
  47.   #--------------------------------------------------------------------------
  48.   # ● 初始装备数组
  49.   #--------------------------------------------------------------------------
  50.   alias vip_20141119_equips equips
  51.   def equips
  52.     add_equips = []
  53.     $1.split(",").each {|item|add_equips.push item.to_i} if
  54.     @note =~ /<(?:ini_equips|初始装备)[:]\[(.+?)\]>/i
  55.     return add_equips if add_equips != []
  56.     $1.split(",").each {|item|add_equips.push item.to_i} if
  57.     @note =~ /<(?:add_equips|追加初始装备)[:]\[(.+?)\]>/i
  58.     vip_20141119_equips.clone + add_equips
  59.   end
  60. end
  61. #--------------------------------------------------------------------------------
  62. class RPG::Armor < RPG::EquipItem
  63.   #--------------------------------------------------------------------------
  64.   # ● 装备类型
  65.   #--------------------------------------------------------------------------
  66.   def etype_id
  67.     return @note =~ /<(?:etype_id|装备类型)[:]\s*(.*)>/i ? $1.to_i : @etype_id
  68.   end
  69. end
  70. #--------------------------------------------------------------------------------
  71. class Game_BattlerBase
  72.   #--------------------------------------------------------------------------
  73.   # ● 获取装备风格
  74.   #--------------------------------------------------------------------------
  75.   def slot_type
  76.     slot =[]
  77.     feature_objects.each {|obj| slot.push $1.to_i if
  78.     obj.note  =~ /<(?:slot_type|装备风格)[:]\s*(.*)>/i }
  79.     return slot.max || 0
  80.   end
  81.   #--------------------------------------------------------------------------
  82.   # ● 判定是否固定装备
  83.   #--------------------------------------------------------------------------
  84.   alias vip_20141119_equip_type_fixed? equip_type_fixed?
  85.   def equip_type_fixed?(etype_id)
  86.     fixed_type = []
  87.     feature_objects.each {|obj| obj.note.split(/[\r\n]+/).each {|line|
  88.     fixed_type.push $1.to_i if line =~ /<(?:fix_equips|固定装备)[:]\s*(.*)>/i}}
  89.     fixed_type.include?(etype_id) || vip_20141119_equip_type_fixed?(etype_id)
  90.   end
  91.   #--------------------------------------------------------------------------
  92.   # ● 判定装备是否被禁用
  93.   #--------------------------------------------------------------------------
  94.   alias vip_20141119_equip_type_sealed? equip_type_sealed?
  95.   def equip_type_sealed?(etype_id)
  96.     sealed_type = []
  97.     feature_objects.each {|obj| obj.note.split(/[\r\n]+/).each {|line|
  98.     sealed_type.push $1.to_i if line =~ /<(?:seal_equips|禁用装备)[:]\s*(.*)>/i}}
  99.     sealed_type.include?(etype_id) || vip_20141119_equip_type_sealed?(etype_id)
  100.   end
  101. end
  102. #--------------------------------------------------------------------------------
  103. class Game_Actor < Game_Battler
  104.   #--------------------------------------------------------------------------
  105.   # ● 初始化装备
  106.   #     # 方法覆盖,可能引起冲突
  107.   #--------------------------------------------------------------------------
  108.   def init_equips(equips)
  109.     type_size = VIPArcher::SLOT_TYPE.values.max_by{|type|type.size}.size
  110.     @equips = Array.new(type_size) { Game_BaseItem.new }
  111.     equips.each_with_index do |item_id, i|
  112.       etype_id = index_to_etype_id(i)
  113.       slot_id = empty_slot(etype_id)
  114.       @equips[slot_id].set_equip(etype_id == 0, item_id) if slot_id
  115.     end
  116.     refresh
  117.   end
  118.   #--------------------------------------------------------------------------
  119.   # ● 获取装备栏的数组
  120.   #--------------------------------------------------------------------------
  121.   alias vip_20140803_es equip_slots
  122.   def equip_slots
  123.     return VIPArcher::SLOT_TYPE[slot_type] if
  124.     VIPArcher::SLOT_TYPE[slot_type] != nil
  125.     vip_20140803_es
  126.   end
  127. end
  128. #--------------------------------------------------------------------------------
  129. class Scene_Equip < Scene_MenuBase
  130.   #--------------------------------------------------------------------------
  131.   # ● 生成装备栏窗口
  132.   #--------------------------------------------------------------------------
  133.   alias slot_vip_create_slot_window create_slot_window
  134.   def create_slot_window
  135.     slot_vip_create_slot_window
  136.     @slot_window.create_contents
  137.     @slot_window.refresh
  138.   end
  139.   #--------------------------------------------------------------------------
  140.   # ● 物品“确定”
  141.   #--------------------------------------------------------------------------
  142.   alias slot_vip_on_item_ok on_item_ok
  143.   def on_item_ok
  144.     slot_vip_on_item_ok
  145.     @slot_window.create_contents
  146.     @slot_window.refresh
  147.   end
  148.   #--------------------------------------------------------------------------
  149.   # ● 指令“全部卸下”
  150.   #--------------------------------------------------------------------------
  151.   alias slot_vip_command_clear command_clear
  152.   def command_clear
  153.     slot_vip_command_clear
  154.     @slot_window.create_contents
  155.     @slot_window.refresh
  156.   end
  157.   #--------------------------------------------------------------------------
  158.   # ● 指令“最强装备”
  159.   #--------------------------------------------------------------------------
  160.   alias slot_vip_command_optimize command_optimize
  161.   def command_optimize
  162.     slot_vip_command_optimize
  163.     @slot_window.create_contents
  164.     @slot_window.refresh
  165.   end
  166.   #--------------------------------------------------------------------------
  167.   # ● 切换角色
  168.   #--------------------------------------------------------------------------
  169.   alias slot_vip_on_actor_change on_actor_change
  170.   def on_actor_change
  171.     slot_vip_on_actor_change
  172.     @slot_window.create_contents
  173.     @slot_window.refresh
  174.   end
  175. end
拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

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

GMT+8, 2024-4-28 14:16

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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