Recover HP after Battle

Zwei

Warper
Member
Joined
Aug 9, 2014
Messages
4
Reaction score
0
First Language
English
Primarily Uses
How to let the HP and MP recover after a battle?

And how to let TP going on after a battle?
 

Naveed

Veteran
Veteran
Joined
Nov 2, 2013
Messages
314
Reaction score
146
First Language
English
Primarily Uses
RMMV
If it's an evented encounter, you can just use the "Full Recovery" command in the first tab of the events command window (under the actors tab)

If it's a random encounter, you'll have to add the "Full Recovery" command in the troops page of the database, giving it to spawn at 'End of Battle'.
 

Kes

Veteran
Veteran
Joined
Aug 3, 2012
Messages
22,299
Reaction score
11,712
First Language
English
Primarily Uses
RMVXA
And for keeping TP that the characters have accumulated, on each actor (first tab database) in the Features section, click and select 'Other' (last tab)

Select Special Flag

From the drop down menu, select Preserve TP

You do this for every actor you want to have this feature.
 

Zwei

Warper
Member
Joined
Aug 9, 2014
Messages
4
Reaction score
0
First Language
English
Primarily Uses

Zoltor

Veteran
Veteran
Joined
Jan 18, 2014
Messages
1,550
Reaction score
211
First Language
English
Primarily Uses
To do that, have a switch turn on at the start of every battle, then make a Autorun Common Event require that switch, make the Common Event heal everyone+turn off switch.

As for TP, yea give every Actor the Preserve tp feature.
 
Last edited by a moderator:

Zwei

Warper
Member
Joined
Aug 9, 2014
Messages
4
Reaction score
0
First Language
English
Primarily Uses
To do that, have a switch turn on at the start of every battle, then make a Autorun Common Event require that switch, make the Common Event heal everyone+turn off switch.

As for TP, yea give every Actor the Preserve tp feature.
Sry but can I knw how to do step by step?
 

Wavelength

MSD Strong
Global Mod
Joined
Jul 22, 2014
Messages
5,624
Reaction score
5,104
First Language
English
Primarily Uses
RMVXA
Here's a scriplet for you to post into the Materials section of the script editor that will fully restore each party member's HP and TP after battle:

class Game_Battler < Game_BattlerBase #-------------------------------------------------------------------------- # * Processing at End of Battle #-------------------------------------------------------------------------- alias :on_battle_end_heal :on_battle_end def on_battle_end on_battle_end_heal    remove_state(death_state_id) @hp = mhp @mp = mmp end endIf you want to heal a fixed amount (like 20) instead of the battler's entire HP/MP pool, use @hp += 20 instead of @hp = mhp.

IMPORTANT: The original scriptlet I provided had a bug when party members are KOed.  They would be fully healed but the KO state would not be removed.  This has been corrected in the scriptlet above, which should now work perfectly.
 
Last edited by a moderator:

Kes

Veteran
Veteran
Joined
Aug 3, 2012
Messages
22,299
Reaction score
11,712
First Language
English
Primarily Uses
RMVXA
@Wavelength

The script says MP, not TP.  Just substitute?
 

whitesphere

Veteran
Veteran
Joined
Mar 14, 2014
Messages
1,688
Reaction score
784
First Language
English
Here's a scriplet for you to post into the Materials section of the script editor that will fully restore each party member's HP and TP after battle:

class Game_Battler < Game_BattlerBase #-------------------------------------------------------------------------- # * Processing at End of Battle #-------------------------------------------------------------------------- alias :on_battle_end_heal :on_battle_end def on_battle_end on_battle_end_heal @hp = mhp @mp = mmp end endIf you want to heal a fixed amount (like 20) instead of the battler's entire HP/MP pool, use @hp += 20 instead of @hp = mhp.
It might be more useful to do something like @hp += mhp/5 (i.e. 20%).  Unless HP doesn't grow much, healing 20 HP in late game, if your party members have 2,000 HP is basically scratch damage.

But I like this approach, since it doesn't require a new Common Event just for the healing, and doesn't require extra setup steps in each Troop.
 
Last edited by a moderator:

Zoltor

Veteran
Veteran
Joined
Jan 18, 2014
Messages
1,550
Reaction score
211
First Language
English
Primarily Uses
Sry but can I knw how to do step by step?
In the troop tab, there's a event section, , set the condition at turn 0, and trigger at Battle.

turn on a switch.

then create a autorun common event, that requires said switch to be on

Heal all party members.

With that said though, scripting is a slightly better option, However I am wondering why Wavelength is healing battlers(after the battler is dead at that? ), instead of party/Actors.
 
Last edited by a moderator:

Wavelength

MSD Strong
Global Mod
Joined
Jul 22, 2014
Messages
5,624
Reaction score
5,104
First Language
English
Primarily Uses
RMVXA
@Wavelength

The script says MP, not TP.  Just substitute?
There were two parts to the question: (1) How do I heal HP & MP after a battle and (2) How do I let TP persist between battles.  You answered part 2 perfectly (the Preserve TP After Battle option) and it doesn't require scripting.  I was answering part 1.

Or am I misunderstanding your concern?

It might be more useful to do something like @hp += mhp/5 (i.e. 20%).  Unless HP doesn't grow much, healing 20 HP in late game, if your party members have 2,000 HP is basically scratch damage.
Yeah.  I was just giving a quick example with the 20 since I think he wants a full heal - but I agree, using mhp/5 would be a more useful formula than just "20".

But I like this approach, since it doesn't require a new Common Event just for the healing, and doesn't require extra setup steps in each Troop.
Thank you :)   I do think it's the best way, since it scales to as many enemy troops as you want without requiring any additional

With that said though, scripting is a slightly better option, However I am wondering why Wavelength is healing battlers(after the battler is dead at that? ), instead of party/Actors.
The reason is because it seemed like the cleanest way to do it.  I was originally looking to iterate through each actor in the party and heal them inside the "Determine Win/Loss results" method in BattleManager, but that would require an overwrite.  I could probably do it inside Victory/Escape/Abort/Defeat processing, but that would require several aliased methods instead of one very simple one.  In theory this might be doing the same heal for Troop members, but that's irrelevant since the battle has already ended.  You don't get any bizarre behavior at the end of the Battle scene just because this extra functionality is running.

I've tested my code and it seems to work perfectly for each type of battle result.  If you lose the battle and it's not a "Continue if Game Over", you get the Game Over screen.  Otherwise, no matter what the result of battle is, your party is healed.
 

Wavelength

MSD Strong
Global Mod
Joined
Jul 22, 2014
Messages
5,624
Reaction score
5,104
First Language
English
Primarily Uses
RMVXA
For anyone who's using this scriptlet, please be sure to note that it has been updated to include the line remove_state(death_state_id) - this corrects a bug where a KOed party member would still be treated as KOed after the battle ended, because they still had State 1 applied even though their HP and MP were restored.
 

Wavelength

MSD Strong
Global Mod
Joined
Jul 22, 2014
Messages
5,624
Reaction score
5,104
First Language
English
Primarily Uses
RMVXA
I just got a "Like" in this topic so it's obviously still being looked at sometimes, so I thought it would be worth mentioning: several months ago I created this script to provide a much more comprehensive and flexible answer to this problem.  The scriptlet I posted in script 7 still works fine, but this full script allows you to control the behavior at a much finer level.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??

Forum statistics

Threads
105,865
Messages
1,017,059
Members
137,575
Latest member
akekaphol101
Top