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

Project1

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

[RMVA发布] 鸡肋的物品使用条件设定

[复制链接]

Lv4.逐梦者

梦石
0
星屑
9275
在线时间
2504 小时
注册时间
2011-5-20
帖子
15389

开拓者

跳转到指定楼层
1
发表于 2017-11-21 23:25:29 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

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

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

x
RUBY 代码复制
  1. =begin
  2. 给一个物品设置
  3.  
  4. *参考YEP系列脚本
  5. *在RMMV里面,物品通常只有简单的限制来决定它们是否可以在战斗中使用,
  6. *并没有其他可以自定义的情况来决定它们。
  7. *因此,这个插件会提供给你物品使用的更多限制,例如开关、变量、职业等等
  8.  
  9. =end
  10. module Item end
  11. module Item
  12.   Condition = {
  13.     1=>'$game_switches[1]==true && $game_switches[2]',
  14.     2=>'$game_switches[1]',
  15.     3=>'$game_switches[1] && !$game_switches[2]',
  16.     4=>'$game_switches[1] || $game_switches[2]',
  17.   }
  18. end
  19. (1..999).each{|i|Item::Condition[i]||={}}
  20. class RPG::Item
  21.   def condition
  22.     eval(Item::Condition[self.id])
  23.   end
  24. endclass GameBattlerBase
  25.   #--------------------------------------------------------------------------
  26.   # ● 检查物品的使用条件
  27.   #--------------------------------------------------------------------------
  28.   alias item_new_conditions_met? item_conditions_met?(item)
  29.   def item_conditions_met?(item)
  30.     item_new_conditions_met?(item)
  31.     item.condition
  32.   end
  33. end

鸡肋是因为新条件不会直观显示在菜单里



[img]http://service.t.sina.com.cn/widget/qmd/5339802982/c02e16bd/7.png

Lv3.寻梦者

梦石
0
星屑
2724
在线时间
227 小时
注册时间
2016-3-27
帖子
576
2
发表于 2017-11-22 19:59:53 | 只看该作者
使用条件自己写说明里不就OK?
现在还能改名吗qwq
回复 支持 反对

使用道具 举报

Lv4.逐梦者

梦石
0
星屑
9275
在线时间
2504 小时
注册时间
2011-5-20
帖子
15389

开拓者

3
 楼主| 发表于 2017-11-22 21:13:17 | 只看该作者
WantMy蕙 发表于 2017-11-22 19:59
使用条件自己写说明里不就OK?

说明里一行有长度限制

点评

那能不能把详细帮助界面的那个脚本改一下,感觉很好用  发表于 2017-11-25 17:52
[img]http://service.t.sina.com.cn/widget/qmd/5339802982/c02e16bd/7.png
回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
2724
在线时间
227 小时
注册时间
2016-3-27
帖子
576
4
发表于 2017-11-25 17:56:38 | 只看该作者
字体奇怪是因为我换了微软雅黑的字体,用默认就不会


RUBY 代码复制
  1. #encoding:utf-8
  2. #==============================================================================
  3. # ■ 装备说明增强
  4. #------------------------------------------------------------------------------
  5. #  修改了说明窗口,增强了装备的说明 作者:wyongcan  发布于66RPG   转载请注明
  6. #==============================================================================
  7. module Help
  8.   CODE ={
  9.     11 => "属性抗性",
  10.     12 => "弱化抗性",
  11.     13 => "状态抗性",
  12.     14 => "状态免疫",
  13.     21 => "普通能力",
  14.     22 => "添加能力",
  15.     23 => "特殊能力",
  16.     31 => "攻击附带属性",
  17.     32 => "攻击附带状态",
  18.     33 => "攻击速度",
  19.     34 => "添加攻击次数",
  20.     41 => "添加技能类型",
  21.     42 => "禁用技能类型",
  22.     43 => "添加技能",
  23.     44 => "禁用技能",
  24.     51 => "可装备武器类型",
  25.     52 => "可装备护甲类型",
  26.     53 => "固定装备",
  27.     54 => "禁用装备",
  28.     55 => "装备风格",
  29.     61 => "行动次数",
  30.     62 => "特殊标志",
  31.     63 => "消失效果",
  32.     64 => "队伍能力"}
  33.   #特殊标志
  34.   FLAG ={
  35.                 0 => "自动战斗",
  36.                 1 => "擅长防御",
  37.                 2 => "保护弱者",
  38.                 3 => "特技专注"}
  39.   #普通能力
  40.         PARAM ={
  41.                 0 => "生命上限",
  42.                 1 => "魔法上限",
  43.                 2 => "物理攻击",
  44.                 3 => "物理防御",
  45.                 4 => "魔法攻击",
  46.                 5 => "魔法防御",
  47.                 6 => "敏 捷 值",
  48.                 7 => "幸 运 值"}
  49.   #添加能力
  50.         XPARAM ={
  51.                 0 => "物理命中:",
  52.                 1 => "物理闪避几率:",
  53.                 2 => "必杀几率:",
  54.                 3 => "必杀闪避几率:",
  55.                 4 => "魔法闪避几率:",
  56.                 5 => "魔法反射几率:",
  57.                 6 => "物理反击几率:",
  58.                 7 => "体力值再生速度:",
  59.                 8 => "魔力值再生速度:",
  60.                 9 => "特技值再生速度:"}
  61.   #特殊能力
  62.         SPARAM ={
  63.                 0 => "受到攻击的几率",
  64.                 1 => "防御效果比率",
  65.                 2 => "恢复效果比率",
  66.                 3 => "药理知识",
  67.                 4 => "MP消耗率",
  68.                 5 => "TP消耗率",
  69.                 6 => "物理伤害加成",
  70.                 7 => "魔法伤害加成",
  71.                 8 => "地形伤害加成",
  72.                 9 => "经验加成"}
  73.    #效果范围
  74.          SCOPE ={
  75.                  0 => "特殊",
  76.                  1 => "单个敌人",
  77.                  2 => "全体敌人" ,
  78.                  3 => "一个随机敌人",
  79.                  4 => "两个随机敌人",
  80.                  5 => "三个随机敌人",
  81.                  6 => "四个随机敌人",
  82.                  7 => "单个队友",
  83.                  8 => "全体队友",
  84.                  9 => "单个队友(无法战斗)",
  85.                  10 => "全体队友(无法战斗)",
  86.                  11 => "使用者"}
  87.         @队伍能力 ={
  88.                 0 => "遇敌几率减半",
  89.                 1 => "野外不遇敌",
  90.                 2 => "敌人偷袭无效",
  91.                 3 => "先制攻击几率上升",
  92.                 4 => "获得金钱双倍",
  93.                 5 => "物品掉落几率双倍"}
  94.   def self.ready
  95.     @状态 = {}
  96.     @武器类型 = {}
  97.     @防具类型 = {}
  98.     @属性 = {}
  99.     $data_states.each{|x| @状态[x.id] = x.name if x != nil}
  100.     elements = $data_system.elements
  101.     weapon_types = $data_system.weapon_types
  102.     armor_types = $data_system.armor_types
  103.     elements.each_with_index{|x,y| @属性[y] = x if x != ""}
  104.     weapon_types.each_with_index{|x,y| @武器类型[y] = x if x != ""}
  105.     armor_types.each_with_index{|x,y| @防具类型[y] = x if x != ""}
  106.   end
  107.   def self.getequiphelp(equip)
  108.     ready if @状态 == nil
  109.     help = ""
  110.     param = []
  111.     equip.params.each_with_index{|x,y| param.push([PARAM[y],x])}
  112.     param = param.select{|x| x[1] != 0}
  113.     param.each{|x| help += x[0] + ":" + x[1].to_s + "\n"}
  114.     features = equip.features
  115.     features.select{|x| x.code == 55}.each{|x| help += CODE[x.code] + ":双持武器" + "\n"}
  116.     features.select{|x| x.code == 11}.each{|x| help += CODE[x.code] + ":" + @属性[x.data_id] + "X" + x.value.to_s + "\n"}
  117.     features.select{|x| x.code == 12}.each{|x| help += CODE[x.code] + ":" + PARAM[x.data_id] + "X" + x.value.to_s + "\n"}
  118.     features.select{|x| x.code == 13}.each{|x| help += CODE[x.code] + ":" + @状态[x.data_id] + "X" + x.value.to_s + "\n"}
  119.     features.select{|x| x.code == 14}.each{|x| help += CODE[x.code] + ":" + @状态[x.data_id] + "\n"}
  120.     features.select{|x| x.code == 31}.each{|x| help += CODE[x.code] + ":" + @属性[x.data_id] + "\n"}
  121.     features.select{|x| x.code == 32}.each{|x| help += CODE[x.code] + ":" + @状态[x.data_id] + "+" + x.value.to_s + "\n"}
  122.     features.select{|x| x.code == 33}.each{|x| help += CODE[x.code] + ":" + x.value.to_s + "\n"}
  123.     features.select{|x| x.code == 34}.each{|x| help += CODE[x.code] + ":" + x.value.to_s + "\n"}
  124.     features.select{|x| x.code == 41}.each{|x| help += CODE[x.code] + ":" + (x.data_id == 1 ? "特技" : "魔法")  + "\n"}
  125.     features.select{|x| x.code == 42}.each{|x| help += CODE[x.code] + ":" + (x.data_id == 1 ? "特技" : "魔法")  + "\n"}
  126.     features.select{|x| x.code == 43}.each{|x| help += CODE[x.code] + ":" + $data_skills[x.data_id].name  + "\n"}
  127.     features.select{|x| x.code == 44}.each{|x| help += CODE[x.code] + ":" + $data_skills[x.data_id].name  + "\n"}
  128.     features.select{|x| x.code == 51}.each{|x| help += CODE[x.code] + ":" + @武器类型[x.data_id]  + "\n"}
  129.     features.select{|x| x.code == 52}.each{|x| help += CODE[x.code] + ":" + @防具类型[x.data_id]  + "\n"}
  130.     features.select{|x| x.code == 61}.each{|x| help += CODE[x.code] + ":" + x.value.to_s  + "\n"}
  131.     features.select{|x| x.code == 62}.each{|x| help += CODE[x.code] + ":" + FLAG[x.data_id]  + "\n"}
  132.     features.select{|x| x.code == 64}.each{|x| help += CODE[x.code] + ":" + @队伍能力[x.data_id]  + "\n"}
  133.     featuresparam = []
  134.     featuresparam.push features.select{|x| x.code == 21}
  135.     featuresparam.push features.select{|x| x.code == 22}
  136.     featuresparam.push features.select{|x| x.code == 23}
  137.     featuresparam[0].each{|x| help += PARAM[x.data_id] + "X" + x.value.to_s + "\n"}
  138.     featuresparam[1].each{|x| help += XPARAM[x.data_id] + x.value.to_s + "\n"}
  139.     featuresparam[2].each{|x| help += SPARAM[x.data_id] + "X" + x.value.to_s + "\n"}
  140.     help
  141.   end
  142.   def self.getline(text,maxtext)
  143.     xtext = []
  144.     line = 12 #修改长度的地方
  145.     text.each_line{|x| xtext.push x.sub(/\n/){}}
  146.     xtext.each{|x| x.size % maxtext != 0 ? line += x.size / maxtext + 1 : line += x.size / maxtext}
  147.     line
  148.   end
  149. end
  150. #==============================================================================
  151. # ■ Window_Help
  152. #------------------------------------------------------------------------------
  153. #  显示特技和物品等的说明、以及角色状态的窗口
  154. #==============================================================================
  155.  
  156. class Window_Help < Window_Base
  157.   #--------------------------------------------------------------------------
  158.   # ● 初始化对象
  159.   #--------------------------------------------------------------------------
  160.   def initialize(line_number = 0)
  161.     super(0, 0, 260, 0)
  162.     self.z = 150
  163.     contents.font.size = 14
  164.     hide
  165.   end
  166.   #--------------------------------------------------------------------------
  167.   # ● 设置内容
  168.   #--------------------------------------------------------------------------
  169.   def set_text(text)
  170.     if text != @text
  171.       @text = text
  172.       refresh
  173.     end
  174.   end
  175.   #--------------------------------------------------------------------------
  176.   # ● 清除
  177.   #--------------------------------------------------------------------------
  178.   def clear
  179.     set_text("")
  180.   end
  181.   #--------------------------------------------------------------------------
  182.   # ● 更新帮助位置
  183.   #--------------------------------------------------------------------------
  184.   def uppos(index,rect,window)
  185.     self.height = fitting_height2(Help.getline(@xtext,13))
  186.     create_contents
  187.     contents.font.size =  16 #字体大小
  188.     rect.x -= window.ox
  189.     rect.y -= window.oy
  190.     ax = rect.x + rect.width + 10
  191.     ax = rect.x - self.width + 10 if ax + self.width > window.width + 10
  192.     ax += window.x
  193.     ax = 0 if ax < 0
  194.     ay = rect.y + rect.height
  195.     ay = rect.y - self.height if ay + self.height > window.height
  196.     ay += window.y
  197.     ay = 0 if ay < 0
  198.     self.x = ax
  199.     self.y = ay
  200.     set_text(@xtext)
  201.     show
  202.   end
  203.   #--------------------------------------------------------------------------
  204.   # ● 设置物品
  205.   #     item : 技能、物品等
  206.   #--------------------------------------------------------------------------
  207.   def set_item(item)
  208.     if item == nil
  209.       set_text("")
  210.       return
  211.     end
  212.     @xtext = ""
  213.     @xtext = "名称:" + item.name + "\n"
  214.     @xtext += "简介:" + item.description + "\n"
  215.     @xtext += "价格:" + item.price.to_s + "\n" if item.is_a?(RPG::EquipItem) || item.is_a?(RPG::Item)
  216.     @xtext += Help.getequiphelp(item) if item.is_a?(RPG::EquipItem)
  217.     @xtext = @xtext[0,@text.size - 2] if @xtext[@xtext.size - 2,2] == "\n"
  218.   end
  219.   #--------------------------------------------------------------------------
  220.   # ● 刷新
  221.   #--------------------------------------------------------------------------
  222.   def refresh
  223.     contents.clear
  224.     hide if @text == ""
  225.     draw_text_ex(2, 2, @text,width,5,false)
  226.   end
  227. end
  228.  
  229. class Window_Base < Window
  230.   #--------------------------------------------------------------------------
  231.   # ● 计算窗口显示指定行数时的应用高度2*************************
  232.   #--------------------------------------------------------------------------
  233.   def fitting_height2(line_number)
  234.     line_number * contents.font.size + standard_padding * 2
  235.   end
  236. #~ draw_text_ex的增强,使其可以自动换行  原作者:叶子 修改:wyongcan
  237.   #--------------------------------------------------------------------------
  238.   # ● 绘制带有控制符的文本内容
  239.   #   如果传递了width参数的话,会自动换行
  240.   #--------------------------------------------------------------------------
  241.   def draw_text_ex(x, y, text, width = nil,textwidth = nil,normalfont = true)
  242.     reset_font_settings if normalfont == true
  243.     text = convert_escape_characters(text)
  244.     pos = {:x => x, :y => y, :new_x => x, :height => calc_line_height(text)}
  245.     if width != nil
  246.       pos[:height] = contents.font.size
  247.       pos[:width] = width
  248.       pos[:textwidth] = textwidth
  249.     end
  250.     process_character(text.slice!(0, 1), text, pos) until text.empty?
  251.   end
  252.   #--------------------------------------------------------------------------
  253.   # ● 文字的处理
  254.   #     c    : 文字
  255.   #     text : 绘制处理中的字符串缓存(字符串可能会被修改)
  256.   #     pos  : 绘制位置 {:x, :y, :new_x, :height}
  257.   #--------------------------------------------------------------------------
  258.   def process_character(c, text, pos)
  259.     case c
  260.     when "\r"   # 回车
  261.       return
  262.     when "\n"   # 换行
  263.       process_new_line(text, pos)
  264.     when "\f"   # 翻页
  265.       process_new_page(text, pos)
  266.     when "\e"   # 控制符
  267.       process_escape_character(obtain_escape_code(text), text, pos)
  268.     else        # 普通文字
  269.       pos[:textwidth] == nil ? text_width = text_size(c).width : text_width = pos[:textwidth]
  270.       if pos[:width] != nil && pos[:x] - pos[:new_x] + text_width > pos[:width]
  271.         process_new_line(text, pos)
  272.       end
  273.       process_normal_character(c, pos)
  274.     end
  275.   end
  276. end
  277.  
  278. class Window_ItemList < Window_Selectable
  279.   #--------------------------------------------------------------------------
  280.   # ● 更新帮助内容
  281.   #--------------------------------------------------------------------------
  282.   def update_help
  283.     @help_window.set_item(item)
  284.     @help_window.uppos(index,item_rect(index),self) if index != -1 && item != nil
  285.   end
  286. end
  287.  
  288. class Window_SkillList < Window_Selectable
  289.   #--------------------------------------------------------------------------
  290.   # ● 更新帮助内容
  291.   #--------------------------------------------------------------------------
  292.   def update_help
  293.     @help_window.set_item(item)
  294.     @help_window.uppos(index,item_rect(index),self) if index != -1 && item != nil
  295.   end
  296. end
  297.  
  298. class Window_ShopBuy < Window_Selectable
  299.   #--------------------------------------------------------------------------
  300.   # ● 更新帮助内容
  301.   #--------------------------------------------------------------------------
  302.   def update_help
  303.     @help_window.set_item(item) if @help_window
  304.     @help_window.uppos(index,item_rect(index),self) if index != -1 && item != nil && @help_window
  305.     @status_window.item = item if @status_window
  306.   end
  307. end
  308.  
  309. class Window_EquipSlot < Window_Selectable
  310.   #--------------------------------------------------------------------------
  311.   # ● 更新帮助内容
  312.   #--------------------------------------------------------------------------
  313.   def update_help
  314.     super
  315.     @help_window.set_item(item) if @help_window
  316.     @help_window.uppos(index,item_rect(index),self) if index != -1 && item != nil && @help_window
  317.     @status_window.set_temp_actor(nil) if @status_window
  318.   end
  319. end
  320.  
  321. class Scene_Shop < Scene_MenuBase
  322.         alias on_sell_ok_old on_sell_ok
  323.         def on_sell_ok
  324.                 on_sell_ok_old
  325.                 @help_window.hide
  326.         end
  327.         alias on_buy_ok_old on_buy_ok
  328.         def on_buy_ok
  329.                 on_buy_ok_old
  330.                 @help_window.hide
  331.         end
  332.         alias on_number_ok_old on_number_ok
  333.         def on_number_ok
  334.                 on_number_ok_old
  335.     @help_window.refresh
  336.                 @help_window.show
  337.         end
  338.         alias on_number_cancel_old on_number_cancel
  339.         def on_number_cancel
  340.                 on_number_cancel_old
  341.     @help_window.refresh
  342.                 @help_window.show
  343.         end
  344. end
  345.  
  346. class Scene_Title < Scene_Base
  347.   alias start_old start
  348.   def start
  349.     start_old
  350.     Help.ready
  351.   end
  352. end
  353. class Window_Base < Window
  354.         alias old_process_new_line process_new_line
  355.         def process_new_line(text, pos)
  356.     old_process_new_line(text, pos)
  357.                 pos[:height] = contents.font.size if pos[:width] != nil
  358.         end
  359. end
  360. class Scene_ItemBase < Scene_MenuBase
  361.         alias old_on_actor_cancel on_actor_cancel
  362.   def on_actor_cancel
  363.     old_on_actor_cancel
  364.         @help_window.refresh
  365.   end
  366.         alias old_on_actor_ok on_actor_ok
  367.   def on_actor_ok
  368.     old_on_actor_ok
  369.         @help_window.refresh
  370.   end
  371. end
  372. #——————————————————————————————
  373. #以上内容在转载后自己修改了部分内容!请注意—— 冲啊小笼包
  374. #——————————————————————————————


现在还能改名吗qwq
回复 支持 反对

使用道具 举报

Lv4.逐梦者

梦石
0
星屑
9275
在线时间
2504 小时
注册时间
2011-5-20
帖子
15389

开拓者

5
 楼主| 发表于 2017-11-25 20:29:18 | 只看该作者
WantMy蕙 发表于 2017-11-25 17:56
字体奇怪是因为我换了微软雅黑的字体,用默认就不会

应该是改这里吧,你p一下看看对不对的上这个窗口大小,对得上就从这里动一下
  1. def fitting_height2(line_number)
  2.     line_number * contents.font.size + standard_padding * 2
  3.   end
复制代码

点评

OK  发表于 2017-11-25 23:52
[img]http://service.t.sina.com.cn/widget/qmd/5339802982/c02e16bd/7.png
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-4-27 22:12

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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