MP Recovery Item in Victor Engine MP Level Plugin

Discussion in 'Javascript/Plugin Support' started by curioushika, Feb 10, 2019.

  1. curioushika

    curioushika Veteran Veteran

    Messages:
    61
    Likes Received:
    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 :)
     
    #1
  2. curioushika

    curioushika Veteran Veteran

    Messages:
    61
    Likes Received:
    9
    First Language:
    Not-English
    Primarily Uses:
    RMMV
    Bump
     
    #2
  3. Engr. Adiktuzmiko

    Engr. Adiktuzmiko Chemical Engineer, Game Developer, Using BlinkBoy' Veteran

    Messages:
    14,466
    Likes Received:
    2,860
    Location:
    Philippines
    First Language:
    Tagalog
    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: Feb 19, 2019
    #3
  4. curioushika

    curioushika Veteran Veteran

    Messages:
    61
    Likes Received:
    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:
    [​IMG]

    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.
     
    #4
  5. Engr. Adiktuzmiko

    Engr. Adiktuzmiko Chemical Engineer, Game Developer, Using BlinkBoy' Veteran

    Messages:
    14,466
    Likes Received:
    2,860
    Location:
    Philippines
    First Language:
    Tagalog
    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.
     
    #5
  6. curioushika

    curioushika Veteran Veteran

    Messages:
    61
    Likes Received:
    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.
     
    #6
  7. Engr. Adiktuzmiko

    Engr. Adiktuzmiko Chemical Engineer, Game Developer, Using BlinkBoy' Veteran

    Messages:
    14,466
    Likes Received:
    2,860
    Location:
    Philippines
    First Language:
    Tagalog
    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.
     
    #7
  8. curioushika

    curioushika Veteran Veteran

    Messages:
    61
    Likes Received:
    9
    First Language:
    Not-English
    Primarily Uses:
    RMMV
    [​IMG]

    Is this right?
     
    #8
    Engr. Adiktuzmiko likes this.
  9. Engr. Adiktuzmiko

    Engr. Adiktuzmiko Chemical Engineer, Game Developer, Using BlinkBoy' Veteran

    Messages:
    14,466
    Likes Received:
    2,860
    Location:
    Philippines
    First Language:
    Tagalog
    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: Feb 20, 2019
    #9
    curioushika likes this.
  10. curioushika

    curioushika Veteran Veteran

    Messages:
    61
    Likes Received:
    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:
    [​IMG]

    Is there any idea to work around this?
     
    #10
    Engr. Adiktuzmiko likes this.
  11. Engr. Adiktuzmiko

    Engr. Adiktuzmiko Chemical Engineer, Game Developer, Using BlinkBoy' Veteran

    Messages:
    14,466
    Likes Received:
    2,860
    Location:
    Philippines
    First Language:
    Tagalog
    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 :)
     
    #11
  12. curioushika

    curioushika Veteran Veteran

    Messages:
    61
    Likes Received:
    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.
     
    #12
    Engr. Adiktuzmiko likes this.
  13. Engr. Adiktuzmiko

    Engr. Adiktuzmiko Chemical Engineer, Game Developer, Using BlinkBoy' Veteran

    Messages:
    14,466
    Likes Received:
    2,860
    Location:
    Philippines
    First Language:
    Tagalog
    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: Feb 20, 2019
    #13
    curioushika likes this.
  14. curioushika

    curioushika Veteran Veteran

    Messages:
    61
    Likes Received:
    9
    First Language:
    Not-English
    Primarily Uses:
    RMMV
    [​IMG]

    Here's the current code

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

    [​IMG]

    The MP value became "NaN" or something instead of a number.
     
    #14
  15. curioushika

    curioushika Veteran Veteran

    Messages:
    61
    Likes Received:
    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.
     
    #15
  16. Engr. Adiktuzmiko

    Engr. Adiktuzmiko Chemical Engineer, Game Developer, Using BlinkBoy' Veteran

    Messages:
    14,466
    Likes Received:
    2,860
    Location:
    Philippines
    First Language:
    Tagalog
    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: Feb 27, 2019
    #16
    curioushika likes this.
  17. curioushika

    curioushika Veteran Veteran

    Messages:
    61
    Likes Received:
    9
    First Language:
    Not-English
    Primarily Uses:
    RMMV
    Got this error after I put the line in the script:

    [​IMG]

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

    [​IMG]
     
    #17
  18. Engr. Adiktuzmiko

    Engr. Adiktuzmiko Chemical Engineer, Game Developer, Using BlinkBoy' Veteran

    Messages:
    14,466
    Likes Received:
    2,860
    Location:
    Philippines
    First Language:
    Tagalog
    No you put it before this._mpLevel xD
     
    #18
  19. curioushika

    curioushika Veteran Veteran

    Messages:
    61
    Likes Received:
    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.

    [​IMG]
     
    #19
  20. Engr. Adiktuzmiko

    Engr. Adiktuzmiko Chemical Engineer, Game Developer, Using BlinkBoy' Veteran

    Messages:
    14,466
    Likes Received:
    2,860
    Location:
    Philippines
    First Language:
    Tagalog
    Silly me, it should be console not Console hahahahahaha
     
    #20

Share This Page