黄泉 发表于 2010-8-6 15:54:30

技能升级

技能升级的脚本我找到了,但怎么用啊?

最爱南宫煌 发表于 2010-8-6 16:21:39

你把脚本发上来,我看看.

黄泉 发表于 2010-8-6 17:07:39

=begin
在可以升级的技能的备注栏里写上
下等级技能编号
升级经验
每次增加经验

下等级技能编号2
升级经验10
每次增加经验2
=end
class Game_Actor
  MULTISKILLS = true#true时可以同时学会高等级技能和低等级技能,
                    #false时候学会高等级技能后会遗忘低等级技能
  alias supersetup setup
  def setup(*args)
    supersetup(*args)
    @skillexp = {}
  end
  def addskillexp
    return unless @action.skill.updatable?
    @skillexp[@action.skill.id] = 0 if @skillexp[@action.skill.id].nil?
    @skillexp[@action.skill.id] += @action.skill.eachexp
    if @skillexp[@action.skill.id] >= @action.skill.maxexp
      return if @skills.include?(@action.skill.nextskillid)
      learn_skill(@action.skill.nextskillid)
      forget_skill(@action.skill.id) unless MULTISKILLS
      $game_message.new_page
      text = "技能" + @action.skill.name + "升级"
      $game_message.texts.push(text)
      text = "学会" + $data_skills[@action.skill.nextskillid].name
      $game_message.texts.push(text)
    end
  end
end
class Game_Enemy
  def addskillexp
  end
end
module RPG
  class Skill
    def updatable?
      @note =~ /下等级技能编号(\d+)/
      return !$1.nil?
    end
    def nextskillid
      @note =~ /下等级技能编号(\d+)/
      return $1.to_i
    end
    def maxexp
      @note =~ /升级经验(\d+)/
      return $1.to_i
    end
    def eachexp
      @note =~ /每次增加经验(\d+)/
      return $1.to_i
    end
  end
end
class Scene_Battle
  alias superexecute_action_skill execute_action_skill
  def execute_action_skill
    superexecute_action_skill
    @active_battler.addskillexp
  end
end

仙邪 发表于 2010-8-7 09:42:27

你在哪里找的,我觉着既然有让转载的地方,就一定会有使用说明吧

最爱南宫煌 发表于 2010-8-7 10:58:19

黑猫,你过来看一下吧。

BlackFeather 发表于 2010-8-10 19:28:47

我好想看见了正规表达式?
页: [1]
查看完整版本: 技能升级