The RPG Maker Resource Kit

RMRK RPG Maker Creation => VX Ace => VXA Scripts Database => Topic started by: SeMcDun on December 23, 2014, 06:12:59 PM

Title: Change Class Using Weapons
Post by: SeMcDun on December 23, 2014, 06:12:59 PM
Weapons Change Class
Version: 1.0
Author: SeMcDun
Date: 2014.12.23

Version History




Planned Future Versions


Description



Weapon types and classes are linked.
If an actor equips a sword, their class changes to Swordsman.
If an actor equips a staff their class changes to mage.
Etc. etc.

Features


Instructions

The weapon type id in the database has to be the same as the class id in the database.

Script




#=begin
#===============================================================================
# SeM's Weapons Change Class VXA
# ~ v1.0
# By SeMcDun
# Last Update: 2014.12.23
#===============================================================================
# Description;
# -- Equipping different types of weapon will change the actor's class.
# -- Eg. Equip a sword to become a swordsman
#        Equip a staff to become a magician
#
# Note;
# -- The ID of the Weapon Type has to match the ID of the class.
#
#===============================================================================

#===============================================================================
$imported = {} if $imported.nil?
$imported["SEM-weapons_change_class"] = true
#===============================================================================
module SEM
  module WCC
   
    # Whether or not changing class stops an actor using skills from another
    # class
    REMOVE_SKILLS = true
   
  end # WCC
end # SEM

#==================================
# Do not allow a blank weapon
#----------------------------------
#==============================================================================
# ** Game_Actor
#------------------------------------------------------------------------------
#  This class handles actors. It is used within the Game_Actors class
# ($game_actors) and is also referenced from the Game_Party class ($game_party).
#==============================================================================

class Game_Actor < Game_Battler
 
  #--------------------------------------------------------------------------
  # * Change Equipment
  #     slot_id:  Equipment slot ID
  #     item:    Weapon/armor (remove equipment if nil)
  #--------------------------------------------------------------------------
  alias ga_ce_sem_cc change_equip
  def change_equip(slot_id, item)
    return if slot_id == 0 && item == nil
    if slot_id == 0
      change_class(item.wtype_id)
      # Refresh skills
      if SEM::WCC::REMOVE_SKILLS == true
        init_skills
      end # if remove skills == true
    end # slot_id == 0 (weapon)
    ga_ce_sem_cc(slot_id, item)
  end
 
end # Game_Actor

#==============================================================================
# ** Window_EquipItem
#------------------------------------------------------------------------------
#  This window displays choices when opting to change equipment on the
# equipment screen.
#==============================================================================

class Window_EquipItem < Window_ItemList

  #--------------------------------------------------------------------------
  # * overwrite: Include in Item List?
  #--------------------------------------------------------------------------
  def include?(item)
    return true if item == nil
    return false unless item.is_a?(RPG::EquipItem)
    return false if @slot_id < 0
    if @slot_id != 0
      return false if item.etype_id != @actor.equip_slots[@slot_id]
      return @actor.equippable?(item)
    end # if slot_id is not a weapon
    return true
  end
 
end # Window_EquipItem



Credit




Thanks


Support



Post any problems here and I'll get round to fixing them.

Known Compatibility Issues

I am not sure if scripts affecting skill learning would work alongside this.

Demo



See attached.

Terms of Use



Terms of Use for RMVXA Scripts Database (http://rmrk.net/index.php/topic,45481.0.html)
Title: Re: Change Class Using Weapons
Post by: yuyu! on December 23, 2014, 08:12:16 PM
Hey, this is pretty cool! Thanks for sharing! ;o
Title: Re: Change Class Using Weapons
Post by: Malson on December 23, 2014, 11:12:56 PM
Definitely one of the coolest aspects of FF14. I don't make games anymore, but if I did I'd use this script.
Title: Re: Change Class Using Weapons
Post by: yuyu! on December 24, 2014, 04:00:52 AM
and here we have a malson sighting, in a habitat not much like its native homeland