Project1

标题: 求一个脚本 [打印本页]

作者: qqoopp1988    时间: 2015-4-26 20:49
标题: 求一个脚本
关于技能升级方面的,不需要多复杂,我只想知道在VX里面的预设里有没有读取 技能使用次数的变量。
作者: duchen5779    时间: 2015-4-27 14:02
RUBY 代码复制
  1. =begin
  2. 在可以升级的技能的备注栏里写上
  3. 下等级技能编号
  4. 升级经验
  5. 每次增加经验
  6. 下等级技能编号2
  7. 升级经验10
  8. 每次增加经验2
  9. =end
  10. class Game_Actor
  11.   MULTISKILLS = true#true时可以同时学会高等级技能和低等级技能,
  12.                     #false时候学会高等级技能后会遗忘低等级技能
  13.   alias supersetup setup
  14.   def setup(*args)
  15.     supersetup(*args)
  16.     @skillexp = {}
  17.   end
  18.   def addskillexp
  19.     return unless @action.skill.updatable?
  20.     @skillexp[@action.skill.id] = 0 if @skillexp[@action.skill.id].nil?
  21.     @skillexp[@action.skill.id] += @action.skill.eachexp
  22.     if @skillexp[@action.skill.id] >= @action.skill.maxexp
  23.       return if @skills.include?(@action.skill.nextskillid)
  24.       learn_skill(@action.skill.nextskillid)
  25.       forget_skill(@action.skill.id) unless MULTISKILLS
  26.       $game_message.new_page
  27.       text = "技能" + @action.skill.name + "升级"
  28.       $game_message.texts.push(text)
  29.       text = "学会" + $data_skills[@action.skill.nextskillid].name
  30.       $game_message.texts.push(text)
  31.     end
  32.   end
  33. end
  34. class Game_Enemy
  35.   def addskillexp
  36.   end
  37. end
  38. module RPG
  39.   class Skill
  40.     def updatable?
  41.       @note =~ /下等级技能编号(\d+)/
  42.       return !$1.nil?
  43.     end
  44.     def nextskillid
  45.       @note =~ /下等级技能编号(\d+)/
  46.       return $1.to_i
  47.     end
  48.     def maxexp
  49.       @note =~ /升级经验(\d+)/
  50.       return $1.to_i
  51.     end
  52.     def eachexp
  53.       @note =~ /每次增加经验(\d+)/
  54.       return $1.to_i
  55.     end
  56.   end
  57. end
  58. class Scene_Battle
  59.   alias superexecute_action_skill execute_action_skill
  60.   def execute_action_skill
  61.     superexecute_action_skill
  62.     @active_battler.addskillexp
  63.   end
  64. end


原帖:
https://rpg.blue/forum.php?mod=viewthread&tid=107835
作者: 上贺茂润    时间: 2015-4-28 10:27
VX有完整的技能树系统




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