Mr. Detective

NATO Special Operative
Veteran
Joined
Sep 9, 2012
Messages
1,034
Reaction score
494
First Language
English
Primarily Uses
N/A
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!
 

NaosoX

Veteran
Veteran
Joined
Feb 28, 2013
Messages
490
Reaction score
263
First Language
English
Primarily Uses
RMMZ
Do you need 2 scripts to recover mp?
If you remove those 2, do they still recover MP?
 

Mr. Detective

NATO Special Operative
Veteran
Joined
Sep 9, 2012
Messages
1,034
Reaction score
494
First Language
English
Primarily Uses
N/A
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?
 

gstv87

Veteran
Veteran
Joined
Oct 20, 2015
Messages
2,710
Reaction score
1,784
First Language
Spanish
Primarily Uses
RMVXA
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.
 

Mr. Detective

NATO Special Operative
Veteran
Joined
Sep 9, 2012
Messages
1,034
Reaction score
494
First Language
English
Primarily Uses
N/A
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?
 

gstv87

Veteran
Veteran
Joined
Oct 20, 2015
Messages
2,710
Reaction score
1,784
First Language
Spanish
Primarily Uses
RMVXA
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.
 

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
44,718
Reaction score
15,848
First Language
English
Primarily Uses
RMMV

I've moved this thread to Plugin Support. Thank you.

 

pawsplay

Veteran
Veteran
Joined
Mar 29, 2012
Messages
495
Reaction score
265
First Language
English
Primarily Uses
RMMV
Passive states don't end. So it doesn't end after the battle.
I'd probably do this by calling an event.
 

Mr. Detective

NATO Special Operative
Veteran
Joined
Sep 9, 2012
Messages
1,034
Reaction score
494
First Language
English
Primarily Uses
N/A
@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...
 

gstv87

Veteran
Veteran
Joined
Oct 20, 2015
Messages
2,710
Reaction score
1,784
First Language
Spanish
Primarily Uses
RMVXA
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.
 

NaosoX

Veteran
Veteran
Joined
Feb 28, 2013
Messages
490
Reaction score
263
First Language
English
Primarily Uses
RMMZ
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.
 

Mr. Detective

NATO Special Operative
Veteran
Joined
Sep 9, 2012
Messages
1,034
Reaction score
494
First Language
English
Primarily Uses
N/A
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
 

Aesica

undefined
Veteran
Joined
May 12, 2018
Messages
1,880
Reaction score
1,824
First Language
English
Primarily Uses
RMMV
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.
 
Last edited:

Mr. Detective

NATO Special Operative
Veteran
Joined
Sep 9, 2012
Messages
1,034
Reaction score
494
First Language
English
Primarily Uses
N/A
@Aesica Thanks! That works like a charm!
Ah, so in the end, it actually wasn't your plugin to blame, either. =w=
 

Mr. Detective

NATO Special Operative
Veteran
Joined
Sep 9, 2012
Messages
1,034
Reaction score
494
First Language
English
Primarily Uses
N/A
@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

undefined
Veteran
Joined
May 12, 2018
Messages
1,880
Reaction score
1,824
First Language
English
Primarily Uses
RMMV
@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

undefined
Veteran
Joined
May 12, 2018
Messages
1,880
Reaction score
1,824
First Language
English
Primarily Uses
RMMV
It must be a plugin conflict or something because I just tested it out and it works fine on my end:

1642967069978.png
Harold and Lucius's MP refilled as expected, and Lucius in particular has a similar formula as what you're using.
 

Mr. Detective

NATO Special Operative
Veteran
Joined
Sep 9, 2012
Messages
1,034
Reaction score
494
First Language
English
Primarily Uses
N/A
@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.
 

Aesica

undefined
Veteran
Joined
May 12, 2018
Messages
1,880
Reaction score
1,824
First Language
English
Primarily Uses
RMMV
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.
 

Latest Threads

Latest Posts

Latest Profile Posts

Remember to do even 0,01% progress on your game today! You can!
Watched a video of a kid in China leaning against a giant ceramic teletuby statue (valued at nearly $4000 apparently) in a toy store and everyone arguing whether it's the parents or the store's fault. I'm just sitting up wondering why anyone would make a giant ceramic toddler toy in the first place other than to deliberately cause exactly that from happening in the first place though.
Plans for vacation? Maybe I'll go visit
Taumatawhakatangihangakoauauotamateapokaiwhenuakitanatahu

Forum statistics

Threads
122,129
Messages
1,146,747
Members
160,419
Latest member
RealVirg
Top