查看: 2317|回复: 2

[已经解决] 如何装备《箭》并配合《弓》才能用?

[复制链接]
梦石
0
星屑
50
在线时间
90 小时
注册时间
2006-5-22
回帖
52
发表于 2013-4-5 10:37:12 | 显示全部楼层 |阅读模式

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

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

×
如何装备《箭》并配合《弓》才能用?

例如一手先装备弓,一手还需装备箭,
但是只有其中一个都无法装备。
梦石
0
星屑
125
在线时间
0 小时
注册时间
2013-4-5
回帖
3
发表于 2013-4-5 12:08:00 | 显示全部楼层
我也同问这一问题.希望高手能来给予解答.
回复

使用道具 举报

梦石
0
星屑
50
在线时间
381 小时
注册时间
2012-8-13
回帖
103
发表于 2013-4-5 12:45:01 | 显示全部楼层
本帖最后由 tyq4590 于 2013-4-5 16:51 编辑

插入本贴提供的脚本,然后在数据库中技能的备注栏里写上:

  1. ITEM:IDxNUMy
复制代码


其中x为物品的id序号,y为技能消耗的物品数量。比如物品‘箭’的id序号是18,则在弓箭技能的备注栏里填写上:

  1. ITEM:ID18NUM1
复制代码


如果要设置一个三连发的箭技,则按照如下设置:

  1. ITEM:ID18NUM3
复制代码


注:脚本是我下载的一个范例工程里的,原帖已经找不到了。因此无法注明出处,请作者海涵!

脚本:

  1. module IISNOW_ITEM_CONSUME_SKILL
  2.   
  3.   PATTERN = /.*ITEM:ID(\d+)NUM(\d+)(.*)/m  
  4.   # 非专业人士请勿修改,正则匹配式,修改后注意备注写法的改变,下同
  5.   PATTERN_E = /.*EQU:ID(\d+).*/m
  6.   PATTERN_A = /.*ARM:ID(\d+).*/m
  7.   STR_UN_CONSUM = "UN" # 物品不消耗标识
  8.   
  9.   TP_ICON = 623  # 你说你懂的
  10.   MP_ICON = 622
  11.   
  12.   STYLE = 2 # 界面风格(支持1,2,3,4效果自己体会,不推荐4)
  13.   STYLE_A = 3 # 提示风格(支持1,2,3,同上)
  14.   PLACE = 1 # 消耗物品的图标与数目间的间距
  15.   PLACE_E = 3 # 不同消耗物品间的间距
  16.   ORDER = [0,1,2]     # 从右往左的消耗显示顺序(0,TP;1,MP;2,物品)
  17.   
  18.   COLOR_ITEM = Color.new(255,255,255) # 物品消耗数目的字的颜色
  19.   COLOR_WE_L = Color.new(255,0,0) # 具体限定武器的框的颜色
  20.   COLOR_WE_A = Color.new(255,0,0) # 具体限定防具的框的颜色
  21.   COLOR_UN_I = Color.new(0,255,0) # 物品限定但不消耗的提示框的颜色
  22.   
  23.   TRAN_DE = 100 # 风格_A2下的透明度再次降低(最大为160)
  24. end

  25. class Window_SkillList
  26.   
  27.   include IISNOW_ITEM_CONSUME_SKILL
  28.   
  29.   def col_max
  30.     case STYLE
  31.     when 1,3,4
  32.       return 2
  33.     when 2
  34.       return 1
  35.     end
  36.   end
  37.   
  38.   def item_height
  39.     case STYLE
  40.     when 3
  41.       line_height * 2
  42.     when 1,2,4
  43.       line_height + 1
  44.     end
  45.   end
  46.   
  47.   def draw_item(index)
  48.     skill = @data[index]
  49.     if skill
  50.       rect = item_rect(index)
  51.       rect.width -= 4
  52.       draw_item_name(skill, rect.x, rect.y, enable?(skill))
  53.       draw_skill_cost(rect, skill)
  54.     end
  55.   end
  56.   
  57.   alias :iisnow_draw_item_name :draw_item_name
  58.   def draw_item_name(item, x, y, enabled = true, width = 172)
  59.     iisnow_draw_item_name(item, x, y, enabled,width)
  60.     rect_temp = text_size(item.name)
  61.     if @actor.skill_eq_limt(item)
  62.       draw_kuang(x + 24 + PLACE  + rect_temp.width,y,24,24,COLOR_WE_L,enabled)
  63.       draw_icon(@actor.skill_eq_limt(item).icon_index,x + 24 + PLACE + rect_temp.width,y,enabled)
  64.       rect_temp.width += (24 + PLACE_E)
  65.     end
  66.     if @actor.skill_ar_limt(item)
  67.       draw_kuang(x + 24 + PLACE + rect_temp.width,y,24,24,COLOR_WE_A,enabled)
  68.       draw_icon(@actor.skill_ar_limt(item).icon_index,x + 24 + PLACE + rect_temp.width,y,enabled)
  69.     end
  70.   end
  71.   
  72.   def draw_skill_cost(rect, skill)
  73.     str = create_string(skill)
  74.     color = [tp_cost_color,mp_cost_color,COLOR_ITEM]
  75.     str.each_with_index do |str,i|
  76.       next unless str
  77.       change_color(color[ORDER[i]], enable?(skill))
  78.       kuang = false
  79.       case i
  80.       when ORDER.index(2)
  81.         icon_index = str[0].icon_index
  82.         kuang = true if str[2]
  83.         str = str[1]
  84.       when ORDER.index(1)
  85.         icon_index = MP_ICON
  86.       when ORDER.index(0)
  87.         icon_index = TP_ICON
  88.       end
  89.       contents.font.size = STYLE == 1 ? Font.default_size + 1 : Font.default_size
  90.       draw_style(icon_index,rect,str,skill,kuang)
  91.     end
  92.     contents.font.size = Font.default_size   
  93.   end
  94.   
  95.   def draw_style(icon_index,rect,str,skill,kuang)
  96.     case STYLE
  97.     when 1      
  98.       draw_kuang(rect.width - 24 + rect.x,rect.y,24,24,COLOR_UN_I,enable?(skill)) if kuang
  99.       draw_icon(icon_index,rect.width - 60 + rect.x,rect.y,enable?(skill))
  100.       draw_text(rect,str,2) if str.to_i != 1
  101.       rect.width -= (24 + PLACE_E)
  102.     when 2,4
  103.       draw_text(rect,str,2) if str.to_i != 1
  104.       rect.width -= (text_size(str).width + PLACE) if str.to_i != 1
  105.       draw_kuang(rect.width - 24 + rect.x,rect.y,24,24,COLOR_UN_I,enable?(skill)) if kuang
  106.       draw_icon(icon_index,rect.width - 24 + rect.x,rect.y,enable?(skill))
  107.       rect.width -= (24 + PLACE_E)
  108.     when 3
  109.       rect_temp = rect.clone
  110.       rect_temp.y += (rect_temp.height / 2)
  111.       rect_temp.height /= 2
  112.       draw_text(rect_temp,str,2) if str.to_i != 1
  113.       rect.width -= (text_size(str).width + PLACE) if str.to_i != 1
  114.       draw_kuang(rect.width - 24 + rect.x,rect_temp.y,24,24,COLOR_UN_I,enable?(skill)) if kuang
  115.       draw_icon(icon_index,rect.width - 24 + rect.x,rect_temp.y,enable?(skill))
  116.       rect.width -= (24 + PLACE_E)
  117.     end
  118.   end
  119.   
  120.   def draw_kuang(x,y,w,h,c,fl)
  121.     c.alpha = fl ? 255 : translucent_alpha - (STYLE_A == 2 ? TRAN_DE : 0)
  122.     case STYLE_A
  123.     when 1
  124.       contents.fill_rect(x,y,w,1,c)
  125.       contents.fill_rect(x,y + 1,1,h - 1,c)
  126.       contents.fill_rect(x + 1,y + h - 1,w - 1,1,c)
  127.       contents.fill_rect(x + w -1,y + 1,1,h - 2,c)
  128.     when 2
  129.       contents.fill_rect(x,y,w,h,c)
  130.     end
  131.   end
  132.   
  133.   def create_string(skill)
  134.     str1 = @actor.skill_tp_cost(skill)
  135.     str2 = @actor.skill_mp_cost(skill)
  136.     str3 = @actor.skill_it_cost(skill)
  137.     str1 = str1 > 0 ?  str1.to_s : nil
  138.     str2 = str2 > 0 ?  str2.to_s : nil
  139.     str3 = str3[1] > 0 ? [str3[0],str3[1].to_s,str3[2]] : nil
  140.     str = [str1,str2,str3]
  141.     iisnow = [str[ORDER[0]],str[ORDER[1]],str[ORDER[2]]]
  142.     iisnow
  143.   end
  144.   
  145. end

  146. class Game_BattlerBase
  147.   
  148.   include IISNOW_ITEM_CONSUME_SKILL
  149.   
  150.   def skill_it_cost(skill)
  151.     skill.note.match(PATTERN)
  152.     item = $data_items[$1.to_i] if $1 != 0
  153.     num = $2.to_i
  154.     flag = $3.match(/^#{STR_UN_CONSUM}/) if $3
  155.     return [item,num,flag]
  156.   end
  157.   
  158.   def skill_eq_limt(skill)
  159.     skill.note.match(PATTERN_E)
  160.     eq = $data_weapons[$1.to_i] if $1 != 0
  161.     return eq
  162.   end
  163.   
  164.   def skill_ar_limt(skill)
  165.     skill.note.match(PATTERN_A)
  166.     eq = $data_armors[$1.to_i] if $1 != 0
  167.     return eq
  168.   end
  169.   
  170.   alias :iisnow_skill_cost_payable? :skill_cost_payable?
  171.   def skill_cost_payable?(skill)
  172.     result1 = iisnow_skill_cost_payable?(skill)
  173.     if skill_it_cost(skill)[0]
  174.       result2 = $game_party.item_number(skill_it_cost(skill)[0]) >= skill_it_cost(skill)[1]
  175.       return result1 && result2
  176.     end
  177.     return result1
  178.   end
  179.   
  180.   alias :iisnow_pay_skill_cost :pay_skill_cost
  181.   def pay_skill_cost(skill)
  182.     iisnow_pay_skill_cost(skill)
  183.     if skill_it_cost(skill)[0] && !skill_it_cost(skill)[2]
  184.       $game_party.gain_item(skill_it_cost(skill)[0],-skill_it_cost(skill)[1])
  185.     end
  186.   end

  187. end

  188. class Game_Actor
  189.   
  190.   alias :iisnow_skill_wtype_ok? :skill_wtype_ok?
  191.   def skill_wtype_ok?(skill)
  192.     result1 = iisnow_skill_wtype_ok?(skill)
  193.     result2 = skill_eq_limt(skill) ? weapons.include?(skill_eq_limt(skill)) : true
  194.     result3 = skill_ar_limt(skill) ? armors.include?(skill_ar_limt(skill)) : true
  195.     return result1 && result2 && result3
  196.   end
  197.   
  198. end
复制代码

点评

有个问题奥。您的代码下,箭是一种道具,弓箭相关的技能消耗箭;如果箭有很多种,则需设置多个箭技能。有没有不消耗箭,且可以有多种箭?  发表于 2013-4-5 13:38
让我消化一下先。  发表于 2013-4-5 13:19
武器限制方面,在数据库技能设置的最下方有一个‘武器限制’,在武器类型里选上‘弓’就可以达到你要的效果了。  发表于 2013-4-5 12:48

评分

参与人数 1梦石 +1 收起 理由
迷糊的安安 + 1 认可答案 附赠66RPG提供的精美好人卡一张^^.

查看全部评分

回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部