Jump to content
GaryCXJk

GaryCXJk - Class Extensions (Yanfly Engine Ace - Class System addon)

Recommended Posts

Class Extension v1.16
GaryCXJk


Introduction
Yanfly's Class System is a very solid script, but it is missing a few small things. This scripts adds just the little things it is missing.

Some ideas came from members from the community. haothehare gave me the idea to start this entire project with the level limiter. Both haothehare and Titanhex gave me the idea for class-specific graphics. Crossroads gave me some good ideas for compatibility with the Learn Skill Engine. Spitfire71 and TSA Ryan came with the idea of hybridizing classes, with thedrifter148 bringing it up.

Features
- Class level limiter.
- Class specific graphics.
- Combination class names and graphics.
- Hide classes that are primary or subclass specific (requires Class Specifics addon).
- Added functionality for Learn Skill Engine.

Screenshots
N/A

How to Use
Up-to-date version of the How to Use can be found in the script or on its own page.
There are various functionalities in this script. You can enable and disable them by specifying it in the script. I'll go through them one at a time.

Class Level Limiter

This allows you to limit the class level cap. This means that classes will never go over the level cap you specified. You can also specify a limit for a specific class using notetags.
 
<max level: x>

Skill Unlock by Class Level

Normally when you level up, regardless of the class level you will unlock skills based on your current actor's level. In order to change that, add the following to the skill learning notetag:
 
<use other level>
This will pick the level based on several things:
- If YEA::CLASS_SYSTEM::MAINTAIN_LEVELS is set to true, use the actor's level;
- If CXJ::CLASS_EXTENSION::SWITCH_MAIN_LEVEL is set to true, use the class level when not set, otherwise use main level;
- Use main level when not set, otherwise use class level.
You can also directly set the class levels in the skills, which has the added bonus that you can assign multiple class level requirements for one skill. You use the same syntax as that of the Class Unlock Level script.
 
<level unlock requirements>
  class x: level y
  class x: level y
</level unlock requirements>
When Learn Skill Engine is installed, you can also assign multiple classes to skills that could be learned using this engine. Skills can only be learned if all classes have reached a certain level, and will appear in all classes, unless specified.
 
<level unlock requirements>
  class x: level y
  class x: level y[ exclude]
</level unlock requirements>
When exclude is added to the end, a skill will not appear in the skill learning list of that class.

Experience
You can change experience rate and experience distribution. Changing the experience rate is the same as modifying the experience learning curve, except you'll earn lower experience instead of having to earn more experience. This especially can be handy when skills that can be learned using the Learn Skill Engine use experience.
 
<experience rate: x%>
<experience rate: [+-*]x%>
As a standard, the experience rate is 1.00, or 100%. You can use operators to modify the experience accordingly. For example, if the new rate is -10%, the rate will change to 90%.

The same can be used for the subclass experience distribution. There are two modes. Either the main class experience remains unaffected or it will share its experience with the subclass. You can enable or disable it by using the following notetag:
 
 
<split experience on>
<split experience off>
When set to off, subclasses will still earn experience, but it will not affect main classes. You can also set the default in the script.
Finally, you can set the subclass experience ratio by using the following:
 
 
<subclass experience ratio: x%>
<subclass experience ratio: [+-*]x%>
Class Graphics

If you want classes to have generic appearances, or if you want an actor to have a specific graphics set when using a certain class.

You can set a generic class graphics set, which is a set of data which specifies the default class graphic. You can specify multiple sets here. It defaults to the "DEFAULT" set, but you can use a notetag on the actor to specify a specific graphics set.
 
 
 
<generic set: x>

Where x is the string defining the graphics set. Note that this graphics set is also used for combination class graphics when that's enabled.

By default, you can set all classes to either opt in or opt out. What this means is that you can specify if actor uses the generic set or not, depending on the settings. If an actor opts in, it means that it will use the generic set, otherwise it doesn't. You can set the default settings in the script, but using notetags you can also specify it per actor.
 
 
 
 
<graphics opt in>
<graphics opt out>

You can also set a class specific graphic for the actor itself. You can even set combination class graphics, although it is optional.
 
 
 
 
<character set: class_id[, subclass_id], character_name, character_index>
<face set: class_id[, subclass_id], face_name, face_index>

Finally, on the classes themselves you can specify a default graphic. Depending on the script settings, these will have priority over the default settings.
 
 
 
 
<character set[ subclass_id]: character_name, character_index>
<face set[ subclass_id]: face_name, face_index>

Demo
Download v1.16


Script


 
 

#==============================================================================
# 
# GaryCXJk - Class Extensions v1.16
# * Last Updated: 2013.02.20
# * Level: Normal
# * Requires: YEA - Class System v1.10+
# * Optional: YEA - Class Specifics v1.00+
#             YEA - Learn Skill Engine v1.00+
#             CXJ - AnimEx v1.01+
# 
#==============================================================================

$imported = {} if $imported.nil?
$imported["CXJ-ClassExtensions"] = true

#==============================================================================
#
# Changelog:
#
#------------------------------------------------------------------------------
# 2013.02.20 - v1.16
#
# * Fixed: Hide mode 2 not working correctly
# * Fixed: Displaying the wrong subclass leveling up
#
#------------------------------------------------------------------------------
# 2013.01.22 - v1.15
#
# * Fixed: Battle test issues
#
#------------------------------------------------------------------------------
# 2013.01.19 - v1.14
#
# * Added: Option to display experience gain per class
# * Added: change_exp now used for subclass experience gain instead of
#          gain_exp
# * Added: Persistent class experience (carries over to all characters,
#          Savedata Extender compatible)
# * Fixed: Wrong experience gain calculation
#
#------------------------------------------------------------------------------
# 2013.01.18 - v1.13
#
# * Added: A new hybridization method
# * Fixed: Small issues with hybridization
#
#------------------------------------------------------------------------------
# 2013.01.12 - v1.12
#
# * Fixed: Changed how hybridization worked
#
#------------------------------------------------------------------------------
# 2013.01.12 - v1.11
#
# * Fixed: Skills not appearing in the Learn Skill menu
# * Fixed: Changed way it aliases
#
#------------------------------------------------------------------------------
# 2013.01.12 - v1.10
#
# * Added: Combination class names
# * Added: Combination class graphics
#
#------------------------------------------------------------------------------
# 2013.01.12 - v1.09
#
# * Fixed: Major mistakes
#
#------------------------------------------------------------------------------
# 2013.01.09 - v1.08
#
# * Fixed: Minor mistakes
#
#------------------------------------------------------------------------------
# 2013.01.09 - v1.07
#
# * Added: Subclass traits
# * Added: Option to 'hybridize' classes
#
#------------------------------------------------------------------------------
# 2013.01.08 - v1.06
#
# * Added: Fix for parameter using main level instead of class level
# * Fixed: Regular expression mistakes
#
#------------------------------------------------------------------------------
# 2013.01.06 - v1.05
#
# * Added: Learning Skill Engine addon
# * Added: Ability to change class experience rate
# * Added: Experience distribution to subclasses
# * Fixed: Class level not appearing
#
#------------------------------------------------------------------------------
# 2013.01.05 - v1.04
#
# * Added: AnimEx compatibility
# * Added: Subclass learning
# * Added: Skill learning when all classes defined have certain level
# * Fixed: Overlooked mistakes
# * Fixed: Errors in graphics picking
#
#------------------------------------------------------------------------------
# 2013.01.01 - v1.03
#
# * Fixed: Wrong calculation of class level
#
#------------------------------------------------------------------------------
# 2012.12.31 - v1.02
#
# * Fixed: Player sprite not changing
#
#------------------------------------------------------------------------------
# 2012.12.31 - v1.01
#
# * Added: Ability to hide classes that are unavailable for primary or subclass
#          (requires Class Specifics)
# * Fixed: Some errors
#
#------------------------------------------------------------------------------
# 2012.12.31 - v1.00
#
# * Initial release
#
#==============================================================================
#
# Yanfly's Class System is a very solid script, but it is missing a few small
# things. This scripts adds just the little things it is missing.
#
# Some ideas came from members from the community. haothehare gave me the idea
# to start this entire project with the level limiter. Both haothehare and
# Titanhex gave me the idea for class-specific graphics. Crossroads gave me
# some good ideas for compatibility with the Learn Skill Engine. Spitfire71
# and TSA Ryan came with the idea of hybridizing classes, with thedrifter148
# bringing it up.
#
#==============================================================================
#
# Installation:
#
# Make sure to put this below Materials, but above Main Process.
#
# This script overrides several methods. If you are sure no method that is
# used by other scripts get overridden, you can place it anywhere, otherwise,
# make sure this script is loaded first. Do know that there is a possibility
# that this script will stop working due to that.
#
# This script adds aliases for several methods. If you are sure no method that
# is used by other scripts get overridden, you can place it anywhere,
# otherwise, make sure this script is loaded after any other script overriding
# these methods, otherwise this script stops working.
#
# This script requires another script to run. Put this script after the
# required scripts to make it work properly.
#
# This script has additional functionality and / or compatibility with other
# scripts. In order to benifit the most out of it, it is advised to place this
# script after the others.
#
#------------------------------------------------------------------------------
# Overridden methods:
#
# * class Game_Actor
#   - init_skills (if USE_PERSISTENT_CLASS_LEVEL is set)
#   - learn_class_skills(class_id) (if USE_PERSISTENT_CLASS_LEVEL is set)
#   - skills (if USE_PERSISTENT_CLASS_LEVEL is set)
#   - class_level(class_id) (from Class System)
#   - level_up
#   - display_level_up
# * class Window_Base
#   - draw_actor_class(actor, x, y, width = 112)
# * class Scene_Class (from Class System)
#   - create_help_window
# * class Window_ClassList (from Class System)
#   - make_item_list
#
#------------------------------------------------------------------------------
# Aliased methods:
#
# * module DataManager
#   - load_database
#   - make_save_contents (if Savedata Extender is not installed)
#   - extract_save_contents (if Savedata Extender is not installed)
# * class Game_Actor
#   - setup(actor_id) (if USE_PERSISTENT_CLASS_LEVEL is set)
#   - change_exp(exp, show)
#   - feature_objects
# * class Window_ClassList (from Class System)
#   - set_item_colour
# * class Window_LearnSkillList (from Learn Skill Engine)
#   - meet_requirements?(item)
#
#==============================================================================
#
# Usage:
#
# There are various functionalities in this script. You can enable and disable
# them by specifying it in the script. I'll go through them one at a time.
#
#------------------------------------------------------------------------------
# Class Level Limiter:
#
# This allows you to limit the class level cap. This means that classes will
# never go over the level cap you specified. You can also specify a limit
# for a specific class using notetags.
#
# <max level: x>
#
#------------------------------------------------------------------------------
# Skill Unlock by Class Level:
#
# Normally when you level up, regardless of the class level you will unlock
# skills based on your current actor's level. In order to change that, add
# the following to the skill learning notetag:
#
# <use other level>
#
# This will pick the level based on several things:
# - If YEA::CLASS_SYSTEM::MAINTAIN_LEVELS is set to true, use the actor's
#     level;
# - If CXJ::CLASS_EXTENSION::SWITCH_MAIN_LEVEL is set to true, use the class
#     level when not set, otherwise use main level;
# - Use main level when not set, otherwise use class level.
#
# You can also directly set the class levels in the skills, which has the
# added bonus that you can assign multiple class level requirements for one
# skill. You use the same syntax as that of the Class Unlock Level script.
#
# <level unlock requirements>
#   class x: level y
#   class x: level y
# </level unlock requirements>
#
# When Learn Skill Engine is installed, you can also assign multiple classes
# to skills that could be learned using this engine. Skills can only be
# learned if all classes have reached a certain level, and will appear in
# all classes, unless specified.
#
# <level unlock requirements>
#   class x: level y
#   class x: level y[ exclude]
# </level unlock requirements>
#
# When exclude is added to the end, a skill will not appear in the skill
# learning list of that class.
#
#------------------------------------------------------------------------------
# Experience:
#
# You can change experience rate and experience distribution. Changing the
# experience rate is the same as modifying the experience learning curve,
# except you'll earn lower experience instead of having to earn more
# experience. This especially can be handy when skills that can be learned
# using the Learn Skill Engine use experience.
#
# <experience rate: x%>
# <experience rate: [+-*]x%>
#
# As a standard, the experience rate is 1.00, or 100%. You can use operators
# to modify the experience accordingly. For example, if the new rate is -10%,
# the rate will change to 90%.
#
# The same can be used for the subclass experience distribution. There are two
# modes. Either the main class experience remains unaffected or it will share
# its experience with the subclass. You can enable or disable it by using the
# following notetag:
#
# <split experience on>
# <split experience off>
#
# When set to off, subclasses will still earn experience, but it will not
# affect main classes. You can also set the default in the script.
#
# Finally, you can set the subclass experience ratio by using the following:
#
# <subclass experience ratio: x%>
# <subclass experience ratio: [+-*]x%>
#
#------------------------------------------------------------------------------
# Class Graphics:
#
# If you want classes to have generic appearances, or if you want an actor to
# have a specific graphics set when using a certain class.
#
# You can set a generic class graphics set, which is a set of data which
# specifies the default class graphic. You can specify multiple sets here. It
# defaults to the "DEFAULT" set, but you can use a notetag on the actor to
# specify a specific graphics set.
#
# <generic set: x>
#
# Where x is the string defining the graphics set. Note that this graphics set
# is also used for combination class graphics when that's enabled.
#
# By default, you can set all classes to either opt in or opt out. What this
# means is that you can specify if actor uses the generic set or not, depending
# on the settings. If an actor opts in, it means that it will use the generic
# set, otherwise it doesn't. You can set the default settings in the script,
# but using notetags you can also specify it per actor.
#
# <graphics opt in>
# <graphics opt out>
#
# You can also set a class specific graphic for the actor itself. You can even
# set combination class graphics, although it is optional.
#
# <character set: class_id[, subclass_id], character_name, character_index>
# <face set: class_id[, subclass_id], face_name, face_index>
#
# Finally, on the classes themselves you can specify a default graphic.
# Depending on the script settings, these will have priority over the default
# settings.
#
# <character set[ subclass_id]: character_name, character_index>
# <face set[ subclass_id]: face_name, face_index>
#
#------------------------------------------------------------------------------
# AnimEx compatibility:
#
# This script has compatibility modifications for AnimEx, so that both scripts
# can be used. You will have to add whether they have diagonal sprites or not
# if the sprite doesn't have eight or nine animation rows.
#
#==============================================================================
#
# License:
#
# Creative Commons Attribution 3.0 Unported
#
# The complete license can be read here:
# http://creativecommons.org/licenses/by/3.0/legalcode
#
# The license as it is described below can be read here:
# http://creativecommons.org/licenses/by/3.0/deed
#
# You are free:
#
# to Share — to copy, distribute and transmit the work
# to Remix — to adapt the work
# to make commercial use of the work
#
# Under the following conditions:
#
# Attribution — You must attribute the work in the manner specified by the
# author or licensor (but not in any way that suggests that they endorse you or
# your use of the work).
#
# With the understanding that:
#
# Waiver — Any of the above conditions can be waived if you get permission from
# the copyright holder.
#
# Public Domain — Where the work or any of its elements is in the public domain
# under applicable law, that status is in no way affected by the license.
#
# Other Rights — In no way are any of the following rights affected by the
# license:
#
# * Your fair dealing or fair use rights, or other applicable copyright
#   exceptions and limitations;
# * The author's moral rights;
# * Rights other persons may have either in the work itself or in how the work
#   is used, such as publicity or privacy rights.
#
# Notice — For any reuse or distribution, you must make clear to others the
# license terms of this work. The best way to do this is with a link to this
# web page.
#
#------------------------------------------------------------------------------
# Extra notes:
#
# Despite what the license tells you, I will not hunt down anybody who doesn't
# follow the license in regards to giving credits. However, as it is common
# courtesy to actually do give credits, it is recommended that you do.
#
# As I picked this license, you are free to share this script through any
# means, which includes hosting it on your own website, selling it on eBay and
# hang it in the bathroom as toilet paper. Well, not selling it on eBay, that's
# a dick move, but you are still free to redistribute the work.
#
# Yes, this license means that you can use it for both non-commercial as well
# as commercial software.
#
# You are free to pick the following names when you give credit:
#
# * GaryCXJk
# * Gary A.M. Kertopermono
# * G.A.M. Kertopermono
# * GARYCXJK
#
# Personally, when used in commercial games, I prefer you would use the second
# option. Not only will it actually give me more name recognition in real
# life, which also works well for my portfolio, it will also look more
# professional. Also, do note that I actually care about capitalization if you
# decide to use my username, meaning, capital C, capital X, capital J, lower
# case k. Yes, it might seem stupid, but it's one thing I absolutely care
# about.
#
# Finally, if you want my endorsement for your product, if it's good enough
# and I have the game in my posession, I might endorse it. Do note that if you
# give me the game for free, it will not affect my opinion of the game. It
# would be nice, but if I really did care for the game I'd actually purchase
# it. Remember, the best way to get any satisfaction is if you get people to
# purchase the game, so in a way, I prefer it if you don't actually give me
# a free copy.
#
# This script was originally hosted on:
# http://area91.multiverseworks.com
#
# Don't forget to include the credits of the original script as well.
#
#==============================================================================
#
# The code below defines the settings of this script, and are there to be
# modified.
#
#==============================================================================

module CXJ
  module CLASS_EXTENSIONS
    #------------------------------------------------------------------------
    # Class Level Limiter
    #------------------------------------------------------------------------
    ENABLE_CLASS_LEVEL_LIMITER = true       # Defines if you want to limit
                                            # class levels
    DEFAULT_MAX_LEV = 99                    # Defines the max level
    STOP_GAINING_EXP_AFTER_MAX = true       # Stops experience gain after
                                            # hitting the level cap
    STOP_LEVELING_AFTER_CLASS_MAX = true    # Stops leveling main character
                                            # after hitting the experience
                                            # cap.
    
    #------------------------------------------------------------------------
    # Generic Class Graphics
    #------------------------------------------------------------------------
    # When you set these, all characters will use this list as their initial
    # graphics. You can pick between an opt-in or opt-out. When you pick
    # opt-in, characters won't use these generic class graphics unless they
    # chose to, otherwise they will always use these generic class graphics
    # unless either the character has set their custom graphics or they opt
    # out.
    #
    # Also, notetags specified in the database have priority over this list,
    # meaning that any class that has a custom class graphic set in the
    # notetags will have that as the generic class graphic. You can however
    # change it below to have generic class graphics have priority instead.
    #
    # Finally, when the graphics for a certain class isn't set here, it will
    # always default to the default character graphics.
    #------------------------------------------------------------------------
    
    ENABLE_CLASS_SPECIFIC_GRAPHICS = true   # Defines whether to use class
                                            # specific graphics.
    OPT_IN_CLASS_GRAPHICS = false           # Defines if you want to opt in.
    CLASS_SPECIFIED_HAS_PRIORITY = true     # Graphics defined in class
                                            # notetags have priority.
    ENABLE_COMBO_SPECIFIC_GRAPHICS = true   # Defines whether to use class
                                            # specific graphics with combos.
                                            # Disabled when class specific
                                            # graphics is set to false.
    
    GENERIC_CLASS_GRAPHICS = {}
    GENERIC_CLASS_GRAPHICS["DEFAULT"] = {
    # ClassID => [  CharacterName,  CharacterIndex, FaceName,   FaceIndex ],
      1       => [  "Actor1",       0,              "Actor1",   0 ],
      3       => [  "Actor4",       2,              "Actor4",   2 ],
    }
    
    COMBO_CLASS_GRAPHICS = {}
    COMBO_CLASS_GRAPHICS["DEFAULT"] = {}
    COMBO_CLASS_GRAPHICS["DEFAULT"][3] = {
    # ClassID => [  CharacterName,  CharacterIndex, FaceName,   FaceIndex ],
     1        => [  "Actor5",       2,              "Actor5",   2],
    }

    #------------------------------------------------------------------------
    # Miscellaneous
    #------------------------------------------------------------------------
    
    # Set the class hiding mode for the class list window. Requires the
    # Class Specifics addon.
    # 0: Original
    # 1: Hide unavailable
    # 2: Grey out selected in other type
    CLASS_HIDE_MODE = 1

    # When false, actor level is the main level, otherwise, class level is
    # the main level.
    SWITCH_MAIN_LEVEL = true
    
    # When false, main class experience gain remains normal, when true,
    # experience gain is reduced when shared with subclass.
    SPLIT_TO_SUB = false
    
    # The base amount of experience gain for subclasses in comparison to the
    # main class gain.
    EXP_TO_SUBCLASS = 1.00
    
    # Use class level for parameter calculation.
    CLASS_LEVEL_PARAMS = true
    
    # Checks whether subclasses can set traits or not.
    SUBCLASS_TRAITS = true
    
    # Instead of adding subclass stats, average between the two. There are
    # several moodes.
    # :none       - Don't use hybridization
    # :add        - Add subclass to full main class stats
    # :ratio      - Use subclass rate as a ratio, subtracting from main class
    # :normalize  - Like :add, but normalizes
    HYBRIDIZE = :none
    
    # Shows class experience gain.
    SHOW_CLASS_EXP_GAIN = {
    :charlevel => true,      # Displays the new character level
    :classexp => false,       # Displays the experience gain per class
    :classlevel => false,      # Displays the new class level
    }
    
    # Use persistent class level.
    # All characters share the same class level.
    USE_PERSISTENT_CLASS_LEVEL = false
    
    #------------------------------------------------------------------------
    # AnimEx compatibility
    # Define below
    #------------------------------------------------------------------------
    GENERIC_CLASS_HAS_DIAGONAL = {}
    GENERIC_CLASS_HAS_DIAGONAL["DEFAULT"] = {
    # ClassID => HasDiagonal?,
      1       => false,
      3       => false,
    }
    
    COMBO_CLASS_HAS_DIAGONAL = {}
    COMBO_CLASS_HAS_DIAGONAL["DEFAULT"] = {}
    COMBO_CLASS_HAS_DIAGONAL["DEFAULT"][3] = {
    # ClassID => HasDiagonal?,
     1        => false,
    }
    
    module VOCAB
      #----------------------------------------------------------------------
      # Vocab
      #----------------------------------------------------------------------
      # This module contains the generic vocabulary of this script.
      #----------------------------------------------------------------------
      CHARACTER_LEVELED_UP = "%s leveled up!"
      CLASS_EXP_GAINED = "%s received %s EXP!"
    end
  end
end

#==============================================================================
#
# The code below should not be altered unless you know what you're doing.
#
#==============================================================================

if $imported["YEA-ClassSystem"]
  module CXJ
    module REGEXP
      module CLASS
        
        MAX_LEVEL = /<(?:MAX_LEVEL|max level):\s*(\d+)>/i
        CHARSET   = /<(?:CHARACTER_SET|CHARSET|character set|charset):\s*(.+?)\s*,\s*(\d+)>/i
        FACESET   = /<(?:FACE_SET|FACESET|face set|faceset):\s*(.+?)\s*,\s*(\d+)>/i
        CHARSET_S = /<(?:CHARACTER_SET|CHARSET|character set|charset)\s*(\d+)\s*:\s*(.+?)\s*,\s*(\d+)>/i
        FACESET_S = /<(?:FACE_SET|FACESET|face set|faceset)\s*(\d+)\s*:\s*(.+?)\s*,\s*(\d+)>/i
        EXP_RATE  = /<(?:EXPERIENCE_RATE|experience rate):\s*([\+\-\*]?)(\d+)\%>/i
        SUB_RATIO = /<(?:SUBCLASS_EXPERIENCE_RATIO|subclass experience ratio):\s*([\+\-\*]?)(\d+)\%>/i
        EXP_SPLIT = /<(?:SPLIT_EXPERIENCE|split experience) (on|off)>/
        SUB_COMBO = /<(?:SUBCLASS_NAME_COMBO|subclass name combo):\s*(\d+)\s*,\s*(.+?)>/i
        # AnimEx compatibility
        HAS_DIAG  = /<(?:SPRITE_HAS_DIAGONAL|sprite has diagonal)>/i
        
      end
      module ACTOR
        
        OPT_IN    = /<(?:GRAPHICS_OPT_IN|graphics opt) (in|out)>/i
        GENERICSET = /<(?:GENERIC_SET|generic set):\s*(.+?)>/i
        CHARSET   = /<(?:CHARACTER_SET|CHARSET|character set|charset):\s*(\d+)\s*,\s*(.+?)\s*,\s*(\d+)>/i
        FACESET   = /<(?:FACE_SET|FACESET|face set|faceset):\s*(\d+)\s*,\s*(.+?)\s*,\s*(\d+)>/i
        CHARSET_S = /<(?:CHARACTER_SET|CHARSET|character set|charset):\s*(\d+)\s*,\s*(\d+)\s*,\s*(.+?)\s*,\s*(\d+)>/i
        FACESET_S = /<(?:FACE_SET|FACESET|face set|faceset):\s*(\d+)\s*,\s*(\d+)\s*,\s*(.+?)\s*,\s*(\d+)>/i
        # AnimEx compatibility
        HAS_DIAG  = /<(?:SPRITE_HAS_DIAGONAL|sprite has diagonal):\s*(\d+)>/i
        HAS_DIA_S = /<(?:SPRITE_HAS_DIAGONAL|sprite has diagonal):\s*(\d+)\s*,\s*(\d+)>/i
        
      end
      module LEARNING
        USE_OTHER  = /<(?:USE_OTHER_LEVEL|use other level)>/i
      end
      module SKILL
        LV_UNLOCK_ON =
          /<(?:LEVEL_UNLOCK_REQUIREMENTS|level unlock requirements)>/i
        LV_UNLOCK_OFF =
          /<\/(?:LEVEL_UNLOCK_REQUIREMENTS|level unlock requirements)>/i
        LV_LEARN_UNLOCK_ON =
          /<(?:LEARN_REQUIRE_CLASS_LEVEL|learn require class level)>/i
        LV_LEARN_UNLOCK_OFF =
          /<\/(?:LEARN_REQUIRE_CLASS_LEVEL|learn require class level)>/i
        LV_UNLOCK_STR = /CLASS[ ](\d+): LEVEL[ ](\d+)(?: (EXCLUDE))?/i
      end
    end
  end

  #============================================================================
  # ** DataManager
  #----------------------------------------------------------------------------
  #  This module manages the database and game objects. Almost all of the 
  # global variables used by the game are initialized by this module.
  #============================================================================

  module DataManager
    #------------------------------------------------------------------------
    # Alias: load_database
    #------------------------------------------------------------------------
    class << self
      load_database_cxj_ce = instance_method(:load_database)
      define_method :load_database do
        load_database_cxj_ce.bind(self).call
        load_notetags_cxj_ce
      end
    end
    
    #------------------------------------------------------------------------
    # New: load_notetags_cul
    #------------------------------------------------------------------------
    def self.load_notetags_cxj_ce
      groups = [$data_classes, $data_actors, $data_skills]
      for group in groups
        for obj in group
          next if obj.nil?
          obj.load_notetags_cxj_ce
        end
      end
    end

    #------------------------------------------------------------------------
    # * Alias: Create Game Objects
    #------------------------------------------------------------------------
    class << self
      datamanager_create_game_objects_cxj_ce = instance_method(:create_game_objects)
      define_method :create_game_objects do
        datamanager_create_game_objects_cxj_ce.bind(self).call
        $game_persistent_class = {}
        $game_persistent_skills = {}
      end
    end
    
    if !$imported["CXJ-SavedataExtender"]
      #----------------------------------------------------------------------
      # * Alias: Create Save Contents
      #----------------------------------------------------------------------
      class << self
        datamanager_make_save_contents_cxj_ce = instance_method(:make_save_contents)
        define_method :make_save_contents do
          contents = datamanager_make_save_contents_cxj_ce.bind(self).call
          contents[:persistent_class] = $game_persistent_class
          contents[:persistent_skills] = $game_persistent_skills
          contents
        end
      end
      #----------------------------------------------------------------------
      # * Alias: Extract Save Contents
      #----------------------------------------------------------------------
      class << self
        datamanager_extract_save_contents_cxj_ce = instance_method(:extract_save_contents)
        define_method :extract_save_contents do |contents|
          datamanager_extract_save_contents_cxj_ce.bind(self).call(contents)
          $game_persistent_class = contents[:persistent_class]
          $game_persistent_skills = contents[:persistent_skills]
        end
      end
    else
      #----------------------------------------------------------------------
      # * New: Save Class Data
      #----------------------------------------------------------------------
      def self.save_class_data
        contents = {}
        contents[:persistent_class] = $game_persistent_class
        contents[:persistent_skills] = $game_persistent_skills
        contents
      end
      
      #----------------------------------------------------------------------
      # * New: Load Class Data
      #----------------------------------------------------------------------
      def self.load_class_data(contents)
        $game_persistent_class = contents[:persistent_class]
        $game_persistent_skills = contents[:persistent_skills]
      end
      
      CXJ::SAVEDATA_EXTENDER::add_save_handler(self.method(:save_class_data), false, true)
      CXJ::SAVEDATA_EXTENDER::add_load_handler(self.method(:load_class_data))
    end

  end
  #============================================================================
  # ** RPG::Class::Learning
  #============================================================================

  class RPG::Class::Learning
    attr_accessor :use_other
    
    #------------------------------------------------------------------------
    # common cache: load_notetags_cxj_ce
    #------------------------------------------------------------------------
    def load_notetags_cxj_ce
      @use_other = false
      self.note.split(/[\r\n]+/).each { |line|
        case line
        when CXJ::REGEXP::LEARNING::USE_OTHER
          @use_other = true
        end
      }
    end
  end

  #============================================================================
  # ** RPG::Class
  #============================================================================

  class RPG::Class < RPG::BaseItem

    attr_accessor :max_level
    attr_accessor :experience_rate
    attr_accessor :subclass_ratio
    attr_accessor :experience_split
    attr_reader   :has_diagonal
    attr_reader   :combined_name
    
    #------------------------------------------------------------------------
    # common cache: load_notetags_cxj_ce
    #------------------------------------------------------------------------
    def load_notetags_cxj_ce
      @max_level = -1
      @character = {}
      @face = {}
      @experience_rate = 1.00
      @subclass_ratio = CXJ::CLASS_EXTENSIONS::EXP_TO_SUBCLASS
      @experience_split = CXJ::CLASS_EXTENSIONS::SPLIT_TO_SUB
      @combined_name = {}
      
      self.note.split(/[\r\n]+/).each { |line|
        case line
        when CXJ::REGEXP::CLASS::MAX_LEVEL
          @max_level = $1.to_i
        when CXJ::REGEXP::CLASS::CHARSET
          @character[0] = {} if @character[0].nil?
          @character[0][:character_name] = $1
          @character[0][:character_index] = $2.to_i

          # AnimEx compatibility
          @character[0][:has_diagonal] = false
          @character[0][:is_regular] = true
          if $imported["CXJ-AnimEx"] && !@character[0][:character_name].empty? && @character[0][:character_name] =~ /^\!?\[(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*(1|0))?\]/
            @character[0][:is_regular] = false if([8, 9].include?($4.to_i))
          end
        when CXJ::REGEXP::CLASS::FACESET
          @face[0] = {} if @face[0].nil?
          @face[0][:face_name] = $1
          @face[0][:face_index] = $2.to_i
        when CXJ::REGEXP::CLASS::CHARSET_S
          id = $1.to_i
          @character[id] = {} if @character[id].nil?
          @character[id][:character_name] = $2
          @character[id][:character_index] = $3.to_i
          
          # AnimEx compatibility
          @character[id][:has_diagonal] = false
          @character[id][:is_regular] = true
          if $imported["CXJ-AnimEx"] && !@character[id][:character_name].empty? && @character[id][:character_name] =~ /^\!?\[(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*(1|0))?\]/
            @character[id][:is_regular] = false if([8, 9].include?($4.to_i))
          end
        when CXJ::REGEXP::CLASS::FACESET_S
          id = $1.to_i
          @face[id] = {} if @face[id].nil?
          @face[id][:face_name] = $2
          @face[id][:face_index] = $3.to_i
        when CXJ::REGEXP::CLASS::EXP_RATE
          rate = $2.to_i * 0.01
          case $1
          when "+"
            @experience_rate+= rate
          when "-"
            @experience_rate-= rate
          when "*"
            @experience_rate*= rate
          else
            @experience_rate = rate
          end
        when CXJ::REGEXP::CLASS::SUB_RATIO
          rate = $2.to_i * 0.01
          case $1
          when "+"
            @subclass_ratio+= rate
          when "-"
            @subclass_ratio-= rate
          when "*"
            @subclass_ratio*= rate
          else
            @subclass_ratio = rate
          end
        when CXJ::REGEXP::CLASS::EXP_SPLIT
          @experience_split = true if $1 == "on"
          @experience_split = false if $1 == "off"
        when CXJ::REGEXP::CLASS::SUB_COMBO
          @combined_name[$1.to_i] = $2
          
        # AnimEx compatibility
        when CXJ::REGEXP::CLASS::HAS_DIAG
          @has_diagonal = true
          
        end
      }
      
      self.learnings.each do |learning|
        learning.load_notetags_cxj_ce
      end
      
    end
    
    #------------------------------------------------------------------------
    # * New: Character
    #------------------------------------------------------------------------
    def character(sub_id = 0)
      return @character[sub_id] if CXJ::CLASS_EXTENSIONS::ENABLE_COMBO_SPECIFIC_GRAPHICS && !@character[sub_id].nil?
      return @character[0] if !@character[0].nil?
      return nil
    end
    
    #------------------------------------------------------------------------
    # * New: Face
    #------------------------------------------------------------------------
    def face(sub_id = 0)
      return @face[sub_id] if CXJ::CLASS_EXTENSIONS::ENABLE_COMBO_SPECIFIC_GRAPHICS && !@face[sub_id].nil?
      return @face[0] if !@face[0].nil?
      return nil
    end
    
    #------------------------------------------------------------------------
    # * Override: Character Index
    #------------------------------------------------------------------------
    def character_index(d = 0, sub_id = 0)
      char = character(sub_id)
      return 0 if char.nil?
      char[:is_regular] && char[:has_diagonal] && d % 2 != 0 ? char[:character_index] + 1 : char[:character_index]
    end
  end

  #============================================================================
  # ** RPG::Skill
  #============================================================================

  class RPG::Skill < RPG::UsableItem
    
    attr_accessor :level_unlock
    attr_accessor :level_learn_unlock
    #------------------------------------------------------------------------
    # common cache: load_notetags_cxj_ce
    #------------------------------------------------------------------------
    def load_notetags_cxj_ce
      @level_unlock = {}
      @level_learn_unlock = {}
      class_exclude = []
      tag = 0
      self.note.split(/[\r\n]+/).each { |line|
        case line
        when CXJ::REGEXP::SKILL::LV_UNLOCK_ON
          tag = 1 if tag == 0
        when CXJ::REGEXP::SKILL::LV_UNLOCK_OFF
          tag = 0 if tag == 1
        
        # Learn Skill Engine compatibility
        when CXJ::REGEXP::SKILL::LV_LEARN_UNLOCK_ON
          tag = 2 if tag == 0
        when CXJ::REGEXP::SKILL::LV_LEARN_UNLOCK_OFF
          tag = 0 if tag == 2
        
        when CXJ::REGEXP::SKILL::LV_UNLOCK_STR
          @level_unlock[$1.to_i] = $2.to_i if tag == 1
          
          # Learn Skill Engine compatibility
          @level_learn_unlock[$1.to_i] = $2.to_i if tag == 2
          if !$3.nil? && $3.downcase == "exclude"
            class_exclude.push($1.to_i)
          end
        end
      }
      $skill_class_unlock = [] if $skill_class_unlock.nil?
      $skill_class_unlock.push(self) if !@level_unlock.empty?
      
      # Learn Skill Engine compatibility
      remove_level = []
      @level_learn_unlock.each_key do |class_id|
        if $data_classes[class_id].nil?
          remove_level.push(class_id)
        else
          skill_id = $data_skills.index(self)
          $data_classes[class_id].learn_skills = [] if $data_classes[class_id].learn_skills.nil?
          $data_classes[class_id].learn_skills.push(skill_id) if !class_exclude.include(class_id)
        end
      end
      remove_level.each do |class_id|
        @level_learn_unlock.delete(class_id)
      end
      remove_level.clear
    end
  end
  
  #============================================================================
  # ** RPG::Actor
  #============================================================================

  class RPG::Actor < RPG::BaseItem
    
    attr_accessor :class_graphics
    attr_accessor :graphics_opt_in
    attr_accessor :generic_set
    
    #------------------------------------------------------------------------
    # common cache: load_notetags_cxj_ce
    #------------------------------------------------------------------------
    def load_notetags_cxj_ce
      @class_graphics = {}
      @graphics_opt_in = !CXJ::CLASS_EXTENSIONS::OPT_IN_CLASS_GRAPHICS
      @generic_set = "DEFAULT"
      self.note.split(/[\r\n]+/).each { |line|
        case line
        when CXJ::REGEXP::ACTOR::OPT_IN
          @graphics_opt_in = false
          @graphics_opt_in = true if $1.downcase == "in"
        when CXJ::REGEXP::ACTOR::GENERICSET
          @generic_set = $1 if !CXJ::CLASS_EXTENSIONS::GENERIC_CLASS_GRAPHICS[$i].nil?
        when CXJ::REGEXP::ACTOR::CHARSET
          @class_graphics[$1.to_i] = {} if @class_graphics[$1.to_i].nil?
          @class_graphics[$1.to_i][0] = {} if @class_graphics[$1.to_i][0].nil?
          @class_graphics[$1.to_i][0][:character_name] = $2
          @class_graphics[$1.to_i][0][:character_index] = $3.to_i
          
          # AnimEx compatibility
          @class_graphics[$1.to_i][0][:is_regular] = true
          
        when CXJ::REGEXP::ACTOR::FACESET
          @class_graphics[$1.to_i] = {} if @class_graphics[$1.to_i].nil?
          @class_graphics[$1.to_i][0] = {} if @class_graphics[$1.to_i][0].nil?
          @class_graphics[$1.to_i][0][:face_name] = $2
          @class_graphics[$1.to_i][0][:face_index] = $3.to_i
        
        # AnimEx compatibility
        when CXJ::REGEXP::ACTOR::HAS_DIAG
          @class_graphics[$1.to_i][0] = {} if @class_graphics[$1.to_i].nil?
          @class_graphics[$1.to_i][0][:has_diagonal] = true

        when CXJ::REGEXP::ACTOR::CHARSET_S
          @class_graphics[$1.to_i] = {} if @class_graphics[$1.to_i].nil?
          @class_graphics[$1.to_i][$2.to_i] = {} if @class_graphics[$1.to_i][$2.to_i].nil?
          @class_graphics[$1.to_i][$2.to_i][:character_name] = $3
          @class_graphics[$1.to_i][$2.to_i][:character_index] = $4.to_i
          
          # AnimEx compatibility
          @class_graphics[$1.to_i][$2.to_i][:is_regular] = true
          
        when CXJ::REGEXP::ACTOR::FACESET_S
          @class_graphics[$1.to_i] = {} if @class_graphics[$1.to_i].nil?
          @class_graphics[$1.to_i][$2.to_i] = {} if @class_graphics[$1.to_i][$2.to_i].nil?
          @class_graphics[$1.to_i][$2.to_i][:face_name] = $3
          @class_graphics[$1.to_i][$2.to_i][:face_index] = $4.to_i
        
        # AnimEx compatibility
        when CXJ::REGEXP::ACTOR::HAS_DIA_S
          @class_graphics[$1.to_i][$2.to_i] = {} if @class_graphics[$1.to_i].nil?
          @class_graphics[$1.to_i][$2.to_i][:has_diagonal] = true
          
        end
      }
      
      # AnimEx compatibility
      @class_graphics.each do |key, value|
        value.each do |subkey, subvalue|
          if $imported["CXJ-AnimEx"] && !subvalue[:character_name].nil? && subvalue[:character_name] =~ /^\!?\[(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*(1|0))?\]/
            @class_graphics[key][subkey][:is_regular] = false if([8, 9].include?($4.to_i))
          end
        end
      end
      
    end
  end


  #============================================================================
  # ** 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
    
    attr_reader :subclass_id
    
    if CXJ::CLASS_EXTENSIONS::USE_PERSISTENT_CLASS_LEVEL
      #----------------------------------------------------------------------
      # * Alias: Setup
      #----------------------------------------------------------------------
      game_actor_setup_cxj_ce = instance_method(:setup)
      define_method :setup do |actor_id|
        game_actor_setup_cxj_ce.bind(self).call(actor_id)
        @exp = $game_persistent_class
        @exp[@class_id] = 0 if self.exp.nil?
      end
    
      #----------------------------------------------------------------------
      # * Override: Initialize Skills
      #----------------------------------------------------------------------
      def init_skills
        @skills = []
        $game_persistent_skills[0] = [] if $game_persistent_skills[0].nil?
        $game_persistent_skills[@class_id] = [] if $game_persistent_skills[@class_id].nil?
        self.class.learnings.each do |learning|
          learn_skill_persist(@class_id, learning.skill_id) if learning.level <= class_level(@class_id)
        end
        return if self.subclass.nil?
        $game_persistent_skills[@subclass_id] = [] if $game_persistent_skills[@subclass_id].nil?
        self.subclass.learnings.each do |learning|
          learn_skill_persist(@subclass_id, learning.skill_id) if learning.level <= class_level(@subclass_id)
        end
      end
  
      #----------------------------------------------------------------------
      # * Override: learn_class_skills
      #----------------------------------------------------------------------
      def learn_class_skills(class_id)
        return if class_id <= 0
        return if $data_classes[class_id].nil?
        $game_persistent_skills[@class_id] = [] if $game_persistent_skills[@class_id].nil?
        $data_classes[class_id].learnings.each do |learning|
          learn_skill_persist(class_id, learning.skill_id) if learning.level == class_level(class_id)
        end
      end
      
      #----------------------------------------------------------------------
      # * Override: Get Skill Object Array
      #----------------------------------------------------------------------
      def skills
        pers_all = (!$game_persistent_skills[0].nil? ? $game_persistent_skills[0] : [])
        pers_class = (!$game_persistent_skills[@class_id].nil? ? $game_persistent_skills[@class_id] : [])
        pers_subclass = (!$game_persistent_skills[@subclass_id].nil? ? $game_persistent_skills[@subclass_id] : [])
        (@skills | added_skills | pers_all | pers_class | pers_subclass).uniq.sort.collect {|id| $data_skills[id] }
      end
    end

    #----------------------------------------------------------------------
    # * New: Get Skill Object Array From Persistent Skills
    #----------------------------------------------------------------------
    def persistent_skills(class_id)
      persist = (!$game_persistent_skills[class_id].nil? ? $game_persistent_skills[class_id] : [])
      (persist).uniq.sort.collect {|id| $data_skills[id] }
    end

    #--------------------------------------------------------------------------
    # * New: Learn Skill (Persistent Class)
    #--------------------------------------------------------------------------
    def learn_skill_persist(class_id, skill_id)
      $game_persistent_skills[class_id] = [] if $game_persistent_skills[class_id].nil?
      unless skill_learn_persist?(class_id, $data_skills[skill_id])
        $game_persistent_skills[class_id].push(skill_id)
        $game_persistent_skills[class_id].sort!
      end
    end
    #--------------------------------------------------------------------------
    # * Forget Skill (Persistent Class)
    #--------------------------------------------------------------------------
    def forget_skill_persist(class_id, skill_id)
      $game_persistent_skills[class_id].delete(skill_id) if !$game_persistent_skills[class_id].nil?
    end
    #--------------------------------------------------------------------------
    # * Determine if Skill Is Already Learned (Persistent Class)
    #--------------------------------------------------------------------------
    def skill_learn_persist?(class_id, skill)
      skill.is_a?(RPG::Skill) && !$game_persistent_skills[class_id].nil? && $game_persistent_skills[class_id].include?(skill.id)
    end

    #------------------------------------------------------------------------
    # New: graphics_opt_in
    #------------------------------------------------------------------------
    def graphics_opt_in
      actor.graphics_opt_in
    end
    #------------------------------------------------------------------------
    # New: class_graphics
    #------------------------------------------------------------------------
    def class_graphics
      sub_id = @subclass_id ? @subclass_id : 0
      return nil if actor.class_graphics.nil? || actor.class_graphics[@class_id].nil?
      return actor.class_graphics[@class_id][sub_id] if CXJ::CLASS_EXTENSIONS::ENABLE_COMBO_SPECIFIC_GRAPHICS && !actor.class_graphics[@class_id][sub_id].nil?
      return actor.class_graphics[@class_id][0] if !actor.class_graphics[@class_id][0].nil?
      return nil
    end
    #------------------------------------------------------------------------
    # New: class_character_index
    #       Added for AnimEx compatibility
    #------------------------------------------------------------------------
    def class_character_index(d)
      cur_graph = class_graphics
      return nil if cur_graph.nil?
      index = cur_graph[:character_index]
      is_regular = cur_graph[:is_regular]
      has_diagonal = cur_graph[:has_diagonal]
      $imported["CXJ-AnimEx"] && is_regular && has_diagonal && d % 2 != 0 ? index + 1 : index
    end
    #------------------------------------------------------------------------
    # New: generic_class_graphics
    #------------------------------------------------------------------------
    def generic_class_graphics
      CXJ::CLASS_EXTENSIONS::GENERIC_CLASS_GRAPHICS[@generic_set]
    end
    #------------------------------------------------------------------------
    # New: default_generic_class_graphics
    #------------------------------------------------------------------------
    def default_generic_class_graphics
      CXJ::CLASS_EXTENSIONS::GENERIC_CLASS_GRAPHICS["DEFAULT"]
    end
    #------------------------------------------------------------------------
    # New: combo_class_graphics
    #------------------------------------------------------------------------
    def combo_class_graphics
      CXJ::CLASS_EXTENSIONS::COMBO_CLASS_GRAPHICS[@generic_set]
    end
    #------------------------------------------------------------------------
    # New: default_combo_class_graphics
    #------------------------------------------------------------------------
    def default_combo_class_graphics
      CXJ::CLASS_EXTENSIONS::COMBO_CLASS_GRAPHICS["DEFAULT"]
    end
    #------------------------------------------------------------------------
    # New: Get Graphics From Default
    #------------------------------------------------------------------------
    def get_graphics_from_default
      if CXJ::CLASS_EXTENSIONS::ENABLE_COMBO_SPECIFIC_GRAPHICS
        return combo_class_graphics[@class_id][@subclass_id] if !combo_class_graphics.nil? && !combo_class_graphics[@class_id].nil? && !combo_class_graphics[@class_id][@subclass_id].nil?
        return default_combo_class_graphics[@class_id][@subclass_id] if !default_combo_class_graphics.nil? && !default_combo_class_graphics[@class_id].nil? && !default_combo_class_graphics[@class_id][@subclass_id].nil?
      end
      return generic_class_graphics[@class_id] if !generic_class_graphics.nil? && !generic_class_graphics[@class_id].nil?
      return default_generic_class_graphics[@class_id] if !default_generic_class_graphics.nil? && !default_generic_class_graphics[@class_id].nil?
      return nil
    end
    #------------------------------------------------------------------------
    # New: generic_class_has_diagonal
    #------------------------------------------------------------------------
    def generic_class_has_diagonal
      CXJ::CLASS_EXTENSIONS::GENERIC_CLASS_HAS_DIAGONAL[@generic_set]
    end
    #------------------------------------------------------------------------
    # New: default_generic_class_has_diagonal
    #------------------------------------------------------------------------
    def default_generic_class_has_diagonal
      CXJ::CLASS_EXTENSIONS::GENERIC_CLASS_HAS_DIAGONAL["DEFAULT"]
    end
    #------------------------------------------------------------------------
    # New: combo_class_has_diagonal
    #------------------------------------------------------------------------
    def combo_class_has_diagonal
      CXJ::CLASS_EXTENSIONS::COMBO_CLASS_HAS_DIAGONAL[@generic_set]
    end
    #------------------------------------------------------------------------
    # New: default_combo_class_has_diagonal
    #------------------------------------------------------------------------
    def default_combo_class_has_diagonal
      CXJ::CLASS_EXTENSIONS::COMBO_CLASS_HAS_DIAGONAL["DEFAULT"]
    end
    #------------------------------------------------------------------------
    # New: Get Has Diagonal From Default
    #------------------------------------------------------------------------
    def get_has_diagonal_from_default
      if CXJ::CLASS_EXTENSIONS::ENABLE_COMBO_SPECIFIC_GRAPHICS
        return combo_class_has_diagonal[@class_id][@subclass_id] if !combo_class_has_diagonal.nil? && !combo_class_has_diagonal[@class_id].nil? && !combo_class_has_diagonal[@class_id][@subclass_id].nil?
        return default_combo_class_has_diagonal[@class_id][@subclass_id] if !default_combo_class_has_diagonal.nil? && !default_combo_class_has_diagonal[@class_id].nil? && !default_combo_class_has_diagonal[@class_id][@subclass_id].nil?
      end
      return generic_class_has_diagonal[@class_id] if !generic_class_has_diagonal.nil? && !generic_class_has_diagonal[@class_id].nil?
      return default_generic_class_has_diagonal[@class_id] if !default_generic_class_has_diagonal.nil? && !default_generic_class_has_diagonal[@class_id].nil?
      return false
    end
    #------------------------------------------------------------------------
    # New: character_name
    #------------------------------------------------------------------------
    def character_name
      if CXJ::CLASS_EXTENSIONS::ENABLE_CLASS_SPECIFIC_GRAPHICS
        if !class_graphics.nil?
          return class_graphics[:character_name] if !class_graphics[:character_name].nil?
        end
        if graphics_opt_in
          character = self.class.character(@subclass_id ? @subclass_id : 0)
          return character[:character_name] if !character.nil? && !character[:character_name].empty? && CXJ::CLASS_EXTENSIONS::CLASS_SPECIFIED_HAS_PRIORITY
          def_graph = get_graphics_from_default
          return def_graph[0] if !def_graph.nil? && !def_graph[0].empty?
          return character[:character_name] if !character.nil? && !character[:character_name].empty?
        end
      end
      @character_name
    end
    #------------------------------------------------------------------------
    # New: character_index
    #------------------------------------------------------------------------
    def character_index(d = 0, has_diagonal = false)
      if CXJ::CLASS_EXTENSIONS::ENABLE_CLASS_SPECIFIC_GRAPHICS
        if !class_graphics.nil?
          return class_character_index(d) if !class_graphics[:character_index].nil?
        end
        if graphics_opt_in
          character = self.class.character(@subclass_id ? @subclass_id : 0)
          return self.class.character_index(d, @subclass_id ? @subclass_id : 0) if !character.nil? && !character[:character_name].empty? && CXJ::CLASS_EXTENSIONS::CLASS_SPECIFIED_HAS_PRIORITY
          def_graph = get_graphics_from_default
          if !def_graph.nil? && !def_graph[0].empty?
            if $imported["CXJ-AnimEx"] && d % 2 != 0
              if def_graph[0] =~ /^\!?\[(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*(1|0))?\]/
                return def_graph[1] if([8, 9].include?($4.to_i))
              end
            end
            return def_graph[1] + (get_has_diagonal_from_default && d % 2 != 0 ? 1 : 0)
          end
          return self.class.character_index(d, @subclass_id ? @subclass_id : 0) if !character.nil? && !character[:character_name].empty?
        end
      end
      if @character_name =~ /^\!?\[(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*(1|0))?\]/
        if([8, 9].include?($4.to_i))
          return @character_index
        end
      end
      has_diagonal && d % 2 != 0 ? @character_index + 1 : @character_index
    end
    #------------------------------------------------------------------------
    # New: face_name
    #------------------------------------------------------------------------
    def face_name
      if CXJ::CLASS_EXTENSIONS::ENABLE_CLASS_SPECIFIC_GRAPHICS
        if !class_graphics.nil?
          return class_graphics[:face_name] if !class_graphics[:face_name].nil?
        end
        if graphics_opt_in
          face = self.class.face(@subclass_id ? @subclass_id : 0)
          return face[:face_name] if !face.nil? && !face[:face_name].empty? && CXJ::CLASS_EXTENSIONS::CLASS_SPECIFIED_HAS_PRIORITY
          def_graph = get_graphics_from_default
          return def_graph[2] if !def_graph.nil? && !def_graph[2].empty?
          return face[:face_name] if !face.nil? && !face[:face_name].empty?
        end
      end
      @face_name
    end
    #------------------------------------------------------------------------
    # New: face_index
    #------------------------------------------------------------------------
    def face_index
      if CXJ::CLASS_EXTENSIONS::ENABLE_CLASS_SPECIFIC_GRAPHICS
        if !class_graphics.nil?
          return class_graphics[:face_index] if !class_graphics[:face_index].nil?
        end
        if graphics_opt_in
          face = self.class.face(@subclass_id ? @subclass_id : 0)
          return face[:face_index] if !face.nil? && !face[:face_name].empty? && CXJ::CLASS_EXTENSIONS::CLASS_SPECIFIED_HAS_PRIORITY
          def_graph = get_graphics_from_default
          return def_graph[3] if !def_graph.nil? && !def_graph[2].empty?
          return face[:face_index] if !face.nil? && !face[:face_name].empty?
        end
      end
      @face_index
    end
    #------------------------------------------------------------------------
    # New: real_character_name
    #------------------------------------------------------------------------
    def real_character_name
      @character_name
    end
    #------------------------------------------------------------------------
    # New: real_character_index
    #------------------------------------------------------------------------
    def real_character_index
      @character_index
    end
    #------------------------------------------------------------------------
    # New: real_face_name
    #------------------------------------------------------------------------
    def real_face_name
      @face_name
    end
    #------------------------------------------------------------------------
    # New: real_face_index
    #------------------------------------------------------------------------
    def real_face_index
      @face_index
    end
    #--------------------------------------------------------------------------
    # * Alias: Get Base Value of Parameter
    #--------------------------------------------------------------------------
    game_actor_param_base_exp_cxj_ce = instance_method(:param_base)
    define_method :param_base do |param_id|
      use_class = CXJ::CLASS_EXTENSIONS::CLASS_LEVEL_PARAMS && !YEA::CLASS_SYSTEM::MAINTAIN_LEVELS
      use_regular = !CXJ::CLASS_EXTENSIONS::CLASS_LEVEL_PARAMS && YEA::CLASS_SYSTEM::MAINTAIN_LEVELS
      return game_actor_param_base_exp_cxj_ce.bind(self).call(param_id) if use_regular && CXJ::CLASS_EXTENSIONS::HYBRIDIZE == :none
      result = self.class.params[param_id, (use_class ? class_level(@class_id) : @level)]
      unless subclass.nil?
        subclass_rate = YEA::CLASS_SYSTEM::SUBCLASS_STAT_RATE
        result*= (1 - subclass_rate) if CXJ::CLASS_EXTENSIONS::HYBRIDIZE == :ratio
        slevel = subclass_level
        result += subclass.params[param_id, slevel] * subclass_rate
        result = result / (2.0) if CXJ::CLASS_EXTENSIONS::HYBRIDIZE == :add
        result = result / (1.0 + subclass_rate) if CXJ::CLASS_EXTENSIONS::HYBRIDIZE == :normalize
      end
      return result.to_i
    end
    
    #------------------------------------------------------------------------
    # * Alias: Change Experience
    #     show : Level up display flag
    #------------------------------------------------------------------------
    game_actor_change_exp_cxj_ce = instance_method(:change_exp)
    define_method :change_exp do |exp, show|
      current_exp = (self.exp ? self.exp : 0)
      do_split = self.class.experience_split
      main_rate = self.class.experience_rate
      sub_ratio = (!subclass.nil? ? subclass.subclass_ratio : 0)
      sub_rate = (!subclass.nil? ? subclass.experience_rate : 0)
      main_exp = exp - current_exp
      main_exp*= [(1.00 - [0, sub_ratio].max), 0].max if do_split
      main_exp*= main_rate
      sub_exp = exp - current_exp
      sub_exp*= [0, sub_ratio].max if !do_split
      sub_exp*= [1.00, [0, sub_ratio].max].min if do_split
      sub_exp*= sub_rate
      @exp[:old] = current_exp
      @exp[:oldsub] = sub_exp
      @exp[@subclass_id] = [@exp[@subclass_id] + sub_exp.to_i, 0].max if !subclass.nil?
      exp = main_exp.to_i + current_exp
      maxLevel = CXJ::CLASS_EXTENSIONS::DEFAULT_MAX_LEV
      maxLevel = self.class.max_level if self.class.max_level > -1
      maxExp = self.class.exp_for_level(maxLevel)
      last_level = @level
      last_mainskills = []
      last_classskills = []
      last_subskills = []
      if CXJ::CLASS_EXTENSIONS::USE_PERSISTENT_CLASS_LEVEL
        last_mainskills = persistent_skills(0) if !$game_persistent_skills[0].nil?
        last_classskills = persistent_skills(@class_id) if !$game_persistent_skills[@class_id].nil?
        last_subskills = persistent_skills(@subclass_id) if !self.subclass.nil? && !$game_persistent_skills[@subclass_id].nil?
      end
      if !CXJ::CLASS_EXTENSIONS::ENABLE_CLASS_LEVEL_LIMITER || YEA::CLASS_SYSTEM::MAINTAIN_LEVELS
        game_actor_change_exp_cxj_ce.bind(self).call(exp, show)
      elsif CXJ::CLASS_EXTENSIONS::STOP_GAINING_EXP_AFTER_MAX
        game_actor_change_exp_cxj_ce.bind(self).call([exp, maxExp].min, show)
      elsif CXJ::CLASS_EXTENSIONS::STOP_LEVELING_AFTER_CLASS_MAX
        @exp[@class_id] = [exp, 0].max
        last_skills = skills
        level_up while !max_level? && self.exp >= next_level_exp && self.exp <= maxExp
        level_down while self.exp < current_level_exp
        display_level_up(skills - last_skills) if show && @level > last_level
        refresh
      else
        game_actor_change_exp_cxj_ce.bind(self).call(exp, show)
      end
      if CXJ::CLASS_EXTENSIONS::USE_PERSISTENT_CLASS_LEVEL
        diff_mainskills = []
        diff_classskills = []
        diff_subskills = []
        diff_mainskills = persistent_skills(0) - last_mainskills if !$game_persistent_skills[0].nil?
        diff_classskills = persistent_skills(@class_id) - last_classskills if !$game_persistent_skills[@class_id].nil?
        diff_subskills = persistent_skills(@subclass_id) - last_subskills if !self.subclass.nil? && !$game_persistent_skills[@subclass_id].nil?
        display_level_up_persist(diff_mainskills, diff_classskills, diff_subskills, last_level) if show
      else
        display_class_update
      end
    end
    #--------------------------------------------------------------------------
    # * Override: Level Up
    #--------------------------------------------------------------------------
    def level_up
      @level += 1
      persist_class = CXJ::CLASS_EXTENSIONS::USE_PERSISTENT_CLASS_LEVEL
      maintain = YEA::CLASS_SYSTEM::MAINTAIN_LEVELS
      self.class.learnings.each do |learning|
        use_class = (learning.use_other ^ CXJ::CLASS_EXTENSIONS::SWITCH_MAIN_LEVEL)
        if ((maintain || !use_class) && learning.level == @level) || (!maintain && use_class && learning.level == class_level(@class_id))
          learn_skill(learning.skill_id) if !persist_class
          learn_skill_persist(@class_id, learning.skill_id) if persist_class
        end
      end
      $skill_class_unlock.each do |skill|
        skill_id = $data_skills.index(skill)
        next if skill_id.nil? || (!persist_class && skill_learn?(skill)) || (persist_class && skill_learn_persist?(0, skill))
        can_add = true
        skill.level_unlock.each do |class_id, level|
          if class_level(class_id) < level
            can_add = false
            break
          end
        end
        learn_skill(skill_id) if can_add && !persist_class
        learn_skill_persist(0, skill_id) if can_add && persist_class
      end
      return if(self.subclass.nil?)
      self.subclass.learnings.each do |learning|
        use_class = (learning.use_other ^ CXJ::CLASS_EXTENSIONS::SWITCH_MAIN_LEVEL)
        if ((maintain || !use_class) && learning.level == @level) || (!maintain && use_class && learning.level == class_level(@subclass_id))
          learn_skill(learning.skill_id) if !persist_class
          learn_skill_persist(@subclass_id, learning.skill_id) if persist_class
        end
      end
    end
    #------------------------------------------------------------------------
    # Override: New: class_level Edited by DisturbedInside
    #------------------------------------------------------------------------
    def class_level(class_id)
      return @level if YEA::CLASS_SYSTEM::MAINTAIN_LEVELS
      current_class = $data_classes[class_id]
      maxLevel = CXJ::CLASS_EXTENSIONS::DEFAULT_MAX_LEV
      maxLevel = current_class.max_level if current_class.max_level > -1
      maxLevel = max_level if !CXJ::CLASS_EXTENSIONS::ENABLE_CLASS_LEVEL_LIMITER
      maxExp = current_class.exp_for_level(maxLevel)
      @exp[class_id] = 0 if @exp[class_id].nil?
      n = 1
      loop do
        break if maxExp < current_class.exp_for_level(n + 1)
        break if @exp[class_id] < current_class.exp_for_level(n + 1)
        n+= 1
      end
      return n
    end
    #------------------------------------------------------------------------
    # * Alias: Get Array of All Objects Retaining Features
    #------------------------------------------------------------------------
    game_actor_feature_objects_cxj_ce = instance_method(:feature_objects)
    define_method :feature_objects do
      obj = game_actor_feature_objects_cxj_ce.bind(self).call
      obj+= [self.subclass] if !self.subclass.nil? && CXJ::CLASS_EXTENSIONS::SUBCLASS_TRAITS
      obj
    end
    
    #------------------------------------------------------------------------
    # * Override: Show Level Up Message
    #     new_skills : Array of newly learned skills
    #------------------------------------------------------------------------
    def display_level_up(new_skills)
      $game_message.new_page
      if CXJ::CLASS_EXTENSIONS::SHOW_CLASS_EXP_GAIN[:charlevel]
        $game_message.add(sprintf(Vocab::LevelUp, @name, Vocab::level, @level))
      else
        $game_message.add(sprintf(CXJ::CLASS_EXTENSIONS::VOCAB::CHARACTER_LEVELED_UP, @name))
      end
      return if CXJ::CLASS_EXTENSIONS::USE_PERSISTENT_CLASS_LEVEL
      new_skills.each do |skill|
        $game_message.add(sprintf(Vocab::ObtainSkill, skill.name))
      end
    end
    #------------------------------------------------------------------------
    # * New: Show Class Update
    #------------------------------------------------------------------------
    def display_class_update
      if CXJ::CLASS_EXTENSIONS::SHOW_CLASS_EXP_GAIN[:classexp]
        $game_message.add(sprintf(CXJ::CLASS_EXTENSIONS::VOCAB::CLASS_EXP_GAINED, @name, @exp[@class_id] - @exp[:old]))
      end
      if CXJ::CLASS_EXTENSIONS::SHOW_CLASS_EXP_GAIN[:classlevel]
        temp = @exp[@class_id]
        @exp[@class_id] = @exp[:old]
        old_level = class_level(@class_id)
        @exp[@class_id] = temp
        if old_level != class_level(@class_id)
          $game_message.add(sprintf(Vocab::LevelUp, self.class.name, Vocab::level, class_level(@class_id)))
        end
      end
      if !subclass.nil?
        if CXJ::CLASS_EXTENSIONS::SHOW_CLASS_EXP_GAIN[:classexp]
          $game_message.add(sprintf(CXJ::CLASS_EXTENSIONS::VOCAB::CLASS_EXP_GAINED, @name, @exp[@subclass_id] - @exp[:oldsub]))
        end
        if CXJ::CLASS_EXTENSIONS::SHOW_CLASS_EXP_GAIN[:classlevel]
          temp = @exp[@subclass_id]
          @exp[@subclass_id] = @exp[:oldsub]
          old_level = class_level(@subclass_id)
          @exp[@subclass_id] = temp
          if old_level != class_level(@subclass_id)
            $game_message.add(sprintf(Vocab::LevelUp, self.subclass.name, Vocab::level, class_level(@subclass_id)))
          end
        end
      end
    end
    
    #------------------------------------------------------------------------
    # * New: Show Level Up Message
    #     new_skills : Array of newly learned skills
    #------------------------------------------------------------------------
    def display_level_up_persist(new_skills, new_class, new_subclass, last_level)
      new_skills.each do |skill|
        $game_message.add(sprintf(Vocab::ObtainSkill, skill.name))
      end
      if CXJ::CLASS_EXTENSIONS::SHOW_CLASS_EXP_GAIN[:classexp]
        $game_message.add(sprintf(CXJ::CLASS_EXTENSIONS::VOCAB::CLASS_EXP_GAINED, @name, @exp[@class_id] - @exp[:old]))
      end
      if CXJ::CLASS_EXTENSIONS::SHOW_CLASS_EXP_GAIN[:classlevel]
        temp = @exp[@class_id]
        @exp[@class_id] = @exp[:old]
        old_level = class_level(@class_id)
        @exp[@class_id] = temp
        if old_level != class_level(@class_id)
          $game_message.add(sprintf(Vocab::LevelUp, self.class.name, Vocab::level, class_level(@class_id)))
        end
      end
      new_class.each do |skill|
        $game_message.add(sprintf(Vocab::ObtainSkill, skill.name))
      end
      if !subclass.nil?
        if CXJ::CLASS_EXTENSIONS::SHOW_CLASS_EXP_GAIN[:classexp]
          $game_message.add(sprintf(CXJ::CLASS_EXTENSIONS::VOCAB::CLASS_EXP_GAINED, @name, @exp[@subclass_id] - @exp[:oldsub]))
        end
        if CXJ::CLASS_EXTENSIONS::SHOW_CLASS_EXP_GAIN[:classlevel]
          temp = @exp[@subclass_id]
          @exp[@subclass_id] = @exp[:oldsub]
          old_level = class_level(@subclass_id)
          @exp[@subclass_id] = temp
          if old_level != class_level(@class_id)
            $game_message.add(sprintf(Vocab::LevelUp, self.subclass.name, Vocab::level, class_level(@subclass_id)))
          end
        end
        new_subclass.each do |skill|
          $game_message.add(sprintf(Vocab::ObtainSkill, skill.name))
        end
      end
    end
  end

  #============================================================================
  # ** Game_Player
  #----------------------------------------------------------------------------
  #  This class handles the player. It includes event starting determinants and
  # map scrolling functions. The instance of this class is referenced by
  # $game_player.
  #============================================================================

  class Game_Player < Game_Character
    #------------------------------------------------------------------------
    # * New: Refresh
    #------------------------------------------------------------------------
    def refresh
      @character_name = actor ? actor.real_character_name : ""
      @character_index = actor ? actor.real_character_index : 0
      @followers.refresh
    end
    #------------------------------------------------------------------------
    # New: character_name
    #------------------------------------------------------------------------
    def character_name
      if CXJ::CLASS_EXTENSIONS::ENABLE_CLASS_SPECIFIC_GRAPHICS
        cname = actor.character_name
        cind = actor.character_index(@direction)
        return cname if cname != actor.real_character_name || cind != actor.real_character_index
      end
      @character_name
    end
    #------------------------------------------------------------------------
    # New: character_index
    #------------------------------------------------------------------------
    def character_index
      if CXJ::CLASS_EXTENSIONS::ENABLE_CLASS_SPECIFIC_GRAPHICS
        cname = actor.character_name
        cind = actor.character_index(@direction)
        return cind if cname != actor.real_character_name || cind != actor.real_character_index
      end
      if $imported["CXJ-AnimEx"]
        super
      else
        @character_index
      end
    end
    #------------------------------------------------------------------------
    # New: face_name
    #------------------------------------------------------------------------
    def face_name
      if CXJ::CLASS_EXTENSIONS::ENABLE_CLASS_SPECIFIC_GRAPHICS
        fname = actor.face_name
        return fname if fname != actor.real_face_name || actor.face_index != actor.real_face_index
      end
      @face_name
    end
    #------------------------------------------------------------------------
    # New: face_index
    #------------------------------------------------------------------------
    def face_index
      if CXJ::CLASS_EXTENSIONS::ENABLE_CLASS_SPECIFIC_GRAPHICS
        fname = actor.face_name
        return actor.face_index if fname != actor.real_face_name || actor.face_index != actor.real_face_index
      end
      @face_index
    end
  end

  #============================================================================
  # ** Window_Base
  #----------------------------------------------------------------------------
  #  This is a super class of all windows within the game.
  #============================================================================

  class Window_Base < Window
  
    #------------------------------------------------------------------------
    # * Override: Draw Class
    #------------------------------------------------------------------------
    def draw_actor_class(actor, x, y, width = 112)
      change_color(normal_color)
      if actor.subclass.nil?
        text = actor.class.name
      elsif !actor.class.combined_name[actor.subclass_id].nil?
        text = actor.class.combined_name[actor.subclass_id]
      else
        fmt = YEA::CLASS_SYSTEM::SUBCLASS_TEXT
        text = sprintf(fmt, actor.class.name, actor.subclass.name)
      end
      draw_text(x, y, width, line_height, text)
    end
  end

  if $imported["YEA-ClassSpecifics"]
    #==========================================================================
    # ** Window_ClassList
    #--------------------------------------------------------------------------
    #  This class handles the class list window
    #==========================================================================

    class Window_ClassList < Window_Selectable
      
      #----------------------------------------------------------------------
      # Override: make_item_list
      #----------------------------------------------------------------------
      def make_item_list
        @data = []
        for class_id in YEA::CLASS_SYSTEM::CLASS_ORDER
          next if $data_classes[class_id].nil?
          item = $data_classes[class_id]
          next if CXJ::CLASS_EXTENSIONS::CLASS_HIDE_MODE == 1 && !available?(item)
          @data.push(item) if include?(item)
        end
      end
      
      #----------------------------------------------------------------------
      # New: Check if available
      #----------------------------------------------------------------------
      def available?(item)
        case @command_window.current_symbol
        when :primary
          return false if item.subclass_only
        when :subclass
          return false if item.primary_only
          return @actor.subclass_to?(item.id) if item.subclass_to != []
        end
        return true
      end
      
      #----------------------------------------------------------------------
      # Alias: set_item_colour
      #----------------------------------------------------------------------
      window_classlist_set_item_color = instance_method(:set_item_colour)
      define_method :set_item_colour do |item|
        if CXJ::CLASS_EXTENSIONS::CLASS_HIDE_MODE == 2
          primary_enable = (@command_window.current_symbol == :primary ? item == @actor.class : enable?(item))
          subclass_enable = (@command_window.current_symbol == :subclass ? item == @actor.subclass : enable?(item))
          if item == @actor.class
            change_color(text_color(YEA::CLASS_SYSTEM::CURRENT_CLASS_COLOUR), primary_enable)
          elsif item == @actor.subclass
            change_color(text_color(YEA::CLASS_SYSTEM::SUBCLASS_COLOUR), subclass_enable)
          else
            change_color(normal_color, enable?(item))
          end
        else
          window_classlist_set_item_color.bind(self).call(item)
        end
      end
    end
  end
  
  if $imported["YEA-LearnSkillEngine"]
    #==========================================================================
    # ** Window_LearnSkillList
    #==========================================================================

    class Window_LearnSkillList < Window_SkillList
      #----------------------------------------------------------------------
      # Alias: meet_requirements?
      #----------------------------------------------------------------------
      window_learnskilllist_meet_requirements_cxj_ce = instance_method(:meet_requirements?)
      define_method :meet_requirements? do |item|
        test = :meet?
        return false unless window_learnskilllist_meet_requirements_cxj_ce.bind(self).call(item)
        return false unless meet_class_level_requirements?(item)
        return true
      end
      
      #----------------------------------------------------------------------
      # New: meet_class_level_requirements?
      #----------------------------------------------------------------------
      def meet_class_level_requirements?(item)
        item.level_learn_unlock.each do |class_id, learn_level|
          return false if @actor.class_level(class_id) < learn_level
        end
        return true
      end
    end
  end
end



FAQ
N/A

Credit and Thanks
- GaryCXJk
- Yanfly for the original script (which is required anyway, so you should give credits anyway)

Author's Notes
License: Creative Commons Attribution 3.0 Unported
Complete license
Human language version
This script can also be found on: Area91
More notes in the script.

Edited by GaryCXJk

Share this post


Link to post
Share on other sites

I've updated the script to 1.03 1.04 1.05 1.06 1.07 1.08. This adds compatibility for certain mods it normally isn't compatible with.

Edited by GaryCXJk

Share this post


Link to post
Share on other sites

Not sure if you've removed this error, as I'm using 1.03, but if you set maintain_class_levels to false in YEA Class System, but then set ENABLE_CLASS_LEVEL_LIMITER in your script to false, you get an error, where it says you're trying to round an imaginary number.  Not sure how it gets from A to B, but yeah.

 

If I decide to upgrade to 1.08, what other scripts do I have to remove?  Like Estriole's Subclass Gain EXP or Yanfly's add-ons?

 

Thanks.

Share this post


Link to post
Share on other sites

Well, you can disable experience gain for subclasses in this script by setting it to 0.00. It's an aliased method anyway, so if experience gain is done even by overriding the gain_exp method, there's not much harm done. I've mainly did it like this because of other experience gain scripts that might have a better way of handling it.

 

For anything else, you could read up what classes get overridden and aliased by my script, and perhaps go through the scripts you have, see what gets overridden, or what gets aliased. Most of the time, though, you won't have to do anything else, I've tried to make it as compatible as possible. If there's an incompatibility with another script, just tell me and I'll see what I can do.

 

Also, I've updated the script again to 1.09, as 1.08 had some awful game-breaking bugs.

Edited by GaryCXJk

Share this post


Link to post
Share on other sites

The only problem I was predicting was a stack too deep error, because others have written scripts to fill in the same gaps as you did. 

 

Which is the most stable version of the script?

Share this post


Link to post
Share on other sites

Okay, updated it to version 1.11, which changes the way it aliases. Hopefully it helps just a bit. I haven't checked how it does with multiple nesting though, that I'll need to test. For now, make sure this script is loaded last.

 

Also solves a previously unfound bug I discovered when I noticed no skills were present.

 

EDIT: It's safe to alias from these methods.

 

To give the gist of how I changed it, I just searched on the internet for an alternate way to alias stuff.

 

Article

 

Long story short:

aliased_method = instance_method(:symbol_of_method)
define_method :symbol_of_method do |parameters|
  aliased_method.bind(self).call(parameters)
end

Note that this is most likely as leak as a basket when it comes to memory, and it alledgedly takes three times longer to execute.

 

EDIT2: I've ran a test. I doubt it really has to do with the stack level being too deep, but more with two aliases being identical in naming.

 

You'd need to have a depth of 8730 recursive iterations before it becomes an issue. In fact, this is the same depth for any recursive function.

 

As a test, I made the following:

class Test
  def recursion(i)
    puts i
    recursion(i + 1)
  end
end

test = Test.new
test.recursion(1)
Edited by GaryCXJk

Share this post


Link to post
Share on other sites

Possible math error, lines 1095-1100:

result = self.class.params[param_id, @level]
result += subclass.params[param_id, slevel] * subclass_rate
result = result / (1 + subclass_rate) if CXJ::CLASS_EXTENSIONS::HYBRIDIZE

This math doesn't make sense. 

If your class stats are 100, your subclass rate is 0.5, and your subclass stats are 100, then your result is 150/ (1.5) = 100.  This is correct. 

If your class stats are 100, your subclass rate is 0.5, and your subclass stats are 50, then your result is 125/1.5 (83.333).  It's supposed to be 75. 

If your class stats are 82, your subclass rate is 0.37, and your subclass stats are 41, then your result is 97.17/1.37 (70.927).  It's supposed to be 66.83.

 

Yanfly does it in his original script:

 

result = self.class.params[param_id, @level] * (1 - subclass_rate)
result += (subclass.params[param_id, slevel]) * subclass_rate

 

Which is correct.

 

EDIT: I was assuming you'd want the class and subclass to evenly split their stats based on the subclass rate.  Also, you are rewriting code that exists in the original script (not an add-on).

Edited by ekomega

Share this post


Link to post
Share on other sites

In that case, there would have been no need for hybridization.

 

Either way, I can't find that piece of code in my version of the Class System. I've got version 1.10, found on Yanfly Channel.

 

EDIT: Updated to v1.12.

Edited by GaryCXJk

Share this post


Link to post
Share on other sites

In the configuration section, there is

 

# This adjusts the stat rate inheritance for an actor if an actor has a
    # subclass equipped. If you want to disable this, set the rate to 0.0.
    SUBCLASS_STAT_RATE = 0.20

And if you search for subclass_stat_rate, you find in class Game_Actor < Game_Battler:

 #--------------------------------------------------------------------------
  # alias method: param_base
  #--------------------------------------------------------------------------
  alias game_actor_param_base_cs param_base
  def param_base(param_id)
    result = game_actor_param_base_cs(param_id)
    unless subclass.nil?
      subclass_rate = YEA::CLASS_SYSTEM::SUBCLASS_STAT_RATE
      slevel = subclass_level
      result += subclass.params[param_id, slevel] * subclass_rate
    end
    return result.to_i
  end

And it turns out that I modified the code myself, to hybridize  Sorry about that. 

 

But I think the math correction is still valid, depending on what you were trying to achieve.

Share this post


Link to post
Share on other sites

Thanks for the updates.

 

I've noticed that when I use an event to increase level or exp, it doesn't work anymore with your script.  Have you noticed this?

Share this post


Link to post
Share on other sites

Okay, I've moved the subclass leveling to another method, so it should work now.

 

Also, I have added persistent class levels, as in, level up with one character, use that level on another. I might even have something to allow inactive subclasses to level as well, and have only a certain amount of characters per class as well. Right now it's enabled because I forgot to disable it.

Share this post


Link to post
Share on other sites

I keep getting an error when I try to enter a battle in the database, it states that

 

Line 1312: typeerror occured

nil cant be coerced into fixnum

 

Any ideas?

 

Edit; going through the script, it seems to be a compatibility problem with another script that I am using, though I am not sure which one. I checked through all of my aliased and overwritten methods, and nothing seems to conflict.

Though, the conflict or error has to do with code pertaining to Shared class levels across actors-

The problem ceases when I set shared class leveling to false. Which is okay, because that was a feature I intended on using anyway :P

 

Anyway, consider my problem solved, but if it is indeed not a compatibility problem and is in fact an error in code, I wished to share my experience with you, just in case. ;)

Edited by Jaysynn

Share this post


Link to post
Share on other sites

I checked this script again and again and I can't find the command to use it from a commun event.

Am I just blind or there is none.

For my project, I don't want the class option in the menu. I need it to pop when you talk to a NPC.

If you can help me out with that it would be appreciated.

 

Thanks

Share this post


Link to post
Share on other sites


If it's not in the how to use section, it's not there.

You should try looking in the Class System script. This issue lies outside this script's scope.

Share this post


Link to post
Share on other sites

Here's the issues I'm stil having (just updated to 1.15):

 

In my status window (Ace Status Menu), it says the actor is max level, and requires no experience to level.  This is due to the separation of class and actor.  I'd prefer if it listed the experience to level of the currently "equipped" class.

 

When I create an event that gives experience or levels up, they don't work, because they all apply to actor level, not class level. 

 

The display of level in the main menu screen (ace menu engine) uses actor level, not class level.  I'd also like to have this display the current class level (and name, if possible).

 

Side issue: When a subclass levels up from exp sharing, it displays "(class name) levels up!" twice in the victory aftermath text.

 

Is there any way to fix these issues on your end?  Or you can point me in the right direction of what variable/array/whatver I need to reference in each instance.

 

 

Thanks!

Edited by ekomega

Share this post


Link to post
Share on other sites

The main function I was wanting to use from this script was: "- Hide classes that are primary or subclass specific (requires Class Specifics addon)."

 

However, it doesn't seem to be working. It appears to be hiding the wrong type of class (it shows the Subclass only classes in the Primary Class list while hiding all of the Primary Classes and vice versa).

 

Example:

Swordsman is a Primary only class.

Duelist is a Subclass only class.

Duelist will show up greyed out in the Primary class list, while Swordsman doesn't show up at all. Then when you go to set your Subclass, now Swordsman shows up greyed out and you can't see Duelist in the list.

Share this post


Link to post
Share on other sites
Here's the issues I'm stil having (just updated to 1.15):

 

In my status window (Ace Status Menu), it says the actor is max level, and requires no experience to level.  This is due to the separation of class and actor.  I'd prefer if it listed the experience to level of the currently "equipped" class.

 

When I create an event that gives experience or levels up, they don't work, because they all apply to actor level, not class level. 

 

The display of level in the main menu screen (ace menu engine) uses actor level, not class level.  I'd also like to have this display the current class level (and name, if possible).

 

Side issue: When a subclass levels up from exp sharing, it displays "(class name) levels up!" twice in the victory aftermath text.

 

Is there any way to fix these issues on your end?  Or you can point me in the right direction of what variable/array/whatver I need to reference in each instance.

 

 

Thanks!

 

Of these issues, only the last has been fixed, as I have yet to replicate any of the things you've described. I've tested experience gaining through events, and it does level up the classes instead of just the actor. I haven't tried it with increasing level, but as far as I know I only need to account for experience sharing in this case. This issue will be solved in a later update. Having Ace Status Menu should not affect this, and neither should Ace Menu Engine, but I will look into it regardless.

 

The main function I was wanting to use from this script was: "- Hide classes that are primary or subclass specific (requires Class Specifics addon)."

 

However, it doesn't seem to be working. It appears to be hiding the wrong type of class (it shows the Subclass only classes in the Primary Class list while hiding all of the Primary Classes and vice versa).

 

Example:

Swordsman is a Primary only class.

Duelist is a Subclass only class.

Duelist will show up greyed out in the Primary class list, while Swordsman doesn't show up at all. Then when you go to set your Subclass, now Swordsman shows up greyed out and you can't see Duelist in the list.

Fixed it in the latest version. It was a mistake on my part.

 

Anyway, I'll be updating a lot less frequently, as I'm currently in the process of writing a novel called Eldritch Fairytales. You should Google it sometimes.

Share this post


Link to post
Share on other sites

Hi,

 

I'm having an issue and I have absolutely no idea what's causing it sadly. When I make the test and everything, the Classes and Actor don't get any experience.

 

It also doesn't tell the EXP needed to Next Level.

 

1176619379.jpg

 

 

And the Actor's Level change back to one even if I choose a Level 20 Class. (And I had set the Actor Level to 25)

 

1176619862.jpg

 

 

I really don't know what to do about this ; v;

If someone could explain things to me, that'd be great c:

And I'm sorry if these things are already explained, I've been messing around with this for hours 

 

Do you think it could be happening due to a conflict with another Script?

(I have alot of Script, and I should probably clean a little)

 

But either I'm blind and can't read properly, or I just suck at understanding o -o;

 

EDIT:: This is also happening.

 

1176620773.jpg

 

Edited by Keikuina

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×
Top ArrowTop Arrow Highlighted