RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.

RMRK.net has nothing to do with Blockchains, Cryptocurrency or NFTs. We have been around since the early 2000s, but there is a new group using the RMRK name that deals with those things. We have nothing to do with them.
NFTs are a scam, and if somebody is trying to persuade you to buy or invest in crypto/blockchain/NFT content, please turn them down and save your money. See this video for more information.
[RESOLVED]Request for HP/MP Recovery after battle

0 Members and 1 Guest are viewing this topic.

**
Rep: +0/-0Level 84
<HP/MP Recovery After Battle>
<9-18-2008>



Summary
Looking 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
  • Star Ocean



Did you search?
yes

Where did you search?
  • forums here
  • google

What did you search for?
  • hp/mp after battle
« Last Edit: September 19, 2008, 03:23:21 AM by Ghero »

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Most Mature Member2012 Favorite Staff Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Use of Avatar and Signature Space2011 Best RPG Maker User (Scripting)2011 Most Mature Member2011 Favourite Staff Member2011 Best Veteran2010 Most Mature Member2010 Favourite Staff Member
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.

Code: [Select]
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

**
Rep: +0/-0Level 84
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?
« Last Edit: September 19, 2008, 03:27:39 AM by Ghero »

**
Rep: +0/-0Level 84
Figured out the actul script!

Code: [Select]
#--------------------------------------------------------
#             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

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Most Mature Member2012 Favorite Staff Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Use of Avatar and Signature Space2011 Best RPG Maker User (Scripting)2011 Most Mature Member2011 Favourite Staff Member2011 Best Veteran2010 Most Mature Member2010 Favourite Staff Member
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.