Project1

标题: [修改]装备等级/能力值限制 VA版 (修复BUG) [打印本页]

作者: 雪流星    时间: 2012-2-29 12:16
标题: [修改]装备等级/能力值限制 VA版 (修复BUG)
本帖最后由 雪流星 于 2012-3-15 18:00 编辑

原VX版: http://rpg.blue/forum.php?mod=viewthread&tid=99302

  1. #============================================================================
  2. # 定义装备等级限制方法:在数据库装备备注里写上[LV n] ,LV后有空格,n为等级,
  3. # 同理,定义装备能力值限制方法:
  4. # 备注里写上[ATK n][DEF n][MAT n][MDF n][AGI n][LUK n]。
  5. #            攻击   防御   魔攻   魔防   敏捷   幸运
  6. # 若某项限制不写则没有装备限制。
  7. # 注意这里限制的能力值是人物原始的能力值,不考虑装备、状态的影响,
  8. # 但是考虑事件对能力值的影响。
  9. #==============================================================================
  10. #==============================================================================
  11. # ■ RPG::BaseItem
  12. #==============================================================================
  13. class RPG::BaseItem
  14.   def param_limit(p_id)
  15.     return if p_id == 0 or p_id > 7
  16.     regexp_strings = ["", "LV", "ATK", "DEF", "MAT", "MDF", "AGI", "LUK"]
  17.     m = 0
  18.     regexp = /\[#{regexp_strings[p_id]} (\d+)\]/
  19.     self.note.split(/[\r\n]+/).each { |line|
  20.       m = $1.to_i if line =~ regexp
  21.     }
  22.     return m
  23.   end
  24.   #--------------------------------------------------------------------------
  25.   # ● 判断是否有要求
  26.   #--------------------------------------------------------------------------
  27.   def has_requirement?
  28.     for i in 1..7
  29.       return true if param_limit(i) > 0
  30.     end
  31.     return false
  32.   end
  33. end
  34. class Game_Actor < Game_Battler
  35.   #--------------------------------------------------------------------------
  36.   # ● 判断是否可以装备
  37.   #     item : 物品
  38.   #--------------------------------------------------------------------------
  39.   alias original_equippable? equippable?
  40.   def equippable?(item)
  41.     return unless item
  42.     return true unless item.has_requirement?
  43.     return false if self.level < item.param_limit(1) #等级限制
  44.     for i in 2..7
  45.       return false if actor_param(i) < item.param_limit(i)
  46.     end
  47.     return original_equippable?(item)
  48.   end
  49.   #--------------------------------------------------------------------------
  50.   # ● 计算角色能力值
  51.   #--------------------------------------------------------------------------
  52.   def actor_param(param_id)
  53.     t_p = param_base(param_id) + param_base(param_id)
  54.     return [t_p, param_max(param_id)].min
  55.   end
  56. end

  57. #==============================================================================
  58. # ■ Window_Item
  59. #------------------------------------------------------------------------------
  60. #  物品画面、战斗画面、显示浏览物品的窗口。
  61. #==============================================================================

  62. class Window_ItemList < Window_Selectable
  63.   #--------------------------------------------------------------------------
  64.   # ● 更新帮助文本(自动显示使用物品的等级能力限制)
  65.   #--------------------------------------------------------------------------
  66.   def update_help
  67.     if item.nil?
  68.       @help_window.set_text("")
  69.       return
  70.     end
  71.     newdes = item.description
  72.     if item.has_requirement?
  73.       newdes += "  要求:" if(item.has_requirement?)
  74.       for i in 1..7
  75.         next if item.param_limit(i) == 0
  76.         limit_str = item.param_limit(i).to_s
  77.         newdes += i==1 ? Vocab.level_a : Vocab.param(i) + limit_str
  78.       end
  79.     end
  80.     @help_window.set_text(newdes)
  81.   end
  82. end
  83. class Window_EquipItem < Window_ItemList
  84.   alias original_include? include?
  85.   def include?(item)
  86.     o_equippable = original_include?(item)
  87.     if !o_equippable
  88.       return true if [email protected]?(item)
  89.     end
  90.     return o_equippable
  91.   end
  92.   #--------------------------------------------------------------------------
  93.   # ● 判断是否有效化
  94.   #--------------------------------------------------------------------------
  95.   def enable?(item)
  96.     return true unless item
  97.     return @actor.equippable?(item)
  98.   end
  99. end
复制代码
更新日志:
2012-03-14
* 修复 BUG:修复无法卸下装备的 BUG
* 修复 BUG:修复可装备物品消失的 BUG

2012-03-15
* 更新脚本:优化脚本写法,缩短脚本长度
作者: yujiaiszys    时间: 2012-2-29 13:49
不懂脚本的新人感到愧疚万分啊TVT
脚本搬走了蟹蟹lz~~
TVT话说哪能学到脚本阿,入门的!!
作者: 杂兵天下    时间: 2012-3-1 11:01
首先狂暴顶帖
最近我还打算做装备负重
结果失败
感觉LZ的脚本修改下就可以做成装备负重
拿回去研究下。。。
作者: xuzhengchi    时间: 2012-3-1 16:01
这次不得不说一下“物品颜色”这个脚本了。比如设置[LV 5],不仅需要等级变成5,连物品颜色也变成第五等级的了。好像别的很多调用备注栏的脚本也会出现这种情况。于是希望LZ能不能抽空看看“物品颜色”这个脚本呢?万分感谢!
作者: 杂兵天下    时间: 2012-3-1 17:16
xuzhengchi 发表于 2012-3-1 20:01
这次不得不说一下“物品颜色”这个脚本了。比如设置[LV 5],不仅需要等级变成5,连物品颜色也变成第五等级 ...
  1. #==============================================================================
  2. # [PS0]物品颜色描绘
  3. #      Window_Base_Itemcolor
  4. #------------------------------------------------------------------------------
  5. #     在物品、技能选项中显示物品品质并显示品质框和修改物品名颜色。
  6. #==============================================================================
  7. # [更新记录]
  8. #    - 2012.01.03 By 仲秋启明
  9. #      * 修改为VA定义
  10. #    - 2011.12.27 By 仲秋启明
  11. #      * 移植至RGSS3,遵循PS0协议;
  12. #      * 优化数据库备注中设定方法
  13. #    - 2011.08.22 By 冰舞蝶恋
  14. #      * 蓝本(实用·极简 -- 按品质,给物品描绘色彩边框)
  15. #    - 2010.08.06 By 仲秋启明
  16. #      * 蓝本(物品颜色描绘脚本(完整无冲突版))
  17. #------------------------------------------------------------------------------
  18. # [使用方法]
  19. #    - 替换原Window_Base中的draw_item_name定义或复制到Main之前
  20. #==============================================================================
  21. $_PS0 = {} if $_PS0 == nil  
  22. $_PS0["Window_Base_Itemcolor"] = 20111227
  23. #==============================================================================
  24. # [PS0] 通用配置模块  
  25. #==============================================================================
  26. module PS0
  27.   module Window_Base_Itemcolor
  28.     Color1 = Color.new(255, 255, 255)  # 一般品质的色彩(白,1)
  29.     Color2 = Color.new(128, 255, 128)  # 平庸品质的色彩(绿,2)
  30.     Color3 = Color.new(128, 128, 255)  # 精良品质的色彩(蓝,3)
  31.     Color4 = Color.new(255, 0, 255)    # 卓越品质的色彩(紫,4)
  32.     Color5 = Color.new(255, 128, 128)  # 神秘品质的色彩(红,5)
  33.     Color6 = Color.new(255, 128, 0)    # 传说品质的色彩(橙,6)
  34.     Color7 = Color.new(255, 255, 128)  # 特殊品质的色彩(黄,7)
  35.   end
  36. end
  37. #==============================================================================
  38. # ■ Window_Base
  39. #==============================================================================
  40. class Window_Base < Window
  41.   def draw_item_name(item, x, y, enabled = true, width = 172)
  42.     if item != nil
  43.       n = item.note
  44.       a = n.split{/<(?:Quality|品质)\s*(.+)>/i}
  45.       c = a[1].to_i
  46.       if c <= 1
  47.         color = PS0::Window_Base_Itemcolor::Color1
  48.       elsif c == 2
  49.         color = PS0::Window_Base_Itemcolor::Color2
  50.       elsif c == 3
  51.         color = PS0::Window_Base_Itemcolor::Color3
  52.       elsif c == 4
  53.         color = PS0::Window_Base_Itemcolor::Color4
  54.       elsif c == 5
  55.         color = PS0::Window_Base_Itemcolor::Color5
  56.       elsif c == 6
  57.         color = PS0::Window_Base_Itemcolor::Color6
  58.       elsif c == 7
  59.         color = PS0::Window_Base_Itemcolor::Color7
  60.       else
  61.         color = Color.new(0, 0, 0, 0)
  62.       end
  63.       self.contents.fill_rect(x, y, 24, 1, color)
  64.       self.contents.fill_rect(x, y, 1, 24, color)
  65.       self.contents.fill_rect(x, y+23, 24, 1, color)
  66.       self.contents.fill_rect(x+23, y, 1, 24, color)
  67.       draw_icon(item.icon_index, x, y, enabled)
  68.       change_color(color, enabled)
  69.       draw_text(x + 24, y, width, line_height, item.name)
  70.     end
  71.   end
  72. end
  73. #==============================================================================
  74. # [PS0] End of Script
  75. #==============================================================================
复制代码

作者: nero2351    时间: 2012-3-1 18:41
小菜求教。。用这个脚本后测试,人物装备武器或者护甲时可装备的武器或者护甲没法显示,但是点自动装备又会装备上武器。。
作者: ☆狼★    时间: 2012-3-14 22:26
穿裝時有問題

^^

作者: 雪流星    时间: 2012-3-15 11:40
nero2351 发表于 2012-3-1 04:41
小菜求教。。用这个脚本后测试,人物装备武器或者护甲时可装备的武器或者护甲没法显示,但是点自动装备又会 ...

BUG 已修复


‘‘──雪流星于2012-3-15 18:01补充以下内容

2012-03-15
* 更新脚本:优化脚本写法,缩短脚本长度
’’
作者: xuzhengchi    时间: 2012-3-25 22:04
当设置LV限制时,装备说明里只有LV.,没有数字显示,不知道LZ有么有这个情况?
作者: xsrong    时间: 2012-4-7 16:57
发现BUG,当使用了脚本时,只要角色能力或者等级达到,原本角色不能使用的武器类型也变得可以使用了。
作者: as56901688    时间: 2012-4-14 18:33
谢谢楼主了。。

作者: jy02347315    时间: 2012-7-1 15:53
@xuzhengchi请问你的这个问题解决没有哇?我现在不知道怎么办了。。。


‘‘──jy02347315于2012-7-1 15:54补充以下内容:

[@]雪流星[/@]你的这个有BUG耶。在武器说明中只会出现LV.  但没有后面的数字.
’’


‘‘──jy02347315于2012-7-1 15:54补充以下内容:

[@]雪流星[/@]你的这个有BUG耶。在武器说明中只会出现LV.  但没有后面的数字.
’’
作者: a2219119    时间: 2012-7-6 15:49
脚本有错误......本菜鸟不会改脚本,测试总是会的。


‘‘──a2219119于2012-7-6 15:51补充以下内容:

求楼主帮帮忙改良一下脚本,菜鸟需要这样的脚本!速改!蟹蟹!{:4_113:}
’’

360截图20120706154748328.jpg (55.74 KB, 下载次数: 11)

红色地方都是错误区域

红色地方都是错误区域

作者: 最後一滴淚    时间: 2016-1-29 14:42

  1. #============================================================================
  2. # 定义装备等级限制方法:在数据库装备备注里写上[LV n] ,LV后有空格,n为等级,
  3. # 同理,定义装备能力值限制方法:
  4. # 备注里写上[ATK n][DEF n][MAT n][MDF n][AGI n][LUK n]。
  5. #            攻击   防御   魔攻   魔防   敏捷   幸运
  6. # 若某项限制不写则没有装备限制。
  7. # 注意这里限制的能力值是人物原始的能力值,不考虑装备、状态的影响,
  8. # 但是考虑事件对能力值的影响。
  9. #修复BUG-在武器说明中只会出现LV.
  10. #装备说明把光标调到第二行,不然会出现显示不完整。
  11. #==============================================================================
  12. #==============================================================================
  13. # ■ RPG::BaseItem
  14. #==============================================================================
  15. class RPG::BaseItem
  16.   def param_limit(p_id)
  17.     return if p_id == 0 or p_id > 7
  18.     regexp_strings = ["", "LV", "ATK", "DEF", "MAT", "MDF", "AGI", "LUK"]
  19.     m = 0
  20.     regexp = /\[#{regexp_strings[p_id]} (\d+)\]/
  21.     self.note.split(/[\r\n]+/).each { |line|
  22.       m = $1.to_i if line =~ regexp
  23.     }
  24.     return m
  25.   end
  26.   #--------------------------------------------------------------------------
  27.   # ● 判断是否有要求
  28.   #--------------------------------------------------------------------------
  29.   def has_requirement?
  30.     for i in 1..7
  31.       return true if param_limit(i) > 0
  32.     end
  33.     return false
  34.   end
  35. end
  36. class Game_Actor < Game_Battler
  37.   #--------------------------------------------------------------------------
  38.   # ● 判断是否可以装备
  39.   #     item : 物品
  40.   #--------------------------------------------------------------------------
  41.   alias original_equippable? equippable?
  42.   def equippable?(item)
  43.     return unless item
  44.     return true unless item.has_requirement?
  45.     return false if self.level < item.param_limit(1) #等级限制
  46.     for i in 2..7
  47.       return false if actor_param(i) < item.param_limit(i)
  48.     end
  49.     return original_equippable?(item)
  50.   end
  51.   #--------------------------------------------------------------------------
  52.   # ● 计算角色能力值
  53.   #--------------------------------------------------------------------------
  54.   def actor_param(param_id)
  55.     t_p = param_base(param_id) + param_base(param_id)
  56.     return [t_p, param_max(param_id)].min
  57.   end
  58. end

  59. #==============================================================================
  60. # ■ Window_Item
  61. #------------------------------------------------------------------------------
  62. #  物品画面、战斗画面、显示浏览物品的窗口。
  63. #==============================================================================

  64. class Window_ItemList < Window_Selectable
  65.   #--------------------------------------------------------------------------
  66.   # ● 更新帮助文本(自动显示使用物品的等级能力限制)
  67.   #--------------------------------------------------------------------------
  68.   def update_help
  69.     if item.nil?
  70.       @help_window.set_text("")
  71.       return
  72.     end
  73.     newdes = item.description
  74.     if item.has_requirement?
  75.       newdes += "装备限制:"if(item.has_requirement?)
  76.       for i in 1..7
  77.         next if item.param_limit(i) == 0
  78.         limit_str = Vocab.level_a + item.param_limit(i).to_s
  79.         limit1_str = Vocab.param(i) + item.param_limit(i).to_s
  80.         newdes += i==1 ? limit_str : limit1_str
  81.      end
  82.     end
  83.     @help_window.set_text(newdes)
  84.   end
  85. end
  86. class Window_EquipItem < Window_ItemList
  87.   alias original_include? include?
  88.   def include?(item)
  89.     o_equippable = original_include?(item)
  90.     if !o_equippable
  91.       return true if [email protected]?(item)
  92.     end
  93.     return o_equippable
  94.   end
  95.   #--------------------------------------------------------------------------
  96.   # ● 判断是否有效化
  97.   #--------------------------------------------------------------------------
  98.   def enable?(item)
  99.     return true unless item
  100.     return @actor.equippable?(item)
  101.   end
  102. end
复制代码
这脚本有BUG看那么多年了还没修复,帮修复一下。




欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1