Project1

标题: 设定技能可以使用跟不能使用 [打印本页]

作者: xephon    时间: 2008-2-14 17:30
提示: 作者被禁止或删除 内容自动屏蔽
作者: xiarongshan    时间: 2008-2-14 20:35
提示: 作者被禁止或删除 内容自动屏蔽
作者: 逐月    时间: 2008-2-14 20:43
提示: 作者被禁止或删除 内容自动屏蔽
作者: xephon    时间: 2008-2-14 21:00
提示: 作者被禁止或删除 内容自动屏蔽
作者: sukrider    时间: 2008-2-14 23:50
提示: 作者被禁止或删除 内容自动屏蔽
作者: 凌冰    时间: 2008-2-15 08:27
如果脚本没做过太大改动的话,这个能用

  1. #-------------------------------------------------------------------------------
  2. #天赋技能(另一种思路) By 凌冰
  3. #------------------------------------------------------------------------------
  4. $天赋数 = 3 #修改这里更改可以学会的技能数
  5. #----------------------------------------------------------------------------------
  6. class Window_Base < Window
  7.   def pressed_color      #为了与可在菜单使用的颜色区分,定义一种颜色表示已点击
  8.     return Color.new(255, 255, 0, 255)#如果不需要区分,就改称return normal_color
  9.   end
  10. end
  11. #--------------------------------------------------------------------------------
  12. class Game_Actor
  13.   attr_accessor   :skill_press
  14.   attr_accessor   :press
  15.   alias skill_updata_init setup
  16.   def setup(actor_id)
  17.     skill_updata_init(actor_id)
  18.     @skill_press = []
  19.     @press = $天赋数
  20.     for id in 1...$data_skills.size
  21.       @skill_press[id] = false
  22.     end
  23.   end
  24.   alias eci_skill_can_use? skill_can_use?
  25.   def skill_can_use?(skill_id)
  26.     result = eci_skill_can_use?(skill_id)
  27.     if skill_press[skill_id] == false
  28.       result = false
  29.     end
  30.     return result
  31.   end
  32. end
  33. class Scene_Skill
  34.   alias eci_update_skill update_skill
  35.   def update_skill
  36.     eci_update_skill
  37.     if Input.trigger?(Input::C)
  38.       if @actor.skill_press[@skill.id] or @actor.press == 0
  39.         $game_system.se_play($data_system.buzzer_se)
  40.         return
  41.       else
  42.         $game_system.se_play($data_system.decision_se)
  43.         @actor.skill_press[@skill.id] = true
  44.         @actor.press -= 1
  45.         @skill_window.refresh
  46.       end
  47.     end
  48.   end
  49. end
  50. class Window_Skill < Window_Selectable
  51.   def draw_item(index)
  52.     skill = @data[index]
  53.     if @actor.skill_can_use?(skill.id)
  54.       self.contents.font.color = normal_color
  55.     elsif @actor.skill_press[skill.id]
  56.       self.contents.font.color = pressed_color
  57.     else
  58.       self.contents.font.color = disabled_color
  59.     end
  60.     x = 4 + index % 2 * (288 + 32)
  61.     y = index / 2 * 32
  62.     rect = Rect.new(x, y, self.width / @column_max - 32, 32)
  63.     self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  64.     bitmap = RPG::Cache.icon(skill.icon_name)
  65.     opacity = self.contents.font.color == normal_color ? 255 : 128
  66.     self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  67.     self.contents.draw_text(x + 28, y, 204, 32, skill.name, 0)
  68.     self.contents.draw_text(x + 232, y, 48, 32, skill.sp_cost.to_s, 2)
  69.   end
  70. end
复制代码

顺便提供范例
http://rpg.blue/upload_program/f ... 思路_83464207.rar [LINE]1,#dddddd[/LINE]系统信息:本贴由楼主认可为正确答案,66RPG感谢您的热情解答~
作者: xephon    时间: 2008-2-26 05:53
提示: 作者被禁止或删除 内容自动屏蔽




欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1