Introduction
This script corrects a problem with the default scripts and enhances the class system. In the default scripts, a class change won't affect the character's skill list. With this script added, a character will forget all skills from his former class and learn all skills on his new class's skill list up to his current level. Additionally, you can exempt certain skills, or all skills from an entire class, from being forgotten in this way. This can be done on a global or per-character basis.
Originally to use this script, you would have needed to add the pieces of code supplied to Game_System and Game_Actor. Then, replace Interpreter#command_321 with the code in the third block he supplied. Now, it is in one contiguous script.
# Class Changing Skill Fix:
# Modification to Skill List Updating Behavior upon Class Change
# by Trihan
#
# To exempt a class's skills from being forgotten on a global level, use the
# statement "$game_system.exempt_classes.push(x)", where 'x' is the ID number
# of the class in the database.
#
# To exempt a skill from being forgotten on a global level, use the statement
# "$game_system.exempt_skills.push(x)", where 'x' is the ID number of the
# skill in the database.
#
# To exempt a certain character from forgetting the skills from a certain
# class, use the statement "$game_actors[n].exempt_classes.push(x)", where 'n'
# is the ID number of the actor and x is the ID number of the class.
#
# To exempt a certain character from forgetting a certain skill, use the
# statement "$game_actors[n].exempt_skills.push(x)", where 'n' is the ID num-
# ber of the actor and 'x' is the ID number of the skill.
#==============================================================================
# ** Game_System
#------------------------------------------------------------------------------
# This class handles data surrounding the system. Backround music, etc.
# is managed here as well. Refer to "$game_system" for the instance of
# this class.
#==============================================================================
class Game_System
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :exempt_classes # array of exempt classes
attr_accessor :exempt_skills # array of exempt skills
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
alias ccsf_initialize initialize
def initialize
ccsf_initialize
@exempt_classes = []
@exempt_skills = []
end
end
#==============================================================================
# ** Game_Actor
#------------------------------------------------------------------------------
# This class handles the actor. It's used within the Game_Actors class
# ($game_actors) and refers to the Game_Party class ($game_party).
#==============================================================================
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :exempt_classes # array of exempt classes
attr_accessor :exempt_skills # array of exempt skills
#--------------------------------------------------------------------------
# * Object Initialization
# actor_id : actor ID
#--------------------------------------------------------------------------
alias ccsf_initialize initialize
def initialize(actor_id)
ccsf_initialize(actor_id)
@exempt_classes = []
@exempt_skills = []
end
end
#==============================================================================
# ** Interpreter
#------------------------------------------------------------------------------
# This interpreter runs event commands. This class is used within the
# Game_System class and the Game_Event class.
#==============================================================================
class Interpreter
#--------------------------------------------------------------------------
# * Change Actor Class
#--------------------------------------------------------------------------
def command_321
actor = $game_actors[@parameters[0]]
if actor != nil
if !$game_system.exempt_classes.include?(actor.class_id) and
!actor.exempt_classes.include?(actor.class_id)
actor.skills.delete_if {|skill| !$game_system.exempt_skills.include?(skill) and
!actor.exempt_skills.include?(skill) }
else
for i in 0...actor.skills.size
j = $data_skills[actor.skills[i]]
actor.exempt_skills.push j.id
actor.exempt_skills.uniq!
end
end
actor.class_id = @parameters[1]
for i in 1..actor.level
for j in $data_classes[actor.class_id].learnings
if j.level == i
actor.learn_skill(j.skill_id)
end
end
end
end
return true
end
end
Instructions
This revision has been lightly touched so you can just paste it ABOVE Main or BELOW Scene_Debug to use it.
To exempt a class's skills from being forgotten on a global level, use the statement "$game_system.exempt_classes.push(x)", where 'x' is the ID number of the class in the database.
To exempt a skill from being forgotten on a global level, use the statement "$game_system.exempt_skills.push(x)", where 'x' is the ID number of the skill in the database.
To exempt a certain character from forgetting the skills from a certain class, use the statement "$game_actors[n].exempt_classes.push(x)", where 'n' is the ID number of the actor and x is the ID number of the class.
To exempt a certain character from forgetting a certain skill, use the statement "$game_actors[n].exempt_skills.push(x)", where 'n' is the ID number of the actor and 'x' is the ID number of the skill.