Introduction The concept here is pretty simple. This script alters how much exp an actor needs to level based on his or her current class.
Features - Modify the amount of exp needed for a class based on a percentage of the default - New exp tables are created on class change - Exp or level is adjusted accordingly based on the modified experience values in one of three settings - Apply an artificial level cap based on current class. (will not go above the current maximum, but is compatable with script that allow this)
How to Use Install on its own script page in the materials section of the script editor above main and below class change scripts.
Script
Spoiler:
CODE
# Class Based Exp Modifiers # v 1.0 # By Mithran at RMVX.net # Please do not redistribute without asking!
# This script changes how much any given actor needs to level based on his # current class. # Install: Insert above main and below class changer scripts. # See the module for setup.
module Mithran module ClassExp CLASS_EXP_CONVERT_STYLE = 2 # The conversion style when a new exp list is made. # 0 - Exp total remains the same as it was before class change. Level is # adjusted accordingly. # 1 - Level remains the same as it was before class change. If exp is below # what is required to sustain current level, it will be adjusted to the # minimum required for the level. If it is above the amount required to # reach the next level, it will be adjusted to one below the next level. # 2 - Level remains the same as it was before class change. Exp will # adjusted so the actor remains the approximate percent amount of level # completed than he was before the change.
SHOW_CLASS_CHANGE_LEVEL = true # If 0 is selected above and the class change automatically levels up an # actor, this setting determines whether or not the level up will be shown.
CLASS_EXP_MOD = {} # Do not alter this line! # Below here, set up the percentage modifiers each class takes to get to the # next level # * notice - the minmum required exp for any given level will be one above # the previous level # Format is: # CLASS_EXP_MOD[class_id] = n # replace class_id with the class you are modifying and n with the percentage # of the normal exp this class will take to level
# Example:
CLASS_EXP_MOD[1] = 125 # Paladin requires 125% of the normal exp to level (25% extra) CLASS_EXP_MOD[2] = 150 # Warrior requires 150% of the normal exp to level (50% extra) CLASS_EXP_MOD[3] = 200 # Priest requires 200% of the normal exp to level (double normal) CLASS_EXP_MOD[4] = 50 # Magician requires 50% of the normal exp to level (half as much) # You may comment out or change any of the above as necessary.
CLASS_MAX_LEVELS = {} # Do not alter this line! # Below here, set up the individiual max levels for each class. # Note that this script by itself will not allow levels to go above the # default of 99, but it should be compatible with others that do. # Format is: # CLASS_MAX_LEVELS[class_id] = n # replace class_id with the class you are modifying and n with the # artificial level cap # Examples: CLASS_MAX_LEVELS[1] = 30 # Paladin is capped at level 30 CLASS_MAX_LEVELS[2] = 30 # Warrior is capped at level 30 CLASS_MAX_LEVELS[3] = 50 # Priest is capped at level 50 CLASS_MAX_LEVELS[4] = 50 # Magician is capped at level 50
# You may comment out or change any of the above as necessary.
end end
class Game_Actor < Game_Battler include Mithran::ClassExp def mod_exp_table return if CLASS_EXP_MOD[@class_id] == nil || CLASS_EXP_MOD[@class_id] == 100 @exp_list.each_index { |i| next if @exp_list[i] == nil # handles places where exp is not assigned (level 0) next if @exp_list[i] == 0 # no further checks are needed for minimum or maximum levels, which are 0 # exp on the list @exp_list[i] = @exp_list[i] * CLASS_EXP_MOD[@class_id] / 100 # apply the exp modification if @exp_list[i] <= @exp_list[i - 1] @exp_list[i] = @exp_list[i - 1] + 1 # minimum exp must be 1 above last level end } end
alias make_exp_list_classxp make_exp_list def make_exp_list pct_of_level = nil if !@exp_list.compact.empty? last_exp = @exp_list[@level] next_exp = @exp_list[@level + 1] current_exp = @exp if last_exp < next_exp pct_of_level = (current_exp - last_exp) / ((next_exp - last_exp) * 1.0) # calculate how far the actor is in to his current level else # if the next_exp is lower than the last_exp, it would indicate that # the next level is the max level. pct_of_level = 100 # we set this number to 100 for later reference # (since 100 is impossible in the above calculation) end end make_exp_list_classxp mod_exp_table if pct_of_level == nil if CLASS_MAX_LEVELS[@class_id] != nil && @exp_list[CLASS_MAX_LEVELS[@class_id]] != nil @level = CLASS_MAX_LEVELS[@class_id] if @level > CLASS_MAX_LEVELS[@class_id] end return end case CLASS_EXP_CONVERT_STYLE when 1 if @exp < @exp_list[@level] # if exp is below the amount require for the current level change_exp(@exp_list[@level], false) # adjust exp to the minimum required for level elsif @exp >= @exp_list[@level+1] # if exp is above the amount to get to the next level if @exp_list[@level+1] > 0 # if the next level is not the max level change_exp(@exp_list[@level+1] - 1, false) # adjust exp to one less than required to level else # cap out exp, if necessary change_exp(@exp, false) end end when 2 if pct_of_level != nil && pct_of_level != 100 # change the exp to the percent it was, rounded down change_exp(@exp_list[@level] + ((@exp_list[@level+1] - @exp_list[@level]) * pct_of_level).floor, false) elsif pct_of_level == 100 change_exp(@exp, false) # cap out exp, if necessary end else # if 0 or anything else is selected last_level = @level change_exp(@exp, SHOW_CLASS_CHANGE_LEVEL) $scene = Scene_Map.new if SHOW_CLASS_CHANGE_LEVEL && !$game_temp.in_battle && @level > last_level # adjust level to the correct place on the exp table end end
alias class_id_classxp= class_id= def class_id=(new_class_id) self.class_id_classxp = new_class_id make_exp_list end
alias change_exp_classxp change_exp def change_exp(exp, show) max = CLASS_MAX_LEVELS[@class_id] return change_exp_classxp(exp, show) if max == nil while @exp_list[max] == nil max -= 1 if max <= 0 max = 1 break end end exp = @exp_list[max] if exp >= @exp_list[max] && @exp_list[max] != 0 change_exp_classxp(exp, show)
end
end
FAQ Q: Instead of having to deal with all the complicated exp lists, why not just apply a rate to the amount of experience earned? A: While this method would be much simpler, it just didnt have the same effect on the numbers. If anyone wants a script like this, just ask.
Credit and Thanks - Mithran - Suggested by Aranarther
Thanks! It works perfectly, I've also just completed my promotion scene and combined it with your sub party index script and created the perfect priest from Shining Force game :3.
--------------------
Current Game In Progress:
Spoiler:
Progress:
Storyline: 60%
Characters: 100%
Enemies: 70%
Mapping: 40%
Eventing: 10% (I don't like eventing, so I'll do it later/last)
Database: 60%
System: 95% (only some bugfixes and optimizing left)
Great idea Mithran. Such a simple concept but could be a powerful tool, could work great for having "super classes" take longer to level up. Thank you very much!