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

Project1

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

[已经过期] 技能分类脚本分类有效显示无效

[复制链接]

Lv4.逐梦者

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

开拓者

跳转到指定楼层
1
发表于 2013-12-10 15:12:44 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
  1. #==============================================================================
  2. # ■ Window_SkillCommand
  3. #==============================================================================
  4. class Window_SkillCommand < Window_Selectable
  5.   attr_accessor :commands
  6.   #--------------------------------------------------------------------------
  7.   # ● 初始化,生成commands窗口
  8.   #--------------------------------------------------------------------------
  9.   def initialize(actor)
  10.     super(0, 64, 160, 416)
  11.     @commands = []
  12.     [url=home.php?mod=space&uid=95897]@actor[/url] = actor
  13.     #————————生成commands窗口
  14.     @data = []
  15.     for i in [email protected]
  16.       skill = $data_skills[@actor.skills[i]]
  17.       if skill != nil
  18.         @data.push(skill)
  19.       end
  20.     end
  21.     for i in [email protected]
  22.       if @data.size>0
  23.         push = true
  24.         for com in @commands
  25.           if com == $data_skills[@data[i].id].desc
  26.             push = false
  27.           end
  28.         end
  29.         if push == true
  30.           @commands.push($data_skills[@data[i].id].desc)
  31.         end
  32.       end
  33.     end
  34.     if @commands == []
  35.       @commands.push("") #空背包显示分类
  36.     end      
  37.     @skill_max = @commands.size
  38.     self.contents = Bitmap.new(width - 32, @skill_max * 32)
  39.     refresh
  40.     self.index = 0
  41.   end
  42.   #--------------------------------------------------------------------------
  43.   #--------------------------------------------------------------------------
  44.   def refresh
  45.     self.contents.clear
  46.     for i in 0...@skill_max
  47.       draw_item(i, normal_color)
  48.     end
  49.   end
  50.   #--------------------------------------------------------------------------
  51.   #--------------------------------------------------------------------------
  52.   def draw_item(index, color)
  53.     self.contents.font.color = color
  54.     y = index * 32
  55.     self.contents.draw_text(4, y, 128, 32, @commands[index])
  56.   end
  57.   #--------------------------------------------------------------------------
  58.   # 只描绘原文字
  59.   #--------------------------------------------------------------------------
  60.   def update_help
  61.     @help_window.set_text(@commands[self.index])
  62.   end
  63. end
  64. #==============================================================================
  65. # ■ RPG追加定义,使用$skills_[$Xs_specie[@id]]分类
  66. #==============================================================================
  67. module RPG
  68.   class Skill
  69.     def desc
  70.       desc = $skills_species[$skills_specie[@id]]
  71.       return desc != nil ? desc : $skills_species[1]
  72.     end
  73.   end
  74. end
复制代码
  1. #==============================================================================
  2. # ■ Window_Skill
  3. #------------------------------------------------------------------------------
  4. #  特技画面、战斗画面、显示可以使用的特技浏览的窗口。
  5. #==============================================================================

  6. class Window_Skill < Window_ItemSelectable
  7.   #--------------------------------------------------------------------------
  8.   # ● 初始化对像
  9.   #     actor : 角色
  10.   #--------------------------------------------------------------------------
  11.   def initialize(actor)
  12.     super(160, 0, 480, 480)
  13.     @actor = actor
  14.     @column_max = 14
  15.     refresh
  16.     self.index = 0
  17.     # 战斗中的情况下将窗口移至中央并将其半透明化
  18.     if $game_temp.in_battle
  19.       self.y = 64
  20.       self.height = 256
  21.       self.back_opacity = 160
  22.     end
  23.   end
  24.   #--------------------------------------------------------------------------
  25.   # ● 获取特技
  26.   #--------------------------------------------------------------------------
  27.   def skill
  28.     return @data[self.index]
  29.   end
  30.   #--------------------------------------------------------------------------
  31.   # ● 刷新
  32.   #--------------------------------------------------------------------------
  33.   def refresh
  34.     if self.contents != nil
  35.       self.contents.dispose
  36.       self.contents = nil
  37.     end
  38.     @data = []
  39.     for i in [email protected]
  40.       skill = $data_skills[@actor.skills[i]]
  41.       if skill != nil
  42.         @data.push(skill)
  43.       end
  44.     end
  45.     # 如果项目数不是 0 就生成位图、重新描绘全部项目
  46.     @item_max = @data.size
  47.     if @item_max > 0
  48.       self.contents = Bitmap.new(width - 32, row_max * 32)
  49.       for i in 0...@item_max
  50.         draw_item(i)
  51.       end
  52.     end
  53.   end
  54.   #--------------------------------------------------------------------------
  55.   # ● 描绘项目
  56.   #     index : 项目编号
  57.   #--------------------------------------------------------------------------
  58.   def draw_item(index)
  59.     skill = @data[index]
  60.     color=$skills_quality[skill.id]
  61.     if @actor.skill_can_use?(skill.id)
  62.       self.contents.font.color = text_color($skills_quality[skill.id])
  63.     else
  64.       self.contents.font.color = disabled_color
  65.     end
  66.     x = 4 + index % 14 * (0 + 32)
  67.     y = index / 14 * 32
  68.     rect = Rect.new(x, y, self.width / @column_max - 32, 32)
  69.     self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  70.     bitmap = RPG::Cache.icon(skill.icon_name)
  71.     opacity = self.contents.font.color == text_color(color) ? 255 : 128
  72.     self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 32, 32), opacity)
  73.     self.contents.draw_text(x + 28, y, 204, 32, skill.name, 0)
  74.     self.contents.draw_text(x + 232, y, 48, 32, skill.sp_cost.to_s, 2)
  75.   end
  76.   #--------------------------------------------------------------------------
  77.   # ● 刷新帮助文本
  78.   #--------------------------------------------------------------------------
  79.   def update_help
  80.     @help_window.set_text(self.skill == nil ? "" : self.skill.description)
  81.   end
  82. end
复制代码
  1. #==============================================================================
  2. # ■ Scene_Skill
  3. #------------------------------------------------------------------------------
  4. #  处理特技画面的类。
  5. #==============================================================================

  6. class Scene_Skill
  7.   #--------------------------------------------------------------------------
  8.   # ● 初始化对像
  9.   #     actor_index : 角色索引
  10.   #--------------------------------------------------------------------------
  11.   def initialize(actor_index = 0, equip_index = 0)
  12.     @actor_index = actor_index
  13.   end
  14.   #--------------------------------------------------------------------------
  15.   # ● 主处理
  16.   #--------------------------------------------------------------------------
  17.   def main
  18.     # 获取角色
  19.     @actor = $game_party.actors[@actor_index]
  20.     # 生成帮助窗口、状态窗口、特技窗口
  21.     #@help_window = Window_Help.new
  22.     @status_window = Window_SkillStatus.new(@actor)
  23.     @skill_window = Window_Skill.new(@actor)
  24.     @skillcommand_window = Window_SkillCommand.new(@actor)
  25.     # 关联帮助窗口
  26.     #@skill_window.help_window = @help_window
  27.     # 生成目标窗口 (设置为不可见・不活动)
  28.     @target_window = Window_Target.new
  29.     @target_window.visible = false
  30.     @target_window.active = false
  31.     # 执行过渡
  32.     Graphics.transition
  33.     # 主循环
  34.     loop do
  35.       # 刷新游戏画面
  36.       Graphics.update
  37.       # 刷新输入信息
  38.       Input.update
  39.       # 刷新画面
  40.       update
  41.       # 如果画面切换的话就中断循环
  42.       if $scene != self
  43.         break
  44.       end
  45.     end
  46.     # 准备过渡
  47.     Graphics.freeze
  48.     # 释放窗口
  49.     #@help_window.dispose
  50.     @skillcommand_window.dispose
  51.     @status_window.dispose
  52.     @skill_window.dispose
  53.     @target_window.dispose
  54.   end
  55.   #--------------------------------------------------------------------------
  56.   # ● 刷新画面
  57.   #--------------------------------------------------------------------------
  58.   def update
  59.     # 刷新窗口
  60.     #@help_window.update
  61.     @skillcommand_window.update
  62.     @status_window.update
  63.     @skill_window.update
  64.     @target_window.update
  65.     # 特技窗口被激活的情况下: 调用 update_skill
  66.     if @skill_window.active
  67.       update_skill
  68.       return
  69.     end
  70.     # 目标窗口被激活的情况下: 调用 update_target
  71.     if @target_window.active
  72.       update_target
  73.       return
  74.     end
  75.   end
  76.   #--------------------------------------------------------------------------
  77.   # ● 刷新画面 (特技窗口被激活的情况下)
  78.   #--------------------------------------------------------------------------
  79.   def update_skill
  80.     # 按下 B 键的情况下
  81.     if Input.trigger?(Input::B)
  82.       # 演奏取消 SE
  83.       $game_system.se_play($data_system.cancel_se)
  84.       # 切换到菜单画面
  85.       $scene = Scene_Menu.new(1)
  86.       return
  87.     end
  88.     # 按下 C 键的情况下
  89.     if Input.trigger?(Input::C)
  90.       # 获取特技窗口现在选择的特技的数据
  91.       [url=home.php?mod=space&uid=260100]@skill[/url] = @skill_window.skill
  92.       # 不能使用的情况下
  93.       if @skill == nil or not @actor.skill_can_use?(@skill.id)
  94.         # 演奏冻结 SE
  95.         $game_system.se_play($data_system.buzzer_se)
  96.         return
  97.       end
  98.       # 演奏确定 SE
  99.       $game_system.se_play($data_system.decision_se)
  100.       # 效果范围是我方的情况下
  101.       if @skill.scope >= 3
  102.         # 激活目标窗口
  103.         @skill_window.active = false
  104.         @target_window.x = (@skill_window.index + 1) % 2 * 304
  105.         @target_window.visible = true
  106.         @target_window.active = true
  107.         # 设置效果范围 (单体/全体) 的对应光标位置
  108.         if @skill.scope == 4 || @skill.scope == 6
  109.           @target_window.index = -1
  110.         elsif @skill.scope == 7
  111.           @target_window.index = @actor_index - 10
  112.         else
  113.           @target_window.index = 0
  114.         end
  115.       # 效果在我方以外的情况下
  116.       else
  117.         # 公共事件 ID 有效的情况下
  118.         if @skill.common_event_id > 0
  119.           # 预约调用公共事件
  120.           $game_temp.common_event_id = @skill.common_event_id
  121.           # 演奏特技使用时的 SE
  122.           $game_system.se_play(@skill.menu_se)
  123.           # 消耗 SP
  124.           @actor.sp -= @skill.sp_cost
  125.           # 再生成各窗口的内容
  126.           @skillcommand_window.refresh
  127.           @status_window.refresh
  128.           @skill_window.refresh
  129.           @target_window.refresh
  130.           # 切换到地图画面
  131.           $scene = Scene_Map.new
  132.           return
  133.         end
  134.       end
  135.       return
  136.     end
  137.     # 按下 R 键的情况下
  138.     if Input.trigger?(Input::R)
  139.       # 演奏光标 SE
  140.       $game_system.se_play($data_system.cursor_se)
  141.       # 移至下一位角色
  142.       @actor_index += 1
  143.       @actor_index %= $game_party.actors.size
  144.       # 切换到别的特技画面
  145.       $scene = Scene_Skill.new(@actor_index)
  146.       return
  147.     end
  148.     # 按下 L 键的情况下
  149.     if Input.trigger?(Input::L)
  150.       # 演奏光标 SE
  151.       $game_system.se_play($data_system.cursor_se)
  152.       # 移至上一位角色
  153.       @actor_index += $game_party.actors.size - 1
  154.       @actor_index %= $game_party.actors.size
  155.       # 切换到别的特技画面
  156.       $scene = Scene_Skill.new(@actor_index)
  157.       return
  158.     end
  159.   end
  160.   #--------------------------------------------------------------------------
  161.   # ● 刷新画面 (目标窗口被激活的情况下)
  162.   #--------------------------------------------------------------------------
  163.   def update_target
  164.     # 按下 B 键的情况下
  165.     if Input.trigger?(Input::B)
  166.       # 演奏取消 SE
  167.       $game_system.se_play($data_system.cancel_se)
  168.       # 删除目标窗口
  169.       @skill_window.active = true
  170.       @target_window.visible = false
  171.       @target_window.active = false
  172.       return
  173.     end
  174.     # 按下 C 键的情况下
  175.     if Input.trigger?(Input::C)
  176.       # 因为 SP 不足而无法使用的情况下
  177.       unless @actor.skill_can_use?(@skill.id)
  178.         # 演奏冻结 SE
  179.         $game_system.se_play($data_system.buzzer_se)
  180.         return
  181.       end
  182.       # 目标是全体的情况下
  183.       if @target_window.index == -1
  184.         # 对同伴全体应用特技使用效果
  185.         used = false
  186.         for i in $game_party.actors
  187.           used |= i.skill_effect(@actor, @skill)
  188.         end
  189.       end
  190.       # 目标是使用者的情况下
  191.       if @target_window.index <= -2
  192.         # 对目标角色应用特技的使用效果
  193.         target = $game_party.actors[@target_window.index + 10]
  194.         used = target.skill_effect(@actor, @skill)
  195.       end
  196.       # 目标是单体的情况下
  197.       if @target_window.index >= 0
  198.         # 对目标角色应用特技的使用效果
  199.         target = $game_party.actors[@target_window.index]
  200.         used = target.skill_effect(@actor, @skill)
  201.       end
  202.       # 使用特技的情况下
  203.       if used
  204.         # 演奏特技使用时的 SE
  205.         $game_system.se_play(@skill.menu_se)
  206.         # 消耗 SP
  207.         @actor.sp -= @skill.sp_cost
  208.         # 再生成各窗口内容
  209.         @skillcommand_window.refresh
  210.         @status_window.refresh
  211.         @skill_window.refresh
  212.         @target_window.refresh
  213.         # 全灭的情况下
  214.         if $game_party.all_dead?
  215.           # 切换到游戏结束画面
  216.           $scene = Scene_Gameover.new
  217.           return
  218.         end
  219.         # 公共事件 ID 有效的情况下
  220.         if @skill.common_event_id > 0
  221.           # 预约调用公共事件
  222.           $game_temp.common_event_id = @skill.common_event_id
  223.           # 切换到地图画面
  224.           $scene = Scene_Map.new
  225.           return
  226.         end
  227.       end
  228.       # 无法使用特技的情况下
  229.       unless used
  230.         # 演奏冻结 SE
  231.         $game_system.se_play($data_system.buzzer_se)
  232.       end
  233.       return
  234.     end
  235.   end
  236. end
复制代码
求解释为什么不管现实那个分类都是所有技能···(技能已经设施分类,感觉是其他设置有问题···但是纠结的是找不到问题在哪···)
[img]http://service.t.sina.com.cn/widget/qmd/5339802982/c02e16bd/7.png
您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

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

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

GMT+8, 2024-9-30 06:27

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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