查看: 2353|回复: 0

[已经过期] 求添加功能:图书馆技能装备

[复制链接]
梦石
0
星屑
606
在线时间
797 小时
注册时间
2014-7-1
回帖
501

开拓者

发表于 2016-5-19 14:48:13 | 显示全部楼层 |阅读模式

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

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

×
  1.   Skills_Slot_Name = ['招式一','招式二','招式三','招式四','招式五']
复制代码

   在★Game_Battler 3中如何判断角色装备第几个装备栏中的的技能才能发挥威力
   已知的命令式:user.battle_skill.include?(1)  判断是否装备了1号技能
   描述问题1:那么如何判断前提条件 是需要 '招式五'装备1号技能才可以生效

还有个问题也是属于这个脚本的我先提问出来 如果需要在开帖我就分开提问

附加第二问题: 这个问题如果需要定制话那就定制

五个装备栏 指定能够装备的技能  想改动为:
  1.   Skills_Slot_Name = ['招式一','招式二','招式三','神技','天赋']
复制代码

1:就是后面两个 除了某些特定技能才可以装备 其他无法装备  就像装备防具一样只能装备指定的技能ID

2:要考虑到初始技能 角色加入时这两个装备会自动装备对应的技能ID
=================================================================
以上为问题描述: 下面是脚本!
=================================================================

  1. #==============================================================================
  2. # ■ 技能装备系统 for RGSS1 by:VIPArcher
  3. #  -- 本脚本来自 [url]https://rpg.blue[/url] 使用或转载请保留以上信息。
  4. #==============================================================================
  5. #  让技能可以像装备一样装备到角色身上,战斗中仅可使用已经装备的技能,其他场景可
  6. #  以随意使用,技能装备场景技能槽栏激活状态下(如有队友)按左右键切换当前角色。
  7. #  $scene = Scene_SetEquipSkill.new(actor_index, skill_index)   呼出场景。
  8. #  actor_index : 该角色在队伍中的位置 ; skill_index : 技能槽光标的起始位置
  9. #==============================================================================
  10. $VIPArcherScript ||= {};$VIPArcherScript[:battle_skill] = 20150717
  11. #-------------------------------------------------------------------------------
  12. module VIPArcher end
  13. #==============================================================================
  14. # ★ 设定部分 ★
  15. #==============================================================================
  16. module VIPArcher::Battle_Skill
  17.   #技能槽名字
  18.   Skills_Slot_Name = ['招式一','招式二','招式三','招式四','招式五']
  19.   #可使用的场合名称
  20.   SKILL_OCCASION   = ['平时', '战斗中', '菜单中', '不能使用']
  21.   #效果范围名称
  22.   SKILL_SCOPE      = ['无', '敌单体', '敌全体', '己方单体', '己方全体',
  23.                     '己方单体(战斗不能)', '己方全体(战斗不能)', '使用者']
  24.   #未装备技能时技能槽显示内容
  25.   BLANK_TEXT   = '-  空技能槽  -'
  26.   #空技能槽帮助窗口文本
  27.   BLANK_HELP   = '空的技能槽,可以装备战斗技能。'
  28.   #"[卸下技能]"的图标文件名(不需要则设置为 nil 或 false)
  29.   RELEASE_ICON = '047-Skill04'
  30.   #"[卸下技能]"帮助窗口文本
  31.   RELEASE_HELP = '卸下已装备的技能。'
  32.   #"[卸下技能]"按钮名称
  33.   RELEASE_TEXT = '[卸下技能]'
  34. end
  35. #==============================================================================
  36. # ☆ 设定结束 ☆
  37. #==============================================================================
  38. class Symbol
  39.   def to_proc
  40.     Proc.new { |*args| args.shift.__send__(self, *args) }
  41.   end
  42. end
  43. class Game_Actor < Game_Battler
  44.   include VIPArcher::Battle_Skill
  45.   attr_reader :battle_skill #已装备技能
  46.   alias battle_skill_initialize initialize
  47.   def initialize(actor_id)
  48.     @battle_skill = Array.new(Skills_Slot_Name.size){ nil }
  49.     battle_skill_initialize(actor_id)
  50.   end
  51.   def add_battle_skill(skill,id)
  52.     @battle_skill[id] = nil if skill.zero?
  53.     return if @battle_skill.include?(skill)
  54.     @battle_skill[id] = skill if skills.include?(skill)
  55.   end
  56.   alias battle_skill_learn_skill learn_skill
  57.   def learn_skill(skill_id)
  58.     battle_skill_learn_skill(skill_id)
  59.     auto_add_battle_skill(skill_id) unless @battle_skill.include?(skill_id)
  60.   end
  61.   def auto_add_battle_skill(skill_id)
  62.     @battle_skill.each_index do |index|
  63.       return @battle_skill[index] = skill_id if @battle_skill[index].nil?
  64.     end
  65.   end
  66.   alias battle_skill_forget_skill forget_skill
  67.   def forget_skill(skill_id)
  68.     battle_skill_forget_skill(skill_id)
  69.     if @battle_skill.include?(skill_id)
  70.       @battle_skill[@battle_skill.index(skill_id)] = nil
  71.     end
  72.   end
  73. end

  74. #描绘
  75. class Window_Selectable < Window_Base
  76.   def create_contents
  77.     self.contents.dispose if self.contents
  78.     self.contents = Bitmap.new(width - 32, row_max * 32)
  79.   end
  80. end
  81. class Window_EquipSkillLeft < Window_Base
  82.   include VIPArcher::Battle_Skill
  83.   def initialize(actor, skill = nil)
  84.     super(0, 64, 272, 192)
  85.     self.contents = Bitmap.new(width - 32, height - 32)
  86.     @actor, @skill = actor, skill
  87.     refresh
  88.   end
  89.   def refresh
  90.     self.contents.clear
  91.     draw_actor_name(@actor, 4, 0)
  92.     draw_actor_level(@actor, 132, 0)
  93.     draw_skill_info unless @skill.nil?
  94.   end
  95.   def set_skill(skill)
  96.     @skill = skill
  97.     refresh
  98.   end
  99.   def draw_skill_info
  100.     self.contents.font.color = system_color
  101.     self.contents.draw_text(0,  32,  128, 32, '使用场合')
  102.     self.contents.font.color = normal_color
  103.     self.contents.draw_text(32, 64,  128, 32, SKILL_OCCASION[@skill.occasion])
  104.     self.contents.font.color = system_color
  105.     self.contents.draw_text(0,  96,  128, 32, '效果范围')
  106.     self.contents.font.color = normal_color
  107.     self.contents.draw_text(32, 128, 320, 32, SKILL_SCOPE[@skill.scope])
  108.   end
  109. end
  110. class Window_EquipSkillSlot < Window_Selectable
  111.   include VIPArcher::Battle_Skill
  112.   attr_writer   :skill_info_window
  113.   def initialize(actor, skill_index = 0)
  114.     super(272, 64, 368, 192)
  115.     @actor, self.index = actor, skill_index
  116.     refresh
  117.   end
  118.   def data
  119.     @actor.battle_skill
  120.   end
  121.   def item
  122.     data[self.index] ? $data_skills[data[self.index]] : nil
  123.   end
  124.   def refresh
  125.     @item_max = data.size
  126.     create_contents
  127.     self.contents.font.color = system_color
  128.     Skills_Slot_Name.each_with_index do |name,id|
  129.       self.contents.draw_text(4, 32 * id, 92, 32, name)
  130.     end
  131.     data.each_with_index do |skill_id,id|
  132.       if skill_id.nil?
  133.         self.contents.font.color = normal_color
  134.         self.contents.draw_text(128 , 32 * id,192, 32, BLANK_TEXT)
  135.       else
  136.         draw_item_name($data_skills[skill_id], 128, 32 * id)
  137.       end
  138.     end
  139.   end
  140.   def update_help
  141.     @help_window.set_text(item.nil? ? BLANK_HELP : item.description)
  142.     @skill_info_window.set_skill(item) if @skill_info_window
  143.   end
  144. end
  145. class Window_SkillItem < Window_Selectable
  146.   include VIPArcher::Battle_Skill
  147.   attr_writer   :skill_info_window
  148.   def initialize(actor)
  149.     super(0, 256, 640, 224)
  150.     @actor, @column_max, self.active, self.index = actor, 2, false, -1
  151.     refresh
  152.   end
  153.   def item
  154.     @data[self.index] ? $data_skills[@data[self.index]] : nil
  155.   end
  156.   def refresh
  157.     @data  = []
  158.     skills = @actor.skills.select{|skill| !@actor.battle_skill.include?(skill)}
  159.     skills.each{|skill| @data.push(skill) }
  160.     @data.push(nil) # 添加[卸下装备]
  161.     @item_max = @data.size
  162.     create_contents
  163.     @data.each_index{|index| draw_item(index)}
  164.   end
  165.   def draw_item(index)
  166.     x = 4 + index % 2 * (288 + 32)
  167.     y = index/ 2 * 32 #这残念的Sublime Text高亮=。=
  168.     self.contents.font.color = normal_color
  169.     if @data[index]
  170.       skill  = $data_skills[@data[index]]
  171.       bitmap = RPG::Cache.icon(skill.icon_name)
  172.       self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24))
  173.       self.contents.draw_text(x + 28, y, 212, 32, skill.name)
  174.     else
  175.       bitmap = RPG::Cache.icon(RELEASE_ICON) if RELEASE_ICON
  176.       self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24)) if bitmap
  177.       self.contents.draw_text(x + 28, y, 212, 32, RELEASE_TEXT)
  178.     end
  179.   end
  180.   def update_help
  181.     @help_window.set_text(item.nil? ? RELEASE_HELP : item.description)
  182.     @skill_info_window.set_skill(item) if @skill_info_window
  183.   end
  184. end
  185. class Window_Skill < Window_Selectable
  186.   def refresh
  187.     @data = []
  188.     if $scene.instance_of?(Scene_Battle)
  189.       @actor.battle_skill
  190.     else
  191.       @actor.skills
  192.     end.each do |skill|
  193.       @data.push($data_skills[skill]) unless skill.nil?
  194.     end
  195.     #end
  196.     @item_max = @data.size
  197.     create_contents unless @item_max.zero?
  198.     @data.each_index{|index| draw_item(index) }
  199.   end
  200. end
  201. class Scene_SetEquipSkill
  202.   def initialize(actor_index = 0, skill_index = 0)
  203.     @actor_index, @skill_index = actor_index, skill_index
  204.   end
  205.   def main
  206.     @actor = $game_party.actors[@actor_index]
  207.     create_all_window
  208.     Graphics.transition
  209.    [Graphics,Input,self].map(&:update) while $scene.equal?(self)
  210.     Graphics.freeze
  211.     dispose_all_window
  212.   end
  213.   def create_all_window
  214.     @help_window      = Window_Help.new
  215.     @right_window     = Window_EquipSkillSlot.new(@actor,@skill_index)
  216.     @left_window      = Window_EquipSkillLeft.new(@actor,@right_window.item)
  217.     @skillitem_window = Window_SkillItem.new(@actor)
  218.     @right_window.help_window     = @help_window
  219.     @skillitem_window.help_window = @help_window
  220.     @right_window.skill_info_window     = @left_window
  221.     @skillitem_window.skill_info_window = @left_window
  222.   end
  223.   def update
  224.     update_all_windows
  225.     return update_right if @right_window.active
  226.     return update_item  if @skillitem_window.active
  227.   end
  228.   def update_right
  229.     return scene_return     if Input.trigger?(Input::B)
  230.     return on_slot_ok       if Input.trigger?(Input::C)
  231.     return process_pagedown if Input.trigger?(Input::RIGHT)
  232.     return process_pageup   if Input.trigger?(Input::LEFT)
  233.   end
  234.   def update_item
  235.     return on_item_cancel if Input.trigger?(Input::B)
  236.     return on_item_ok     if Input.trigger?(Input::C)
  237.   end
  238.   def on_item_ok
  239.     $game_system.se_play($data_system.equip_se)
  240.     skill = @skillitem_window.item
  241.     @actor.add_battle_skill(skill.nil? ? 0 : skill.id,@right_window.index)
  242.     @right_window.active     = true
  243.     @skillitem_window.active = false
  244.     @skillitem_window.index  = -1
  245.     @right_window.refresh
  246.     @skillitem_window.refresh
  247.   end
  248.   def on_item_cancel
  249.     $game_system.se_play($data_system.cancel_se)
  250.     @right_window.active     = true
  251.     @skillitem_window.active = false
  252.     @skillitem_window.index  = -1
  253.   end
  254.   def scene_return
  255.     $game_system.se_play($data_system.cancel_se)
  256.     $scene = Scene_Map.new
  257.   end
  258.   def on_slot_ok
  259.     $game_system.se_play($data_system.decision_se)
  260.     @equipskill_id           = @right_window.index
  261.     @right_window.active     = false
  262.     @skillitem_window.active = true
  263.     @skillitem_window.index  = 0
  264.   end
  265.   def process_pageup
  266.     $game_system.se_play($data_system.cursor_se)
  267.     @actor_index += $game_party.actors.size - 1
  268.     @actor_index %= $game_party.actors.size
  269.     $scene = Scene_SetEquipSkill.new(@actor_index, @right_window.index)
  270.   end
  271.   def process_pagedown
  272.     $game_system.se_play($data_system.cursor_se)
  273.     @actor_index += 1
  274.     @actor_index %= $game_party.actors.size
  275.     $scene = Scene_SetEquipSkill.new(@actor_index, @right_window.index)
  276.   end
  277.   def update_all_windows
  278.     instance_variables.each do |varname|
  279.       ivar = instance_variable_get(varname)
  280.       ivar.update if ivar.is_a?(Window)
  281.     end
  282.   end
  283.   def dispose_all_window
  284.     instance_variables.each do |varname|
  285.       ivar = instance_variable_get(varname)
  286.       ivar.dispose if ivar.is_a?(Window)
  287.     end
  288.   end
  289. end
  290. class Interpreter
  291.   #--------------------------------------------------------------------------
  292.   # ● 条件分支
  293.   #--------------------------------------------------------------------------
  294.   alias battle_skill_command_111 command_111
  295.   def command_111
  296.     result = false
  297.     # 条件判定
  298.     if [@parameters[0],@parameters[2]] == [4,2]
  299.       actor = $game_actors[@parameters[1]]
  300.       if actor != nil
  301.         if $scene.instance_of?(Scene_Battle)
  302.           result = (actor.battle_skill.include?(@parameters[3]))
  303.         else
  304.           result = (actor.skill_learn?(@parameters[3]))
  305.         end
  306.       end
  307.       # 判断结果保存在 hash 中
  308.       @branch[@list[@index].indent] = result
  309.       # 判断结果为真的情况下
  310.       if @branch[@list[@index].indent] == true
  311.         # 删除分支数据
  312.         @branch.delete(@list[@index].indent)
  313.         # 继续
  314.         return true
  315.       end
  316.       # 不符合条件的情况下 : 指令跳转
  317.       return command_skip
  318.     else
  319.       battle_skill_command_111
  320.     end
  321.   end
  322. end
  323. class Game_Actor
  324.   def initialize_battle_skill
  325.     @battle_skill = Array.new(Skills_Slot_Name.size){ nil }
  326.   end
  327. end
复制代码




学习使我疲劳,打工使我疲惫,恋爱使我伤身,吸烟伤我肺腑,饮酒损我形象,旅游使我破费,月底不见铜板,只有在论坛里面看看各种大佬才能使我进去
您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

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

在本版发帖返回顶部