<HP/MP Recovery After Battle>
<9-18-2008>
SummaryLooking for a script that would recovery a certain % of HP/MP based on Spirit after battle. I want this to happen during the battle reward screen, or at least after enemies are dead, and before the Battle End. I want Spirit to add + .5% HP/MP per point.
Features Desired
- HP/MP Recovery after battle
- Recovery before battle end if possible, if not it's ok
Games its been in
Did you search?yes
Where did you search?What did you search for?
Okay, is this separate from your initial question in support, or is it connnected?
The following code will restore an actor to 1 HP if he was just dead, and if not, will restore 0.5% of his HP and MP. It has no graphical component. If you want something different, please ask.
class Scene_Battle
#--------------------------------------------------------------------------
# * End Battle
# result : Results (0: win, 1: escape, 2:lose)
#--------------------------------------------------------------------------
alias ghero_hp_recover_to1_on_bttl_end_8fbf battle_end
def battle_end(result)
ghero_hp_recover_to1_on_bttl_end_8fbf (result)
return if result == 2
$game_party.members.each { |actor|
if actor.dead?
actor.hp = 1
else
actor.hp += (0.5*actor.maxhp).to_i
actor.mp += (0.5*actor.maxmp).to_i
end
}
end
end
Awesome. It's such a small code but I can't figure it out xD I went from RPGMaker2000 to this xD heh Thanks a whole bunch man! I'll have other small things later I presume :p
P.S. If I want to change
actor.hp += (0.5*actor.maxhp).to_i
actor.mp += (0.5*actor.maxmp).to_i
to rely on Spirit I would change the code to
actor.hp += ((0.5*actor.spi)%*actor.maxhp).to_i
actor.mp += ((0.5*actor.spi)%*actor.maxmp).to_i
I think at least, would that % work in the formula?
Figured out the actul script!
#--------------------------------------------------------
# HP > 0 Script by Ghero
# Made possible by modern algebra
#--------------------------------------------------------
class Scene_Battle
#--------------------------------------------------------------------------
# * End Battle
# result : Results (0: win, 1: escape, 2:lose)
#--------------------------------------------------------------------------
alias ghero_hp_recover_to1_on_bttl_end_8fbf battle_end
def battle_end(result)
ghero_hp_recover_to1_on_bttl_end_8fbf (result)
return if result == 2
$game_party.members.each { |actor|
if actor.dead?
actor.hp = 1
else
actor.hp += ((0.005*actor.spi)*actor.maxhp).to_i
actor.mp += ((0.005*actor.spi)*actor.maxhp).to_i
end
}
end
end
Good stuff.
I'm glad you have resolved your problem.
Also, yeah, one of the fun things about scripting is that small changes make a big difference. Producing scenes and graphical effects will usually require more than is shown there, but in terms of what actually happens, usually very little does a lot.