MrDenimLP
Apr 16 2012, 11:01 PM
I'm a fairly new user of RPG Maker XP - only having it for 4 days now - And I am wondering if it is possible to event or script in where whenever the hero or any of the party members level up, their HP and SP are reset to that level's maximum. Any ideas? And an answer in a tutorial-like format would great!
Resource Dragon
Apr 18 2012, 11:44 AM
Moved to RGSS Script Requests. ~RD
MrDenimLP
Apr 18 2012, 07:43 PM
Nvm, I found a script. Here it is if you want to use it:
#==============================================================================
# ** Heal On Level Up
# By Ccoa
#------------------------------------------------------------------------------
# When you level up all your HP and SP will be return to max
#==============================================================================
class Game_Actor < Game_Battler
alias exp_normal exp
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
# Learn skill
for j in $data_classes[@class_id].learnings
if j.level == @level
learn_skill(j.skill_id)
end
end
# heal
@hp = self.maxhp
@sp = self.maxsp
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