Class Change via Weapon Type Equip

Made for a request here.

This script changes the actor's class according to the weapon type he/she is using.

So equipping weapon will change the class id to be the same as the weapon type's id.

Features:

Change Class ID based on Weapon Type ID

How to Use:

[1] Paste this below Material and above Main

[2] Set up your class change preferences in the Script's SETTINGS AREA

[3] Set up your weapon types and classes in the database editor to make sure both share the same id

Compatibility:

This script overwrites the OK command in the equip scene.

So there might be a chance of conflict if you have another custom script overwriting the same place.

Terms of Use:

Free for both commercial and non-commercial

Script:

Spoiler
Code:
#==============================================================================# ■ Meow Face Change Class via Weapon Type#------------------------------------------------------------------------------# Change the Actor's Class ID according to equipped Weapon Type ID#==============================================================================# How to Use:# [1] Paste this below Material and above Main# [2] Set your preferences in the script's SETTINGS AREA#==============================================================================module MeowCCvW #DO NOT REMOVE!!#==============================================================================# Settings Area#==============================================================================  KEEP_EXP = false #(true/false) whether or not to keep exp from previous class  INHERIT_SKILL = false #(true/false) whether or not to keep skills from previous class#==============================================================================# End of Settings Area# Edit anything past this line at your own risk!#==============================================================================endclass Game_Actor < Game_Battler  def update_skills    self.class.learnings.each do |learning|      learn_skill(learning.skill_id) if learning.level <= @level    end  endendclass Scene_Equip < Scene_MenuBase  def on_item_ok #Overwrite    Sound.play_equip    @actor.change_equip(@slot_window.index, @item_window.item)    if @slot_window.index == 0 && @item_window.item.is_a?(RPG::Weapon)      @actor.change_class(@item_window.item.wtype_id,MeowCCvW::KEEP_EXP)      !MeowCCvW::INHERIT_SKILL ? @actor.init_skills : @actor.update_skills    end    @slot_window.activate    @slot_window.refresh    @item_window.unselect    @item_window.refresh  endend
Fixed script format, credit Meow Face.
Be sure to- set up your weapon types and classes in the database editor to make sure both share the same id
Code:
#==============================================================================
# ■ Meow Face Change Class via Weapon Type
#------------------------------------------------------------------------------
# Change the Actor's Class ID according to equipped Weapon Type ID
#==============================================================================
# How to Use:
# [1] Paste this below Material and above Main
# [2] Set your preferences in the script's SETTINGS AREA
#==============================================================================
module MeowCCvW
#DO NOT REMOVE!!
#==============================================================================
# Settings Area
#============================================================================== 
KEEP_EXP = false  #(true/false) whether or not to keep exp from previous class 
INHERIT_SKILL = false #(true/false) whether or not to keep skills from previous class
#==============================================================================
# End of Settings Area# Edit anything past this line at your own risk!
#==============================================================================
end
class Game_Actor < Game_Battler 
  def update_skills   
    self.class.learnings.each do |learning|     
      learn_skill(learning.skill_id) if learning.level <= @level   
    end 
  end
end
class Scene_Equip < Scene_MenuBase 
  def on_item_ok #Overwrite   
    Sound.play_equip   
    @actor.change_equip(@slot_window.index, @item_window.item)   
    if @slot_window.index == 0 &&
      @item_window.item.is_a?(RPG::Weapon)     
      @actor.change_class(@item_window.item.wtype_id,MeowCCvW::KEEP_EXP)     
      !MeowCCvW::INHERIT_SKILL ? @actor.init_skills : @actor.update_skills   
    end   
    @slot_window.activate   
    @slot_window.refresh   
    @item_window.unselect   
    @item_window.refresh 
  end
  end

Original thread: https://forums.rpgmakerweb.com/threads/class-change-via-weapon-type-equip.53103/