class Game_Actor
def exp=(exp)
@exp = [[exp, 9999999].min, 0].max
# Level up
while @exp >= @exp_list[@level+1] and @exp_list[@level+1] > 0
@level += 1
# increment the corresponding game variable
$game_variables[@actor_id] += 1
# Learn skill
for j in $data_classes[@class_id].learnings
if j.level == @level
learn_skill(j.skill_id)
end
end
end
# Level down
while @exp < @exp_list[@level]
@level -= 1
end
# Correction if exceeding current max HP and max SP
@hp = [@hp, self.maxhp].min
@sp = [@sp, self.maxsp].min
end
end
class Game_Actor
def level_up
@level += 1
# increment the corresponding game variable
$game_variables[@actor_id] += 1
for learning in self.class.learnings
learn_skill(learning.skill_id) if learning.level == @level
end
end
end