=begin #============================================================================== ** Learn and Replace Author: Hime Date: Jan 26, 2013 ------------------------------------------------------------------------------ ** Change log Jan 26, 2013 - Initial release ------------------------------------------------------------------------------ ** Terms of Use * Free to use in non-commercial projects * Contact me for commercial use * No real support. The script is provided as-is * Will do bug fixes, but no compatibility patches * Features may be requested but no guarantees, especially if it is non-trivial * Preserve this header ------------------------------------------------------------------------------ ** Description This script allows you to have a newly learned skill "replace" an old skill. For example, if you have Fire 1, Fire 2, and Fire 3, and you want to simulate skill mastery where higher levels of the skill replace lower levels, then learning Fire 2 may replace Fire 1. ------------------------------------------------------------------------------ ** Usage Note-tag Learning objects with Where the ID's are the ID's of skills that will be forgotten upon learning the new skill #============================================================================== =end $imported = {} if $imported.nil? $imported["Tsuki_LearnReplace"] = true #============================================================================== # ** Configuration #============================================================================== module TH module Learn_Replace Regex = //i end end #============================================================================== # ** Rest of the script #============================================================================== module RPG class Class::Learning def replace_skills return @replace_skills unless @replace_skills.nil? load_notetag_replace_skills return @replace_skills end def load_notetag_replace_skills res = self.note.match(TH::Learn_Replace::Regex) @replace_skills = res ? res[1].scan(/\d+/).map!{|v|v.to_i} : [] end end end class Game_Actor < Game_Battler alias :th_learn_replace_level_up :level_up def level_up th_learn_replace_level_up self.class.learnings.each do |learning| replace_skills(learning.replace_skills) if learning.level == @level end end def replace_skills(skill_ids) skill_ids.each {|id| forget_skill(id)} end end