I have just tested this in a fresh project. This means no need for the Equip Common Event/Scene Interpreter. Also, I just noticed that your equip screen probably uses a script, but hopefully this should be compatible:
Code:
#--------------------------------#
# Dramatic Lightning Co Presents:
# Class Armor
#--------------------------------#
# Feel like dressing up? This script allows you to change classes when you
# equip certain armors. You could recreate Final Fantasy 14's Job System
# or fake a sub class here. You can still change your default class and
# learn skills not related to a class.
# Place a <DLArmorClass x> tag in your weapon/armor notebox,
# x being the class id you want to change into.
#--------------------------------#
module DL
module ARMORCLASS
SLOTID = 3 #0-4 refers to equipment slot, 3 being Body Armor, 0 being Weapon.
EXPKEEP = false #true keeps level on armor change, while false has individual class levels
SKILLRESET = true #skills reset on equip.
DEFSKILLLEARN = true #learn default class skills regardless of armor
end
end
#--------------------------------#
#Technical stuff below
#--------------------------------#
class RPG::BaseItem
def armor_class
aclass = 0
regex = /<DLArmorClass\s*(\d+)\s*>/i
res = self.note.match(regex)
if res
aclass = res[1].to_i
end
return aclass
end
end
class Game_Actor < Game_Battler
alias dl_init_equips init_equips
def init_equips(equips)
dl_init_equips(equips)
@default_class_id = @class_id
@skills2 = []
update_armor
refresh
end
alias dl_change_equip change_equip
def change_equip(slot_id, item)
dl_change_equip(slot_id, item)
update_armor
refresh
end
def update_armor
if @equips[DL::ARMORCLASS::SLOTID].object and $data_armors[@equips[DL::ARMORCLASS::SLOTID].object.id].armor_class > 0
change_class($data_armors[@equips[DL::ARMORCLASS::SLOTID].object.id].armor_class, DL::ARMORCLASS::EXPKEEP)
else
change_class(@default_class_id, DL::ARMORCLASS::EXPKEEP)
end
update_skills
end
def change_default_class(new_class_id)
@default_class_id = new_class_id if new_class_id > 0
end
def update_skills
init_skills if DL::ARMORCLASS::SKILLRESET
if DL::ARMORCLASS::DEFSKILLLEARN and @class_id != @default_class_id
change_class(@default_class_id, DL::ARMORCLASS::EXPKEEP)
self.class.learnings.each do |learning|
learn_skill(learning.skill_id) if learning.level <= @level
end
if @equips[DL::ARMORCLASS::SLOTID].object and $data_armors[@equips[DL::ARMORCLASS::SLOTID].object.id].armor_class > 0
change_class($data_armors[@equips[DL::ARMORCLASS::SLOTID].object.id].armor_class, DL::ARMORCLASS::EXPKEEP)
end
end
@skills2.each do |skill_id|
@skills.push(skill_id)
end
end
alias dl_level_up level_up
def level_up
dl_level_up
if DL::ARMORCLASS::DEFSKILLLEARN and @class_id != @default_class_id and DL::ARMORCLASS::EXPKEEP
$data_classes[@default_class_id].learnings.each do |learning|
learn_skill(learning.skill_id) if learning.level == @level
end
end
end
def learn_skill2(skill_id)
unless skill_learn?($data_skills[skill_id])
@skills2.push(skill_id)
@skills.push(skill_id)
@skills.sort!
end
end
alias dl_forget_skill forget_skill
def forget_skill(skill_id)
dl_forget_skill(skill_id)
@skills2.delete(skill_id)
end
end
class Game_Interpreter #overwrite
def command_321
actor = $game_actors[@params[0]]
actor.change_default_class(@params[1]) if actor && $data_classes[@params[1]]
actor.update_armor
end
def command_318
iterate_actor_var(@params[0], @params[1]) do |actor|
if @params[2] == 0
actor.learn_skill2(@params[3])
else
actor.forget_skill(@params[3])
end
end
end
end
Anyway, this works with all three commands in the equip screen and the event's equipment change. However, the character's default class is stored on initialization, though I added a little snippet at the end so that the Change Class command will instead change the default class.
Oh, and the notetag in your armor/weapon is <DLArmorClass x> where x is a class id number. If you want to change the slot for the equipment (currently 3-Body Armor), change the SLOTID number in the script's module. The EXPKEEP determines if your level stays the same when changing classes (true) or if each class has its own level (false), though the false feels a bit like Final Fantasy XIV's Job system.
And another update: By default, skills can only be earned by leveling up. That means if activate EXPKEEP and change from a lv50 Warrior to a lv50 Monk, you only have the skills you learned as a Warrior. The options I included with SKILLKEEP will 1) let you learn skills after equipping an armor 2) reset skills so only the current class skills exist and 3) reset skills so only your default class and equipped class skills appear. Also, I created another skill array to store skills learned through events so that they won't be removed when changing armor.