MZ Why does my MP recover while I'm walking?

Hello,

I am currently using two scripts to recover my characters' MP after a battle is over.

One is: https://github.com/Aesica/RMMZ/blob/master/AES_MZ_CustomMP.js from @Aesica
And the other one is: https://github.com/Trivel/RMMV/blob/master/MrTS_RestoreHpMpTp.js

What I have in the notetag:

<Passive State: 31> This is for VS Skills States.
<After Battle Recover MP: -actor.mp> This is for AES. It sets the MP to 0.
<RestoreAfterBattleMPPercent: 0.80> This is for Trivel. It recovers 80% of max MP.

Here's how the state looks like:

aaxz.jpg


The goal is to make sure that the characters start every battle with 80% of their full MP. For example: A has 10 MP maximum. He'll enter a battle with 8 MP.
For some reason, if I walk for approximately 10 steps or so, all the characters' MP will slowly recover. I check this by opening the menu every few seconds as I walk around. If I just leave the characters still, their MP won't recover. And no, opening the menu repeatedly doesn't recover their MP, either. I have no traits on any of the characters that can recover their MP, especially just by walking. Is this some kind of bug?
29


Thanks in advance for any help!
Do you need 2 scripts to recover mp?
If you remove those 2, do they still recover MP?
Do you need 2 scripts to recover mp?
If you remove those 2, do they still recover MP?

The problem is the way they work. They recover X amount of MP out of the maximum, plus the current amount of MP the character has. So I need two scrips/plugins; one to set the MP to 0, and one to recover it back to 80%.

If I remove AES, then they still recover MP by walking. Disabling Trivel didn't change anything. So the problem lies in AES's plugin. At least, that's what it seems like for now.

@Aesica Can you help?
Game Actor -> steps for turn.

or something like that.
it triggers on the map when you walk, to trigger a turn reset as if it was a battle scene.
that reset triggers the regeneration as if it was a battle turn.
it's a standard function of game actor..... look for it, it should be there.
Game Actor -> steps for turn.

or something like that.
it triggers on the map when you walk, to trigger a turn reset as if it was a battle scene.
that reset triggers the regeneration as if it was a battle turn.
it's a standard function of game actor..... look for it, it should be there.

Can you direct me to where to look for this, please?
Code:
Game_Actor.prototype.stepsForTurn = function() {
    return 20;
};

Game_Actor.prototype.turnEndOnMap = function() {
    if ($gameParty.steps() % this.stepsForTurn() === 0) {
        this.onTurnEnd();
        if (this.result().hpDamage > 0) {
            this.performMapDamage();
        }
    }
};

within rpg_objects.
backtrack from there, it should lead you to a Scene_Map call, and a Scene_Battle or BattleManager function.
the map scene is tied to the battle, through the walking distance, to trigger an end turn.
that's the premise.
Moved to: Plugin Support
Passive states don't end. So it doesn't end after the battle.
I'd probably do this by calling an event.
@gstv87 Thanks. So, am I supposed to change the 20 to 0?

Game_Actor.prototype.stepsForTurn = function() {
return 20; change to 0?
};

Game_Actor.prototype.turnEndOnMap = function() {
if ($gameParty.steps() % this.stepsForTurn() === 0) {
this.onTurnEnd();
if (this.result().hpDamage > 0) {
this.performMapDamage();
}
}
};

Also, is it okay to change this in the core script? Or am I supposed to save this part as new plugin? Was told to not change anything in the base files...
IDK.... you change it to whatever you need.
I'm just telling you that's the thing to look at, not your original plugin.

if the plugin taps into that, modify that instead.
As a suggestion, you don't need those plugins as visustella already allows you to do what you are looking for.

http://www.yanfly.moe/wiki/Battle_Core_VisuStella_MZ#Mechanics_Settings has auto common events before and after battle battle which you can set party mp to 80% or 0%.

As far as regen you can set traits to actors with http://www.yanfly.moe/wiki/Elements_and_Status_Menu_Core_VisuStella_MZ#Trait_Set_Types

Also passive states which you already use.. theres a setting called actor only passive which automatically sets a passive to all actors.
Thanks! I changed it to 0 and looks like everything is fine now.

http://www.yanfly.moe/wiki/Battle_Core_VisuStella_MZ#Mechanics_Settings has auto common events before and after battle battle which you can set party mp to 80% or 0%.

As far as regen you can set traits to actors with http://www.yanfly.moe/wiki/Elements_and_Status_Menu_Core_VisuStella_MZ#Trait_Set_Types

I think the first one requires me to tinker with some variables. Can't just set the MP to recover to X percent. That's a somewhat a bigger headache for me since I suck at using complicated variable settings...

Second one, I haven't touched anything since I didn't think I'd need all those settings. XD
The problem is the way they work. They recover X amount of MP out of the maximum, plus the current amount of MP the character has. So I need two scrips/plugins; one to set the MP to 0, and one to recover it back to 80%.

If I remove AES, then they still recover MP by walking. Disabling Trivel didn't change anything. So the problem lies in AES's plugin. At least, that's what it seems like for now.

@Aesica Can you help?
Okay I'll admit I didn't set it up in as user-friendly of a way as I probably should've. Earlier plugin, rookie mistake, all that. Anyway, you can sort of hack it so that it sets the MP to a certain value after each battle like so:

Code:
<After Battle Recover MP: actor._mp = Math.floor(actor.mmp * 0.8); actor.refresh(); 0>

I've been very lazily touching up some of my older MV plugins (MessageExt especially, but others too) and will probably do something about that so that it's easier to do.
@Aesica Thanks! That works like a charm!
Ah, so in the end, it actually wasn't your plugin to blame, either. =w=
@Aesica Bad news. I just discovered that the characters' MP doesn't recover if I choose to escape from the battle. Are you able to fix this?
@Aesica Bad news. I just discovered that the characters' MP doesn't recover if I choose to escape from the battle. Are you able to fix this?
That's odd, it should (and it was unintended since one could just fight/flee/fight/flee to recover mp from 0 to full in certain situations). Post your note tags?
@Aesica Exactly the same as what you posted.

<After Battle Recover MP: actor._mp = Math.floor(actor.mmp * 0.8); actor.refresh(); 0>
It must be a plugin conflict or something because I just tested it out and it works fine on my end:

Spoiler: Image
1642967069978.png
Harold and Lucius's MP refilled as expected, and Lucius in particular has a similar formula as what you're using.
@Aesica I don't know what the cause is, but it's also not plugin conflict, either. I tested this in a new project, with only this plugin on, and still have the same issue. MP will stay the same if I escape.
Do you have an older version of the plugin? I really should get the updated versions posted sometime, but I've been spending most of my RM hours on MZ stuff lately.

Original thread: https://forums.rpgmakerweb.com/threads/why-does-my-mp-recover-while-im-walking.143289/