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 🙂
MP Recovery Item in Victor Engine MP Level Plugin
Javascript/Plugin SupportBump
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.
* ------------------------------------------------------------------------------
* 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.
@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:
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.
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.
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.
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.
@Engr. Adiktuzmiko This is the exact notetag I'm using on the item:
This happens both in battle test and in-game battle. It also happens outside of battle when I use the item from the menu.
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.
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.
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.
Is this right?
Ooh thanks, I get it now (I think).. Basing from that log, the error happens at this line
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:
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
Just curious too, did you install Victor's Core plugin in your game too?
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?
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?
Is there any idea to work around this?
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 🙂
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 🙂
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.
And, yes, I used the Victor's Core Plugin.
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
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
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.
@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.
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.
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
And put this before the first line
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.
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.
Got this error after I put the line in the script:
This is how I put it though. Is it right?
This is how I put it though. Is it right?
No you put it before this._mpLevel xD
Ah, I'm sorry :oswt:
Still get an error though, unfortunately 🙁 This happens when I used the item.
Still get an error though, unfortunately 🙁 This happens when I used the item.
Silly me, it should be console not Console hahahahahaha
Original thread: https://forums.rpgmakerweb.com/threads/mp-recovery-item-in-victor-engine-mp-level-plugin.105467/