我找到了VX的脚本。
可是放到XP里会报错。
特技数量限制
class Game_Actor MAX_SKILL_NUM = 5 alias :rsn_learn_skill :learn_skill def learn_skill(skill_id) rsn_learn_skill(skill_id) if @skills.size > MAX_SKILL_NUM @window_rsn = Window_Forget_Skill.new(120 , 120 , 240 , 128 , self) loop do Graphics.update Input.update @window_rsn.update break if @window_rsn.disposed? end end end end
class Game_Actor
MAX_SKILL_NUM = 5
alias :rsn_learn_skill :learn_skill
def learn_skill(skill_id)
rsn_learn_skill(skill_id)
if @skills.size > MAX_SKILL_NUM
@window_rsn = Window_Forget_Skill.new(120 , 120 , 240 , 128 , self)
loop do
Graphics.update
Input.update
@window_rsn.update
break if @window_rsn.disposed?
end
end
end
end
遗忘特技窗口
class Window_Forget_Skill < Window_Selectable #-------------------------------------------------------------------------- # ● 初始化对像 # x : 窗口 X 座标 # y : 窗口 Y 座标 # width : 窗口宽度 # height : 窗口高度 # actor : 角色 #-------------------------------------------------------------------------- def initialize(x, y, width, height, actor) super(x, y, width, height) @actor = actor @column_max = 1 self.index = 0 refresh end #-------------------------------------------------------------------------- # ● 获取技能 #-------------------------------------------------------------------------- def skill return @data[self.index] end #-------------------------------------------------------------------------- # ● 刷新 #-------------------------------------------------------------------------- def refresh @data = [] for skill in @actor.skills @data.push(skill) if skill.id == @actor.last_skill_id self.index = @data.size - 1 end end @item_max = @data.size create_contents for i in 0...@item_max draw_item(i) end end #-------------------------------------------------------------------------- # ● 描绘项目 # index : 项目编号 #-------------------------------------------------------------------------- def draw_item(index) rect = item_rect(index) self.contents.clear_rect(rect) skill = @data[index] if skill != nil rect.width -= 4 enabled = true draw_item_name(skill, rect.x, rect.y, enabled) self.contents.draw_text(rect, @actor.calc_mp_cost(skill), 2) end end #-------------------------------------------------------------------------- # ● 更新帮助窗口文字 #-------------------------------------------------------------------------- def update_help @help_window.set_text(skill == nil ? "" : skill.description) end alias :rsn_update :update def update rsn_update if Input.trigger?(Input::B) Sound.play_buzzer return end if Input.trigger?(Input::C) Sound.play_decision @actor.forget_skill(skill.id) self.dispose return end end end
class Window_Forget_Skill < Window_Selectable
#--------------------------------------------------------------------------
# ● 初始化对像
# x : 窗口 X 座标
# y : 窗口 Y 座标
# width : 窗口宽度
# height : 窗口高度
# actor : 角色
#--------------------------------------------------------------------------
def initialize(x, y, width, height, actor)
super(x, y, width, height)
@actor = actor
@column_max = 1
self.index = 0
refresh
end
#--------------------------------------------------------------------------
# ● 获取技能
#--------------------------------------------------------------------------
def skill
return @data[self.index]
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
@data = []
for skill in @actor.skills
@data.push(skill)
if skill.id == @actor.last_skill_id
self.index = @data.size - 1
end
end
@item_max = @data.size
create_contents
for i in 0...@item_max
draw_item(i)
end
end
#--------------------------------------------------------------------------
# ● 描绘项目
# index : 项目编号
#--------------------------------------------------------------------------
def draw_item(index)
rect = item_rect(index)
self.contents.clear_rect(rect)
skill = @data[index]
if skill != nil
rect.width -= 4
enabled = true
draw_item_name(skill, rect.x, rect.y, enabled)
self.contents.draw_text(rect, @actor.calc_mp_cost(skill), 2)
end
end
#--------------------------------------------------------------------------
# ● 更新帮助窗口文字
#--------------------------------------------------------------------------
def update_help
@help_window.set_text(skill == nil ? "" : skill.description)
end
alias :rsn_update :update
def update
rsn_update
if Input.trigger?(Input::B)
Sound.play_buzzer
return
end
if Input.trigger?(Input::C)
Sound.play_decision
@actor.forget_skill(skill.id)
self.dispose
return
end
end
end
|