MP Recovery Item in Victor Engine MP Level Plugin

curioushika

Veteran
Veteran
Joined
Dec 14, 2017
Messages
63
Reaction score
9
First Language
Not-English
Primarily Uses
RMMV
So, I've been using Victor Engine MP Level plugin, and I'm intending to make an item that will recover a character's certain MP level (for example level 1 MP) for a specific points, but the only "recovery" command that I know from the plugin is the full recover command which fully recover all character's Level MPs. I'd really appreciate it if someone could help me with this. Thank you very much :)
 

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,004
First Language
Tagalog
Primarily Uses
RMVXA
Upon reading the plugin, there is a command listed there (in the help section) for gaining MP of a certain MP level

* ------------------------------------------------------------------------------
* GainMPLevel actor id level value
* GainMPLevel party id level value
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
* Gains an amount of MP of a specific level.
* actor : the target will be decided by the actor Id.
* party : the target will be decided by the position in party.
* id : actor id or the actor position in party.
* level : level of the MP.
* value : value gained. Can be negative.
* ------------------------------------------------------------------------------

This will allow you to recover or reduce the current MP amount of whatever MP level that you want.

You can view the plugin's help from the plugin manager for all notetags and plugin commands available since Victor actually listed them all there.
 
Last edited:

curioushika

Veteran
Veteran
Joined
Dec 14, 2017
Messages
63
Reaction score
9
First Language
Not-English
Primarily Uses
RMMV
@Engr. Adiktuzmiko Thanks for replying :) I see that plugin script worked quite well, but the problem is it's using id to target the recipient so I can't make it target a specific existing character in the party.

I tried to use this notetag command:

Code:
==============================================================================
 MP Level Gain (notetag for Skills and Items)
------------------------------------------------------------------------------
 <mp level gain: level>
  result = gain
 </mp level growth>
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
   Set a custom MP Level growth and max value.
     level : level of the MP.
     gain  : value gained. Script code. (more details bellow)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 Ex.: <mp level gain: 2>
       result = 10;
      </mp level gain>
==============================================================================

But it always crashes the game like this:


I guess it has something to do with YEP? But the other commands works fine, so I really don't know how to fix this.
 

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,004
First Language
Tagalog
Primarily Uses
RMVXA
If you know how to get your target's ID, its easy to use the plugin command. There is a command for that actually in MV but I forgot what was it, something like $gameParty._lastItemTarget.id. Anyway, I just wanna say that it is highly usable tusable to do what you want, if you know how to get IDs.

I didnt notice that notetag for items and skills as I focused on the plugin commands as thats where your question began.

Can you post the exact notetag that you are using. also does this happen on battle test on when you into battle in game?

Its a weird error though, I checked the plugin and refreshMpLevels does exist as a function.
 

curioushika

Veteran
Veteran
Joined
Dec 14, 2017
Messages
63
Reaction score
9
First Language
Not-English
Primarily Uses
RMMV
@Engr. Adiktuzmiko This is the exact notetag I'm using on the item:
Code:
<mp level gain: 1>
result = 1;
</mp level gain>

This happens both in battle test and in-game battle. It also happens outside of battle when I use the item from the menu.
 

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,004
First Language
Tagalog
Primarily Uses
RMVXA
Hmmm weird

can you go edit the plugin, find the line

Game_BattlerBase.prototype.refeshMPLevels

and then before the first thing it calls, add this

console.log("Runs")

then run your game, turn on the console and see if the message gets posted on it before the error happens

Just to make sure if its the refresh call that gets the undefined error or if its something below it.
 

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,004
First Language
Tagalog
Primarily Uses
RMVXA
Ooh thanks, I get it now (I think).. Basing from that log, the error happens at this line

Code:
mpLevel[level].now = now.clamp(0, max);

Can you try to comment the line out and see if the error is gone? Practically, put // before mpLevel

Judging from the error and the line, the problem seems to be the .clamp part (coz its the only function call in that line, and the error is "undefined is not a function"). It could be a function that existed in the old MV versions but was changed in the new ones or maybe it was something that needs external libraries.

If you did the edit and the error is gone, click this:
Edit: Upon searching, .clamp seems to be a custom function not inherent to JS whose goal is to ensure your value is between the two limits.

If that line is indeed the problem, you can try to change it into this

Code:
mpLevel[level].now = Math.min(max,Math.max(0,now));

Just curious too, did you install Victor's Core plugin in your game too?
 
Last edited:

curioushika

Veteran
Veteran
Joined
Dec 14, 2017
Messages
63
Reaction score
9
First Language
Not-English
Primarily Uses
RMMV
I disabled the line out, and while it's not crashing anymore, after I used the item, the display became glitchy like this and the MP didn't recover:


Is there any idea to work around this?
 

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,004
First Language
Tagalog
Primarily Uses
RMVXA
So that's really the error line, and yeah disabling it will probably result to no recovery and others since its the line that sets the current value of your MP.. I simply asked you to comment it out to determine if it is really the error.

See the edit I made to my post above hidden in the spoiler tag. That should do the trick.

Also read the last line/question I added there :)
 

curioushika

Veteran
Veteran
Joined
Dec 14, 2017
Messages
63
Reaction score
9
First Language
Not-English
Primarily Uses
RMMV
So, now's the crashing gone, and the glitchy text is also gone, but the MP is not recovered and stay the same. Also the item is not consumed when it's used from the menu (as if it doesn't have any effects at all)
And, yes, I used the Victor's Core Plugin.
 

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,004
First Language
Tagalog
Primarily Uses
RMVXA
Hmmm that's weird.. Is the console.log("Runs") still in your code? If it is, and it still displays the message then everything should have been running. The errors and fixes were also actually already after the MP recovery functions so they shouldn't actually have had effects on the recovery itself.

So the problem most probably lies at the MP recovery function itself, which I havent seem yet.

When its used from the menu, does it play the sound for item use or does it play the error sound? If it plays an error sound, try to put an effect on the effects tab, TP +0 or run a blank common event should make it work.

Edit:

Instead of result = 10; try using simply 10
 
Last edited:

curioushika

Veteran
Veteran
Joined
Dec 14, 2017
Messages
63
Reaction score
9
First Language
Not-English
Primarily Uses
RMMV


Here's the current code

Also this is what's happened after I used the item:



The MP value became "NaN" or something instead of a number.
 

curioushika

Veteran
Veteran
Joined
Dec 14, 2017
Messages
63
Reaction score
9
First Language
Not-English
Primarily Uses
RMMV
@Engr. Adiktuzmiko I tried only using 10 on the note tag instead of result = 10; , but it fully heals the MP instead of healing only 10 points.
Is there any idea to work around this? If not I'll just settle by making the MP-healing item scarce, but it'd nice if there's a way to work it around.
 

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,004
First Language
Tagalog
Primarily Uses
RMVXA
Hmmmm I dont know.. Its hard to check without actually being able to control your project as I can't do debug checks as much as I'd like to.

I'll see if I can recheck the plugin and look at the code where it regenerates MP and see how we can proceed with debugging

Edit:

find this line in the plugin

Code:
Game_BattlerBase.prototype.changeMpLevels = function(level, value) {
        this._mpLevelValues[level].now += value;
        this.refreshMpLevels();
    };

And put this before the first line

Code:
Console.log(value);

Then test it again and see what value gets printed upon use, also after that try to return your notetag to result = 10 and test again and see the results.
 
Last edited:

curioushika

Veteran
Veteran
Joined
Dec 14, 2017
Messages
63
Reaction score
9
First Language
Not-English
Primarily Uses
RMMV
Got this error after I put the line in the script:



This is how I put it though. Is it right?

 

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,004
First Language
Tagalog
Primarily Uses
RMVXA
No you put it before this._mpLevel xD
 

curioushika

Veteran
Veteran
Joined
Dec 14, 2017
Messages
63
Reaction score
9
First Language
Not-English
Primarily Uses
RMMV
Ah, I'm sorry :oswt:

Still get an error though, unfortunately :( This happens when I used the item.

 

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,004
First Language
Tagalog
Primarily Uses
RMVXA
Silly me, it should be console not Console hahahahahaha
 

Latest Threads

Latest Posts

Latest Profile Posts

Not sure if it's true (and I won't judge or blame anyone if it is, really), but I heard from confident sources that you guys (and girls) really really like to
How is this new year for everyone? Hope you are well. Still deep in Covid in the US. Its like a vampire and refuses to die with even more strains. I need some holy water to kill it with.
in my game, what's known as HeadSpace is combining with the real world...
oh looks like the forums updated while I wasn't looking and we can put a banner now. Neat!
Treating this as a devlog

Forum statistics

Threads
107,663
Messages
1,031,239
Members
139,788
Latest member
coyoteandghost
Top