Disable HP & MP Regeneration outside battle?

Hi,

is there some way to disable the HP & MP Regeneration outside of battle - my outside battle regeneration will be handeled with a belly system (hunger system) similar to pokemon mystery dungeon, and if my actors have HPREG or MPREG it messes with the regeneration outside of battle.


cheers!
The smartass in me really wants to say "Yes, there is some way." because that is the actual question you asked, but I'll be nice.

The easiest way to do it would be to remove the call to onTurnEnd() in Game_Actor.prototype.turnEndOnMap, though that will also prevent the clearing of result, the updating of state turns, the updating of buff turns, and the auto-removal of states.

Probably the way I would go about this would be to overwrite turnEndOnMap to call clearResult(), updateStateTurns(), updateBuffTurns() and removeStateAuto(2) and remove the call to onTurnEnd(). This will make everything work exactly the same way as before but you won't regenerate while walking.
So, I found this. I am pretty noob, so to what exactly shall I change it >. < ?
Its in rpg_objects.js , thats the file I was looking for right?
7a43b399b0.png
There is another approach if you don't want to go through scripts.

Regeneration is a trait, which means there will be no regeneration if nothing gives the actors that trait outside combat.

If all regeneration is done by states, then simply make those states end when combat has ended, and don't give any HP/MP-Regen-Traits to any equipment, class or actor.

At the same time, that is the only problem where it doesn't work: if you want to have an equipment that regenerates only inside battlescreen, then you'll need a script modification because by default that would work if equipped outside battle.
There are items & equipment that give regeneration so I can't really do it, also have thought about just reducing recovery rate to 0 on maps, but its kinda counter intuitive because I am using the better status menu from ... yanfly (I think it is) and then you wouldn't be able to check your HPREG outside of battle.
Do you want me to tell you how to achieve the effect by editing the default code or do you want me to write you a small plugin to do it?
You decide whats easier, usually I am not too dumb to edit the default code, but ay - you plugin makers and your magic, maybe its easier to just create some small plugin.
Code:
//=============================================================================
// DisableMapRegen.js
//=============================================================================

/*:
 * @plugindesc Disables regeneration on maps.
 * @author John Clifford (Trihan)
 *
 * @param Disable HP regen
 * @desc Disable map regeneration for HP.
 * @default true
 *
 * @param Disable MP regen
 * @desc Disable map regeneration for MP.
 * @default true
 *
 * @param Disable TP regen
 * @desc Disable map regeneration for TP.
 * @default true
 *
 * @help
 *
 * Plug and play. Disables all regen by default, but there are parameters to allow HP, MP or TP regen separately.
 *
 * Terms of use
 * Please feel free to use this plugin for any purpose you see fit. Credit is appreciated but not necessary.
 *
 */

(function() {
    var parameters = PluginManager.parameters('DisableMapRegen');
    
    Game_Actor.prototype.turnEndOnMap = function() {
        if ($gameParty.steps() % this.stepsForTurn() === 0) {
            this.clearResult();
            this.regenerateMap();
            this.updateStateTurns();
            this.updateBuffTurns();
            this.removeStatesAuto(2);
            if (this.result().hpDamage > 0) {
                this.performMapDamage();
            }
        }
    };
    
    Game_Actor.prototype.regenerateMap = function() {
        if (this.isAlive()) {
            if (parameters['Disable HP regen'] !== "true") {
                this.regenerateHp();
            }
            if (parameters['Disable MP regen'] !== "true") {
                this.regenerateMp();
            }
            if (parameters['Disable TP regen'] !== "true") {
                this.regenerateTp();
            }
        }
    };
})();
for some reason its not disabling the regen.
I tested it putting HREG of my actor to 10% and then running around, it kicks in about every 20 steps :/
I put it on top of all plugins... maybe some other plugin is messing with it >.< but I am like 99.99% sure its not another plugin because
I tested it in a completely new project without any other plugins and the actors regenerated too.
:>
Hmm, it worked in my tests. Let me take another look.

Yeah, they definitely don't regen on my test project. I'd say you might be using a plugin that also does something with turnEndOnMap but you said it also did it in a brand new project...hmm. You didn't change any of the default parameters did you?
Spoiler: old
I didn't edit anything in the default scripts.
I tried setting the HP regen trait in different places like, actor, classes etc. and it is still regenerating.
(testing in the new empty project)
What are we doing differently 😀 hmmm~

I found the problem. 😀
7a9f78ff5c.png

It says "disable Hp regen" , so I set it to >true< to disable the hp regen.
Now that I turned it to false, its turned off... so it works! Just maybe a wording issue, but thats not huge if you know it.
Thanks soo much <3
Wait, it doesn't regen if you set it to false? That doesn't sound right...the way I coded it, it should regenerate stats if the parameter is anything but true. So you're saying when you set it to false, you DON'T regenerate?
Nvm.
Ok seems there is some other problem, as we have started discussing it in PMs already lets continue to try to fix it there. If I get it going, I will edit this post so its documented for future users looking for a way to disable on map regen.
__________
Ok "we" found the problem.
So here is what I did wrong!
I named the plugin not in the correct way.
It is supposed to be called "DisableMapRegen.js" - that was the problem. kek.

Thanks so much @Trihan !

cheers

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/disable-hp-mp-regeneration-outside-battle.75320/