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

Project1

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

(10.12更新)VX物品和装备等级能力限制系统v1.2

 关闭 [复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
1 小时
注册时间
2008-8-3
帖子
976
跳转到指定楼层
1
发表于 2008-8-18 06:46:29 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x

最新动态:
08.10.12
增加了商店里也能显示限制的插件,感谢 龍狼 提出!见本楼最后插件区
08.10.5
在Kissye姐的帮助下终于找到与装备扩张冲突的解决办法!(见下面兼容性说明)感谢Kissye姐!
08.9.9
增加一个状态栏显示裸体无状态能力值的插件,见本楼最后插件区

--------------------------------------------------------------------
脚本的功能就是 ,可以在数据库里面自定义装备需要 人物的等级、攻击力、防御力、精神、敏捷达到一定值以上才可以使用
新更新的补充脚本,连装备以外的普通物品都可以限制

例如,可以和superufo的 升级手动加点系统 一起使用,根据加点方向决定你能穿起什么装备,使用什么物品
---------------------------------------------------------------------
如果发现BUG请一定指出,谢谢,大概差不多是最终版了
------------------------------------------------------------------------
原来发的这个脚本只有达到一定等级才能装备的功能,貌似火星了,
应回帖同志们要求,做了一些改动,增加了能力限制。

普通物品限制写得好辛苦。。。尤其是战斗中的部分
(下面仅发下牢骚,不想看的略过)
  1. 主要就是战斗中2个难点,第一个是使用物品失败,物品如何不消耗,经过沉影大哥等人的指点加上自己的努力,达成了
  2. 然后是最难的,到底限制的是使用者还是使用目标的问题。限制使用者吧,明显不合实际,战斗中一瓶药能否被喝下去,不是看谁拿出来的,而是看丢给谁喝的。。。所以要限制使用目标才对。但是限制使用目标,又有问题了,你丢个炸弹,难道炸弹还要判断敌人等级够不够才爆炸?再说默认敌人无等级,系统直接报错给你看= =最后折腾了半天,最终还是用了兼顾的办法,让用户自定义该限制那一种,具体见下面第3部分的说明。
复制代码

------------------------------------------------------------------------

使用说明:
1.首先是装备需要一定等级能力才能使用的脚本
将下面脚本插入到MAIN前面:


  1. #============================================================================
  2. #         BY drgdrg  (感谢snstar2006提供的提取[]内容代码)
  3. #定义装备等级限制方法:在数据库装备备注里写上[LV n] ,LV后有空格,n为等级,
  4. #同理,定义装备能力值限制方法:备注里写上[ATK n][DEF n][SPI n][AGI n]。
  5. #若某项限制不写则没有装备限制。
  6. #注意这里限制的能力值是人物原始的能力值,不考虑装备、状态的影响,
  7. #但是考虑事件对能力值的影响。
  8. #==============================================================================
  9. #==============================================================================
  10. # ■ RPG::BaseItem
  11. #==============================================================================
  12. class RPG::BaseItem

  13.   def LVlimit                                         #物品要求最低等级
  14.     m = 0
  15.     self.note.split(/[\r\n]+/).each { |line|
  16.       m = $1.to_i if line =~ /\[LV (\d+)\]/
  17.     }   
  18.     return m
  19.   end
  20.   
  21.   def ATKlimit                                        #物品要求最低个人攻击力
  22.     m = 0
  23.     self.note.split(/[\r\n]+/).each { |line|
  24.       m = $1.to_i if line =~ /\[ATK (\d+)\]/
  25.     }   
  26.     return m
  27.   end
  28.   
  29.   def DEFlimit                                        #物品要求最低个人防御力
  30.     m = 0
  31.     self.note.split(/[\r\n]+/).each { |line|
  32.       m = $1.to_i if line =~ /\[DEF (\d+)\]/
  33.     }   
  34.     return m
  35.   end

  36.   def SPIlimit                                        #物品要求最低个人精神力
  37.     m = 0
  38.     self.note.split(/[\r\n]+/).each { |line|
  39.       m = $1.to_i if line =~ /\[SPI (\d+)\]/
  40.     }   
  41.     return m
  42.   end
  43.   
  44.   def AGIlimit                                        #物品要求最低个人敏捷性
  45.     m = 0
  46.     self.note.split(/[\r\n]+/).each { |line|
  47.       m = $1.to_i if line =~ /\[AGI (\d+)\]/
  48.     }   
  49.     return m
  50.   end  
  51. end



  52. #==============================================================================
  53. # ■ Game_Actor
  54. #------------------------------------------------------------------------------
  55. #  处理角色的类。本类在 Game_Actors 类 ($game_actors)
  56. # 的内部使用、Game_Party 类请参考 ($game_party) 。
  57. #==============================================================================

  58. class Game_Actor < Game_Battler  
  59.   #--------------------------------------------------------------------------
  60.   # ● 判断是否可以装备
  61.   #     item : 物品
  62.   #--------------------------------------------------------------------------
  63.   def equippable?(item)
  64.     return false if self.level < item.LVlimit                     #等级限制
  65.     return false if actor.parameters[2, @level] + @atk_plus < item.ATKlimit                   #攻击力限制
  66.     return false if actor.parameters[3, @level] + @def_plus < item.DEFlimit                   #防御力限制
  67.     return false if actor.parameters[4, @level] + @spi_plus < item.SPIlimit                   #精神力限制   
  68.     return false if actor.parameters[5, @level] + @agi_plus < item.AGIlimit                   #敏捷性限制
  69.     if item.is_a?(RPG::Weapon)
  70.       return self.class.weapon_set.include?(item.id)
  71.     elsif item.is_a?(RPG::Armor)
  72.       return false if two_swords_style and item.kind == 0  
  73.       return self.class.armor_set.include?(item.id)
  74.     end
  75.     return false
  76.   end
  77.   
  78. end

  79. #==============================================================================
  80. # ■ Window_Item
  81. #------------------------------------------------------------------------------
  82. #  物品画面、战斗画面、显示浏览物品的窗口。
  83. #==============================================================================

  84. class Window_Item < Window_Selectable
  85.   #--------------------------------------------------------------------------
  86.   # ● 更新帮助文本(自动显示使用物品的等级能力限制)
  87.   #--------------------------------------------------------------------------
  88.   def update_help
  89.    
  90.     if item != nil
  91.       newdes = item.description
  92.       newdes += "  要求:" if(item.LVlimit !=0 or item.ATKlimit !=0 or item.DEFlimit != 0 or item.SPIlimit != 0 or item.AGIlimit != 0)
  93.       newdes += " LV" + item.LVlimit.to_s    if  item.LVlimit != 0
  94.       newdes += " 攻" + item.ATKlimit.to_s   if  item.ATKlimit != 0
  95.       newdes += " 防" + item.DEFlimit.to_s   if  item.DEFlimit != 0
  96.       newdes += " 精" + item.SPIlimit.to_s   if  item.SPIlimit != 0
  97.       newdes += " 敏" + item.AGIlimit.to_s   if  item.AGIlimit != 0
  98.       @help_window.set_text(newdes)
  99.     else
  100.       @help_window.set_text("")
  101.     end
  102.    
  103.   end
  104. end
复制代码


-------------------------------------------------------

2.然后是数据库设定:
在数据库想要限制装备等级的装备(武器或者防具都行)的备注栏里写上[LV n] ,LV后有空格,n为等级,比如[LV 5]则5级以上(包括5级)才可以装备。不写的话,任何等级都能装备
    同理也可以写上限制的攻击力、防御力、精神、敏捷,
    特别注意的是这里的攻击力、防御力、精神、敏捷 指的是人物本身的能力,考虑事件改变的量,但是不考虑装备、状态提升的量,即裸体无状态值,superufo的加点脚本加的能力值也算在内



----------------------------------------------------------------------
3.新增的普通物品也限制的功能:
  1. =begin
  2. 本脚本作为装备要求等级能力值的补充,使用方法与之类似:
  3. 在数据库物品备注里写上[ATK n][DEF n][SPI n][AGI n] 。

  4. 特别地,为了确定战斗中物品等级能力限制的对象,还可以写上[LMTP n] ,
  5. 意为LimitType(限制类型) ,对己物品默认为1,对敌物品强制为0。
  6.     n = 0,表示限制当前使用物品的人,根据使用者等级能力判断可否使用成功,例如要
  7.            对敌人扔飞刀,不是看敌人够不够强,而是看扔的人会不会(对敌物品均为0)
  8. 默认n = 1,表示限制物品使用目标,例如一瓶药水能否使用成功不是看是谁从包里拿出来
  9.            的而是看喝的人够不够格;
  10.     n = 2,表示以上两者都限制,例如一个加全体战斗力的高级卷轴,使用的人要有足够的法
  11.            力,接受效果的人也要有足够的领悟力。
  12.     n 设为大于2的值,则调整为2
  13. 战斗中对敌物品均限制使用者,菜单中的物品均限制使用目标,所以这两者无需限制类型。

  14. 删去本脚本也不会影响装备要求等级能力值的功能,
  15. 但是删去装备要求等级能力值脚本,本脚本将无法独立运行
  16. =end
  17. #==============================================================================
  18. # ■ RPG::BaseItem
  19. #==============================================================================
  20. class RPG::BaseItem
  21.   def LimitType                                         #物品限制类型
  22.     n = 1
  23.     self.note.split(/[\r\n]+/).each { |line|
  24.       n = $1.to_i if line =~ /\[LMTP (\d+)\]/
  25.     }  
  26.     #数值修正
  27.     n = 0 if !self.is_a?(RPG::Weapon) and !self.is_a?(RPG::Armor) and self.for_opponent?
  28.     n = 2 if n > 2                                      
  29.     return n
  30.   end
  31. end
  32. #==============================================================================
  33. # ■ Window_Item
  34. #------------------------------------------------------------------------------
  35. #  物品画面、战斗画面、显示浏览物品的窗口。
  36. #==============================================================================

  37. class Window_Item < Window_Selectable
  38.   #--------------------------------------------------------------------------
  39.   # ● 更新帮助文本(自动显示使用物品的等级能力限制)
  40.   #--------------------------------------------------------------------------
  41.   def update_help
  42.     if item != nil
  43.      newdes = item.description         
  44.      if(item.LVlimit !=0 or item.ATKlimit !=0 or item.DEFlimit != 0 or item.SPIlimit != 0 or item.AGIlimit != 0)
  45.        newdes += "  要求"
  46.        case item.LimitType
  47.        when 0
  48.          newdes += "使用者:"
  49.        when 1
  50.          newdes += "使用目标:"
  51.        when 2
  52.          newdes += "使用者和目标:"
  53.        end
  54.        newdes += " LV" + item.LVlimit.to_s    if  item.LVlimit != 0
  55.        newdes += " 攻" + item.ATKlimit.to_s   if  item.ATKlimit != 0
  56.        newdes += " 防" + item.DEFlimit.to_s   if  item.DEFlimit != 0
  57.        newdes += " 精" + item.SPIlimit.to_s   if  item.SPIlimit != 0
  58.        newdes += " 敏" + item.AGIlimit.to_s   if  item.AGIlimit != 0
  59.      end
  60.        @help_window.set_text(newdes)
  61.     else
  62.       @help_window.set_text("")
  63.     end
  64.   end
  65. end

  66. #==============================================================================
  67. # ■ Game_Actor
  68. #------------------------------------------------------------------------------
  69. #  处理角色的类。本类在 Game_Actors 类 ($game_actors)
  70. # 的内部使用、Game_Party 类请参考 ($game_party) 。
  71. #==============================================================================

  72. class Game_Actor < Game_Battler  
  73.   #--------------------------------------------------------------------------
  74.   # ● 判断是否可以使用
  75.   #     item : 物品
  76.   #--------------------------------------------------------------------------
  77.   
  78.   def item_useable?(item)
  79.     return false if self.level < item.LVlimit                     #等级限制
  80.     return false if actor.parameters[2, @level] + @atk_plus < item.ATKlimit                   #攻击力限制
  81.     return false if actor.parameters[3, @level] + @def_plus < item.DEFlimit                   #防御力限制
  82.     return false if actor.parameters[4, @level] + @spi_plus < item.SPIlimit                   #精神力限制   
  83.     return false if actor.parameters[5, @level] + @agi_plus < item.AGIlimit                   #敏捷性限制
  84.     return true
  85.   end  
  86. end
  87. #==============================================================================
  88. # ■ Scene_Item
  89. #------------------------------------------------------------------------------
  90. #  处理物品画面的类。
  91. #==============================================================================

  92. class Scene_Item < Scene_Base
  93.   #--------------------------------------------------------------------------
  94.   # ● 确定目标
  95.   #    无效的情况下 (能力不足或者在不能战斗的情况下使用恢复剂) 播放 buzzer 的 SE。
  96.   #--------------------------------------------------------------------------
  97.   def determine_target
  98.     used = false
  99.     if @item.for_all?
  100.       for target in $game_party.members
  101.         target.item_effect(target, @item) if target.item_useable?(@item)
  102.         used = true if ( !target.skipped and target.item_useable?(@item) )
  103.       end
  104.     else
  105.       $game_party.last_target_index = @target_window.index
  106.       target = $game_party.members[@target_window.index]
  107.       target.item_effect(target, @item) if target.item_useable?(@item)
  108.       used = true if ( !target.skipped and target.item_useable?(@item) )
  109.     end
  110.     if used
  111.       use_item_nontarget
  112.     else
  113.       Sound.play_buzzer
  114.     end
  115.   end
  116. end
  117. #==============================================================================
  118. # ■ Scene_Battle
  119. #------------------------------------------------------------------------------
  120. #  处理战斗画面的类。
  121. #==============================================================================

  122. class Scene_Battle < Scene_Base

  123.   #--------------------------------------------------------------------------
  124.   # ● 执行战斗行动 : 物品
  125.   #--------------------------------------------------------------------------
  126.   def execute_action_item
  127.     item = @active_battler.action.item
  128.     text = sprintf(Vocab::UseItem, @active_battler.name, item.name)
  129.     @message_window.add_instant_text(text)
  130.     targets = @active_battler.action.make_targets
  131.     $game_temp.common_event_id = item.common_event_id
  132.     used = false                                                 #是否已使用
  133.     for target in targets
  134.       if item.LimitType == 0
  135.         if @active_battler.item_useable?(item)
  136.           display_animation(targets, item.animation_id) if !used #保证动画最多播一次
  137.           target.item_effect(@active_battler, item)
  138.           display_action_effects(target, item)
  139.           used = true
  140.         else
  141.           Sound.play_buzzer
  142.           Sound.play_buzzer
  143.           Sound.play_buzzer
  144. #          $game_message.texts.push("使用者不合要求,物品使用无效!")
  145.         end
  146.       elsif item.LimitType == 1
  147.          if target.item_useable?(item)
  148.            display_animation(targets, item.animation_id) if !used #保证动画最多播一次
  149.            target.item_effect(@active_battler, item)
  150.            display_action_effects(target, item)
  151.            used = true   
  152.          else
  153.            Sound.play_buzzer
  154. #           $game_message.texts.push("目标不合要求,物品使用无效!")
  155.          end
  156.       elsif item.LimitType == 2
  157.          if (target.item_useable?(item) and @active_battler.item_useable?(item))
  158.            display_animation(targets, item.animation_id) if !used #保证动画最多播一次
  159.            target.item_effect(@active_battler, item)
  160.            display_action_effects(target, item)
  161.            used = true   
  162.          else
  163.            Sound.play_buzzer
  164. #           $game_message.texts.push("使用者或目标不合要求,物品使用无效!")
  165.          end
  166.       else
  167.            Sound.play_buzzer
  168. #           $game_message.texts.push("物品使用无效!")
  169.       end
  170.     end
  171.     if used
  172.       $game_party.consume_item(item)
  173.     end
  174.   end
  175. end
复制代码

本脚本作为装备要求等级能力值的补充,使用方法与之类似:
在数据库物品备注里写上[ATK n][DEF n][SPI n][AGI n] 。

特别地,为了确定战斗中物品等级能力限制的对象,还可以写上[LMTP n] ,
意为LimitType(限制类型) ,对己物品默认为1,对敌物品强制为0。
    n = 0,表示限制当前使用物品的人,根据使用者等级能力判断可否使用成功,例如要
           对敌人扔飞刀,不是看敌人够不够强,而是看扔的人会不会(对敌物品均为0)
默认n = 1,表示限制物品使用目标,例如一瓶药水能否使用成功不是看是谁从包里拿出来
           的而是看喝的人够不够格;
    n = 2,表示以上两者都限制,例如一个加全体战斗力的高级卷轴,使用的人要有足够的法
           力,接受效果的人也要有足够的领悟力。
    n 设为大于2的值,则调整为2
战斗中对敌物品均限制使用者,菜单中的物品均限制使用目标,所以这两者无需限制类型。

删去本脚本不会影响装备要求等级能力值的功能,如果觉得用不到物品限制或者担心这个脚本降低兼容性,可以舍弃。
删去装备要求等级能力值脚本,本脚本将无法独立运行


-------------------------------------------------------------------------

4.兼容性:
(1)装备脚本、物品脚本 与 superufo的 升级手动加点1.0 (从RMXP移植来) 兼容,加点增加的能力值算在人物裸体无状态值里。
(2)装备脚本、物品脚本 与 沉影不器 的 《VX新菜单样式》可兼容
(3)装备脚本、物品脚本 与 superufo 的 《VX版物品分类1.8版》 要达成完全兼容,可以将下面的补丁脚本置于《VX版物品分类1.8版》下方(在范例工程中此补丁也可以在MAIN下面找到,要使用时移动到MAIN上面,《VX版物品分类1.8版》下方即可)
(只使用了装备限制脚本的,请用补丁1,装备和物品脚本都使用了的,请用补丁2)
补丁1:

  1. #=====================================================================
  2. #            装备限制 兼容 物品分类 补丁   by DRG
  3. #=====================================================================
  4. class Harts_Window_ItemList < Window_Selectable
  5.   def update_help
  6.    
  7.     if item != nil
  8.       newdes = item.description
  9.       newdes += "  要求:" if(item.LVlimit !=0 or item.ATKlimit !=0 or item.DEFlimit != 0 or item.SPIlimit != 0 or item.AGIlimit != 0)
  10.       newdes += " LV" + item.LVlimit.to_s    if  item.LVlimit != 0
  11.       newdes += " 攻" + item.ATKlimit.to_s   if  item.ATKlimit != 0
  12.       newdes += " 防" + item.DEFlimit.to_s   if  item.DEFlimit != 0
  13.       newdes += " 精" + item.SPIlimit.to_s   if  item.SPIlimit != 0
  14.       newdes += " 敏" + item.AGIlimit.to_s   if  item.AGIlimit != 0
  15.       @help_window.set_text(newdes)
  16.     end
  17.   end
  18.   
  19. end  
复制代码

补丁2:
  1. #=====================================================================
  2. #            装备物品限制 兼容 物品分类 补丁   by DRG
  3. #=====================================================================
  4. class Harts_Window_ItemList < Window_Selectable
  5.   def update_help
  6.     if item != nil
  7.      newdes = item.description         
  8.      if(item.LVlimit !=0 or item.ATKlimit !=0 or item.DEFlimit != 0 or item.SPIlimit != 0 or item.AGIlimit != 0)
  9.        newdes += "  要求"
  10.        case item.LimitType
  11.        when 0
  12.          newdes += "使用者:"
  13.        when 1
  14.          newdes += "使用目标:"
  15.        when 2
  16.          newdes += "使用者和目标:"
  17.        end
  18.        newdes += " LV" + item.LVlimit.to_s    if  item.LVlimit != 0
  19.        newdes += " 攻" + item.ATKlimit.to_s   if  item.ATKlimit != 0
  20.        newdes += " 防" + item.DEFlimit.to_s   if  item.DEFlimit != 0
  21.        newdes += " 精" + item.SPIlimit.to_s   if  item.SPIlimit != 0
  22.        newdes += " 敏" + item.AGIlimit.to_s   if  item.AGIlimit != 0
  23.      end
  24.        @help_window.set_text(newdes)
  25.     else
  26.       @help_window.set_text("")
  27.     end
  28.   end
  29.   
  30. end  
复制代码


PS:(与本人的脚本无关)《VX新菜单样式》与《VX版物品分类1.8版》要兼容,必须以删去VX新菜单样式中的◎ Scene_Item 部分为代价。。。。


(4)已知与某个装备扩充脚本冲突……
解决方法:
装备等级能力限制脚本请换用这个(其实也就在70行加了一句话)
Kissye姐找到的冲突原因,感谢!!
  1. #============================================================================
  2. #         BY drgdrg  (感谢snstar2006提供的提取[]内容代码)
  3. # 感谢Kissye找到与扩张脚本冲突的解决办法
  4. #定义装备等级限制方法:在数据库装备备注里写上[LV n] ,LV后有空格,n为等级,
  5. #同理,定义装备能力值限制方法:备注里写上[ATK n][DEF n][SPI n][AGI n]。
  6. #若某项限制不写则没有装备限制。
  7. #注意这里限制的能力值是人物原始的能力值,不考虑装备、状态的影响,
  8. #但是考虑事件对能力值的影响。
  9. #==============================================================================
  10. #==============================================================================
  11. # ■ RPG::BaseItem
  12. #==============================================================================
  13. class RPG::BaseItem

  14.   def LVlimit                                         #物品要求最低等级
  15.     m = 0
  16.     self.note.split(/[\r\n]+/).each { |line|
  17.       m = $1.to_i if line =~ /\[LV (\d+)\]/
  18.     }
  19.     return m
  20.   end
  21.   
  22.   def ATKlimit                                        #物品要求最低个人攻击力
  23.     m = 0
  24.     self.note.split(/[\r\n]+/).each { |line|
  25.       m = $1.to_i if line =~ /\[ATK (\d+)\]/
  26.     }   
  27.     return m
  28.   end
  29.   
  30.   def DEFlimit                                        #物品要求最低个人防御力
  31.     m = 0
  32.     self.note.split(/[\r\n]+/).each { |line|
  33.       m = $1.to_i if line =~ /\[DEF (\d+)\]/
  34.     }   
  35.     return m
  36.   end

  37.   def SPIlimit                                        #物品要求最低个人精神力
  38.     m = 0
  39.     self.note.split(/[\r\n]+/).each { |line|
  40.       m = $1.to_i if line =~ /\[SPI (\d+)\]/
  41.     }   
  42.     return m
  43.   end
  44.   
  45.   def AGIlimit                                        #物品要求最低个人敏捷性
  46.     m = 0
  47.     self.note.split(/[\r\n]+/).each { |line|
  48.       m = $1.to_i if line =~ /\[AGI (\d+)\]/
  49.     }   
  50.     return m
  51.   end  
  52. end



  53. #==============================================================================
  54. # ■ Game_Actor
  55. #------------------------------------------------------------------------------
  56. #  处理角色的类。本类在 Game_Actors 类 ($game_actors)
  57. # 的内部使用、Game_Party 类请参考 ($game_party) 。
  58. #==============================================================================

  59. class Game_Actor < Game_Battler  
  60.   #--------------------------------------------------------------------------
  61.   # ● 判断是否可以装备
  62.   #     item : 物品
  63.   #--------------------------------------------------------------------------
  64.   def equippable?(item)
  65.     return false if item.nil?    #加上这句     BY   Kissye
  66.     return false if self.level < item.LVlimit                     #等级限制
  67.     return false if actor.parameters[2, @level] + @atk_plus < item.ATKlimit                   #攻击力限制
  68.     return false if actor.parameters[3, @level] + @def_plus < item.DEFlimit                   #防御力限制
  69.     return false if actor.parameters[4, @level] + @spi_plus < item.SPIlimit                   #精神力限制   
  70.     return false if actor.parameters[5, @level] + @agi_plus < item.AGIlimit                   #敏捷性限制
  71.     if item.is_a?(RPG::Weapon)
  72.       return self.class.weapon_set.include?(item.id)
  73.     elsif item.is_a?(RPG::Armor)
  74.       return false if two_swords_style and item.kind == 0  
  75.       return self.class.armor_set.include?(item.id)
  76.     end
  77.     return false
  78.   end
  79.   
  80. end

  81. #==============================================================================
  82. # ■ Window_Item
  83. #------------------------------------------------------------------------------
  84. #  物品画面、战斗画面、显示浏览物品的窗口。
  85. #==============================================================================

  86. class Window_Item < Window_Selectable
  87.   #--------------------------------------------------------------------------
  88.   # ● 更新帮助文本(自动显示使用物品的等级能力限制)
  89.   #--------------------------------------------------------------------------
  90.   def update_help
  91.    
  92.     if item != nil
  93.       newdes = item.description
  94.       newdes += "  要求:" if(item.LVlimit !=0 or item.ATKlimit !=0 or item.DEFlimit != 0 or item.SPIlimit != 0 or item.AGIlimit != 0)
  95.       newdes += " LV" + item.LVlimit.to_s    if  item.LVlimit != 0
  96.       newdes += " 攻" + item.ATKlimit.to_s   if  item.ATKlimit != 0
  97.       newdes += " 防" + item.DEFlimit.to_s   if  item.DEFlimit != 0
  98.       newdes += " 精" + item.SPIlimit.to_s   if  item.SPIlimit != 0
  99.       newdes += " 敏" + item.AGIlimit.to_s   if  item.AGIlimit != 0
  100.       @help_window.set_text(newdes)
  101.     else
  102.       @help_window.set_text("")
  103.     end
  104.    
  105.   end
  106. end
复制代码

(5)修改过的类一览:
装备限制部分:

  1. class RPG::BaseItem
  2. 新增函数:LVlimit ,ATKlimit ,DEFlimit ,SPIlimit ,AGIlimit

  3. class Game_Actor < Game_Battler  
  4. 修改函数:equippable?(item)

  5. class Window_Item < Window_Selectable
  6. 修改函数:update_help
复制代码


物品限制部分:

  1. class RPG::BaseItem
  2. 新增函数:LimitType

  3. class Window_Item < Window_Selectable
  4. 修改函数:update_help

  5. class Game_Actor < Game_Battler
  6. 新增函数:item_useable?(item)

  7. class Scene_Item < Scene_Base
  8. 修改函数:determine_target

  9. class Scene_Battle < Scene_Base
  10. 修改函数:execute_action_item
复制代码

可以看出,普通物品限制脚本修改涉及面稍微大一些(5个类),如果担心影响兼容性,制作游戏时没用到这个功能的话可以舍弃这部分脚本





范例下载:
(貌似有点儿童不宜- -)

http://rpg.blue/upload_program/f ...  DRG)_101089404.rar


希望大家有空给这个脚本做极端情况下的测试看看有没有隐藏BUG。。。

---------------------------------------------------------------
新增插件区
===============================================================

9.9新增插件:

随便插在素材区
不用脱光也能在状态栏查看自己的原始能力值了,或许有用吧……
  1. =begin
  2. 随便插在素材区
  3. 不用脱光也能在状态栏查看自己的原始能力值了,或许有用吧……
  4. =end

  5. #==============================================================================
  6. # ■ Game_Battler
  7. #------------------------------------------------------------------------------
  8. #  处理战斗者的类。这个类作为 Game_Actor 类与 Game_Enemy 类的
  9. # 超级类来使用。
  10. #==============================================================================

  11. class Game_Battler
  12.   #--------------------------------------------------------------------------
  13.   # ● 原始能力值
  14.   #     actor : 角色
  15.   #--------------------------------------------------------------------------
  16.   def ori_atk
  17.     n = actor.parameters[2, @level] + @atk_plus
  18.     n = [[Integer(n), 1].max, 999].min
  19.     return n
  20.   end
  21.   #--------------------------------------------------------------------------
  22.   # ● 原始能力值
  23.   #     actor : 角色
  24.   #--------------------------------------------------------------------------
  25.   def ori_def
  26.     n = actor.parameters[3, @level] + @def_plus
  27.     n = [[Integer(n), 1].max, 999].min
  28.     return n
  29.   end
  30.   #--------------------------------------------------------------------------
  31.   # ● 原始能力值
  32.   #     actor : 角色
  33.   #--------------------------------------------------------------------------
  34.   def ori_spi
  35.     n = actor.parameters[4, @level] + @spi_plus
  36.     n = [[Integer(n), 1].max, 999].min
  37.     return n
  38.   end
  39.   #--------------------------------------------------------------------------
  40.   # ● 原始能力值
  41.   #     actor : 角色
  42.   #--------------------------------------------------------------------------
  43.   def ori_agi
  44.     n = actor.parameters[5, @level] + @agi_plus
  45.     n = [[Integer(n), 1].max, 999].min
  46.     return n
  47.   end
  48. end

  49. #==============================================================================
  50. # ■ Window_Base
  51. #------------------------------------------------------------------------------
  52. #  游戏中全部窗口的超级类。
  53. #==============================================================================

  54. class Window_Base < Window
  55.   #--------------------------------------------------------------------------
  56.   # ● 描绘能力值
  57.   #     actor : 角色
  58.   #     x     : 描绘目标 X 坐标
  59.   #     y     : 描绘目标 Y 坐标
  60.   #     type  : 能力值种类 (0~3)
  61.   #--------------------------------------------------------------------------
  62.   def draw_actor_parameter(actor, x, y, type)
  63.     case type
  64.     when 0
  65.       parameter_name = Vocab::atk
  66.       ovalue = actor.ori_atk
  67.       parameter_value = actor.atk
  68.     when 1
  69.       parameter_name = Vocab::def
  70.       ovalue = actor.ori_def
  71.       parameter_value = actor.def
  72.     when 2
  73.       parameter_name = Vocab::spi
  74.       ovalue = actor.ori_spi
  75.       parameter_value = actor.spi
  76.     when 3
  77.       parameter_name = Vocab::agi
  78.       ovalue = actor.ori_agi
  79.       parameter_value = actor.agi
  80.     end
  81.     self.contents.font.color = system_color
  82.     self.contents.draw_text(x, y, 120, WLH, parameter_name)
  83.     self.contents.font.color = normal_color
  84.     self.contents.draw_text(x + 65, y, 36, WLH, ovalue, 2)
  85.     self.contents.draw_text(x + 80, y, 36, WLH, "/",2)
  86.     self.contents.font.color = text_color(24) if parameter_value > ovalue
  87.     self.contents.font.color = text_color(25) if parameter_value < ovalue
  88.     self.contents.draw_text(x + 120, y, 36, WLH, parameter_value, 2)
  89.   end
  90. end
复制代码




10.12新增插件:

作用:商店里也能显示限制
仅使用了装备限制脚本的话,用这个
  1. #商店显示限制插件—for仅使用了装备限制脚本的用户
  2. class Window_ShopBuy < Window_Selectable
  3.   def update_help
  4.     if item != nil
  5.       newdes = item.description
  6.       newdes += "  要求:" if(item.LVlimit !=0 or item.ATKlimit !=0 or item.DEFlimit != 0 or item.SPIlimit != 0 or item.AGIlimit != 0)
  7.       newdes += " LV" + item.LVlimit.to_s    if  item.LVlimit != 0
  8.       newdes += " 攻" + item.ATKlimit.to_s   if  item.ATKlimit != 0
  9.       newdes += " 防" + item.DEFlimit.to_s   if  item.DEFlimit != 0
  10.       newdes += " 精" + item.SPIlimit.to_s   if  item.SPIlimit != 0
  11.       newdes += " 敏" + item.AGIlimit.to_s   if  item.AGIlimit != 0
  12.       @help_window.set_text(newdes)
  13.     else
  14.       @help_window.set_text("")
  15.     end
  16.   end
  17. end
复制代码


连物品限制也都使用了的话,用这个
  1. #商店显示限制插件—for装备物品限制脚本都使用了的用户
  2. class Window_ShopBuy < Window_Selectable
  3.   def update_help
  4.     if item != nil
  5.      newdes = item.description         
  6.      if(item.LVlimit !=0 or item.ATKlimit !=0 or item.DEFlimit != 0 or item.SPIlimit != 0 or item.AGIlimit != 0)
  7.        newdes += "  要求"
  8.        case item.LimitType
  9.        when 0
  10.          newdes += "使用者:"
  11.        when 1
  12.          newdes += "使用目标:"
  13.        when 2
  14.          newdes += "使用者和目标:"
  15.        end
  16.        newdes += " LV" + item.LVlimit.to_s    if  item.LVlimit != 0
  17.        newdes += " 攻" + item.ATKlimit.to_s   if  item.ATKlimit != 0
  18.        newdes += " 防" + item.DEFlimit.to_s   if  item.DEFlimit != 0
  19.        newdes += " 精" + item.SPIlimit.to_s   if  item.SPIlimit != 0
  20.        newdes += " 敏" + item.AGIlimit.to_s   if  item.AGIlimit != 0
  21.      end
  22.        @help_window.set_text(newdes)
  23.     else
  24.       @help_window.set_text("")
  25.     end
  26.   end
  27. end
复制代码




谢谢浏览


Lv3.寻梦者 (暗夜天使)

名侦探小柯

梦石
0
星屑
3251
在线时间
3616 小时
注册时间
2006-9-6
帖子
37398

开拓者贵宾第3届短篇游戏大赛主流游戏组亚军第5届短篇游戏比赛亚军

2
发表于 2008-8-18 06:58:33 | 只看该作者
什么时候变VX区了…… - -
好吧,很有用……
回复 支持 反对

使用道具 举报

Lv2.观梦者

傻♂逼

梦石
0
星屑
369
在线时间
1605 小时
注册时间
2007-3-13
帖子
6562

烫烫烫开拓者

3
发表于 2008-8-18 07:24:27 | 只看该作者
昨天我看到了他:
  1. #==============================================================================
  2. # ■  装备等级限制
  3. #------------------------------------------------------------------------------
  4. #  装备的备注写上[等级 X]
  5. #==============================================================================
  6. module RPG
  7. class Weapon < BaseItem
  8. def equip_level
  9.   @note.split(/[\r\n]+/).each { |line|
  10.   if line =~ /\[(level|等級|等级) \d+\]/
  11.   @a = line.split(/ /)[1]
  12.   @d = ""
  13.   while ((c = @a.slice!(/./m)) != nil)
  14.     @d += c if c != "]"
  15.   end
  16.   end;}
  17.   return @d != "" ? @d.to_i : 0
  18. end
  19. end
  20. class Armor < BaseItem
  21. def equip_level
  22.   @note.split(/[\r\n]+/).each { |line|
  23.   if line =~ /\[(level|等級|等级) \d+\]/
  24.   @a = line.split(/ /)[1]
  25.   @d = ""
  26.   while ((c = @a.slice!(/./m)) != nil)
  27.     @d += c if c != "]"
  28.   end
  29.   end;}
  30.   return @d != "" ? @d.to_i : 0
  31. end
  32. end
  33. end
  34. class Window_EquipItem < Window_Item
  35. def include?(item)
  36. return true if item == nil
  37. if @equip_type == 0
  38.   return false unless item.is_a?(RPG::Weapon) && @actor.level >= item.equip_level
  39. else
  40.   return false unless item.is_a?(RPG::Armor) && @actor.level >= item.equip_level
  41.   return false unless item.kind == @equip_type - 1
  42. end
  43. return @actor.equippable?(item)
  44. end
  45. end
复制代码
哎呀,蛋疼什么的最有爱了
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
1 小时
注册时间
2008-8-3
帖子
976
4
 楼主| 发表于 2008-8-18 07:29:11 | 只看该作者
以下引用yangff于2008-8-17 23:24:27的发言:

昨天我看到了他:
#==============================================================================
# ■  装备等级限制
#------------------------------------------------------------------------------
#  装备的备注写上[等级 X]
#==============================================================================
module RPG
class Weapon < BaseItem
def equip_level
  @note.split(/[\r\n]+/).each { |line|
  if line =~ /\[(level|等級|等级) \d+\]/
  @a = line.split(/ /)[1]
  @d = ""
  while ((c = @a.slice!(/./m)) != nil)
    @d += c if c != "]"
  end
  end;}
  return @d != "" ? @d.to_i : 0
end
end
class Armor < BaseItem
def equip_level
  @note.split(/[\r\n]+/).each { |line|
  if line =~ /\[(level|等級|等级) \d+\]/
  @a = line.split(/ /)[1]
  @d = ""
  while ((c = @a.slice!(/./m)) != nil)
    @d += c if c != "]"
  end
  end;}
  return @d != "" ? @d.to_i : 0
end
end
end
class Window_EquipItem < Window_Item
def include?(item)
return true if item == nil
if @equip_type == 0
  return false unless item.is_a?(RPG::Weapon) && @actor.level >= item.equip_level
else
  return false unless item.is_a?(RPG::Armor) && @actor.level >= item.equip_level
  return false unless item.kind == @equip_type - 1
end
return @actor.equippable?(item)
end
end



为了不火星更新了下,我的脚本现在可以限制能力值了。。。

回复 支持 反对

使用道具 举报

Lv1.梦旅人

B

梦石
0
星屑
50
在线时间
26 小时
注册时间
2007-8-26
帖子
3693
5
发表于 2008-8-22 19:40:18 | 只看该作者
确实很有用,收藏之
回复 支持 反对

使用道具 举报

Lv3.寻梦者 (暗夜天使)

名侦探小柯

梦石
0
星屑
3251
在线时间
3616 小时
注册时间
2006-9-6
帖子
37398

开拓者贵宾第3届短篇游戏大赛主流游戏组亚军第5届短篇游戏比赛亚军

6
发表于 2008-8-23 21:32:09 | 只看该作者
什么时候会自动显示需要几级就好了……
就不用手动写了……
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
1 小时
注册时间
2008-8-3
帖子
976
7
 楼主| 发表于 2008-8-24 19:10:15 | 只看该作者
以下引用越前リョーマ于2008-8-23 13:32:09的发言:

什么时候会自动显示需要几级就好了……
就不用手动写了……



改好了。。。。。谢谢支持
回复 支持 反对

使用道具 举报

Lv3.寻梦者 (暗夜天使)

名侦探小柯

梦石
0
星屑
3251
在线时间
3616 小时
注册时间
2006-9-6
帖子
37398

开拓者贵宾第3届短篇游戏大赛主流游戏组亚军第5届短篇游戏比赛亚军

8
发表于 2008-8-25 00:17:40 | 只看该作者
以下引用drgdrg于2008-8-24 11:10:15的发言:


以下引用越前リョーマ于2008-8-23 13:32:09的发言:

什么时候会自动显示需要几级就好了……
就不用手动写了……




改好了。。。。。谢谢支持

这样就方便多了。
回复 支持 反对

使用道具 举报

头像被屏蔽

Lv1.梦旅人 (禁止发言)

梦石
0
星屑
46
在线时间
10 小时
注册时间
2007-5-27
帖子
2558

第1届Title华丽大赛新人奖

9
发表于 2008-8-25 00:21:25 | 只看该作者
提示: 作者被禁止或删除 内容自动屏蔽
签名被屏蔽
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
55
在线时间
116 小时
注册时间
2008-5-12
帖子
264
10
发表于 2008-8-25 02:20:09 | 只看该作者
有 攻击力限制 精神力限制 和 敏捷力限制的吗
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-4-20 18:01

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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