#==============================================================================
# Job-based Level Up Stats (RO Edit) Ver 1.0
# By KK20 Jul 10 19
#------------------------------------------------------------------------------
# Purpose:
# Allows actors to gain bonus stats based on their class/job upon leveling up.
# For example, a Warrior gains more STR and Max HP while Mages gain more INT
# and Max MP.
#
# Instructions:
# Place below default scripts but above Main (the usual). The lower the better.
# Place below RO Job/Skill System.
# Configure the stat bonuses below (instructions provided there).
#
#==============================================================================
module JobLevelUp
def self.level_up_stats(id)
case id
#-------------------------------------------------------------------------
# Configure:
#
# when CLASS_ID
# [MAX_HP, MAX_SP, STR, DEX, AGI, INT]
#
# where CLASS_ID is the database index of the class and each range in the
# array indicates a random value in which the stat will increase per level up.
#
# When a single integer is used, it will select between 1 and the value selected
# Otherwise, use a range. For example:
# [2..5, 3, 5..7, 4, 8, 3..10]
# On level up, they'll get between 2 and 5 HP points, 1 and 3 SP points...etc.
#-------------------------------------------------------------------------
# MAX_HP MAX_SP STR DEX AGI INT
# [low..hi, low..hi, low..hi, low..hi, low..hi, low..hi]
# If a low value is ommited, selects a value between
when 1 # Fighter
[2..7, 2, 3..5, 2..6, 3..8, 2]
when 2 # Lancer
[8, 3, 4, 3, 2, 3]
when 3 # Warrior
[10, 1, 7, 1, 4, 1]
when 4 # Thief
[4, 3, 2, 6, 6, 4]
else # Classes not defined will use this default value
[5, 5, 5, 5, 5, 5]
end
end
end
class Game_Actor
def level_up_stat_gain(levels, class_id)
stat_array = JobLevelUp.level_up_stats(class_id)
# Perform random selection per level gained
levels.times {
self.maxhp += stat_array[0].is_a?(Range) ? rand(stat_array[0]) : stat_array[0]
self.maxsp += stat_array[1].is_a?(Range) ? rand(stat_array[1]) : stat_array[1]
self.str += stat_array[2].is_a?(Range) ? rand(stat_array[2]) : stat_array[2]
self.dex += stat_array[3].is_a?(Range) ? rand(stat_array[3]) : stat_array[3]
self.agi += stat_array[4].is_a?(Range) ? rand(stat_array[4]) : stat_array[4]
self.int += stat_array[5].is_a?(Range) ? rand(stat_array[5]) : stat_array[5]
}
end
#----------------------------------------------------------------------------
# job_level_change
# val - new level value
# id - class ID
# flag - determines whether EXP should be updated or not
# This method processes change of a job level.
#----------------------------------------------------------------------------
alias get_job_level_change_diff job_level_change
def job_level_change(val, id = @class_id, flag = true)
old_level = job_level(id)
get_job_level_change_diff(val, id, flag)
level_diff = job_level(id) - old_level
level_up_stat_gain(level_diff, id)
end
end