Undefined is not a Function VE_Scripts

Discussion in 'Javascript/Plugin Support' started by shadowscale1229, Jan 21, 2018.

  1. shadowscale1229

    shadowscale1229 Villager Member

    Messages:
    17
    Likes Received:
    1
    First Language:
    English
    Primarily Uses:
    RMMV
    So, I've been trying to make a Final Fantasy 1 styled Magic system, where you only have a limited number of spells per "day", and this https://victorenginescripts.wordpress.com/rpg-maker-mv/mp-levels/ has been the closest I could find for my goal. However, the growth functions were not working, so I decided that instead of it being base on level ups, why not find a special currency around the world that can solely be spent to buy items to increase those levels. The moment I used the item in game, it crashed and game me: Type Error: Undefined is not a function.
    I get this error even if it and it's dependency mod is installed. Judging from my limited skill in JS, it looks like it's conflicting with a base script in rpg_scenes.

    I don't know what else to really say. It did this on my main game, and also on my testing game.
     

    Attached Files:

    #1
  2. Shaz

    Shaz Veteran Veteran

    Messages:
    37,307
    Likes Received:
    11,119
    Location:
    Australia
    First Language:
    English
    Primarily Uses:
    RMMV
    What "item" did you use in the game that caused it to crash? Show us how you have that set up.

    Also, did you add this plugin and then continue a game that you'd previously saved? That is a common cause of the 'undefined' errors.
     
    #2
  3. shadowscale1229

    shadowscale1229 Villager Member

    Messages:
    17
    Likes Received:
    1
    First Language:
    English
    Primarily Uses:
    RMMV
    I just started making the game, so that is the answer to your second question. As to the first question, I just made a item and used the note tags provided by the plug in to make it where it would level up my MP. Item attached.
     

    Attached Files:

    #3
  4. Llareian

    Llareian Jack of All Trades, Master of None Veteran

    Messages:
    603
    Likes Received:
    1,400
    Location:
    USA
    First Language:
    English
    Primarily Uses:
    RMMV
    It's also likely you have your plugins installed in the wrong order, or that another plugin is somehow interfering. Can we see your plugin manager?

    I've never seen anything try to call a function by Game_Actor.Game_BattlerBase before...that looks highly suspicious...but I can't see anything wrong with the plugin itself, which is why I suspect interference.
     
    #4
  5. shadowscale1229

    shadowscale1229 Villager Member

    Messages:
    17
    Likes Received:
    1
    First Language:
    English
    Primarily Uses:
    RMMV
    I made a new project file to test them, the only plug ins I have are VE_Basic module (Required) and VE_MP Levels. The screenshots I posted are from that new game project
     
    #5
  6. Llareian

    Llareian Jack of All Trades, Master of None Veteran

    Messages:
    603
    Likes Received:
    1,400
    Location:
    USA
    First Language:
    English
    Primarily Uses:
    RMMV
    Do you have VE_Basic module above VE_MP levels in your plugin list?
     
    #6
  7. shadowscale1229

    shadowscale1229 Villager Member

    Messages:
    17
    Likes Received:
    1
    First Language:
    English
    Primarily Uses:
    RMMV
    Yes. You made me doubt myself and I had to go check XD
     
    #7
  8. Shaz

    Shaz Veteran Veteran

    Messages:
    37,307
    Likes Received:
    11,119
    Location:
    Australia
    First Language:
    English
    Primarily Uses:
    RMMV
    What version of MV are you running, and what is the version of your core.js file (in the js folders, check core.js and there should be a version number on the first couple of lines - if it's not there, it means you have 1.0.0)

    Also, what is on line 459 of your VE_MPLevels.js file? The one you linked to doesn't seem it would throw that error on that line, so I'm wondering if you've made any mods or inserted/removed any lines.
     
    #8
  9. shadowscale1229

    shadowscale1229 Villager Member

    Messages:
    17
    Likes Received:
    1
    First Language:
    English
    Primarily Uses:
    RMMV
    Version 1.5.1.
    Line 459 is as follows.
    mpLevel[level].now = now.clamp(0, max);
     
    #9
  10. gstv87

    gstv87 Veteran Veteran

    Messages:
    1,706
    Likes Received:
    720
    First Language:
    Spanish
    Primarily Uses:
    RMVXA
    Game_Actor implies Game_BattlerBase.
    Game_BattlerBase is not a function of Game_Actor..... so Game_BattlerBase respect of Game_Actor, is undefined.
    that's the error.

    I believe the error comes from another script, probably a required script by VE, that rewires the original functions to VE functions.

    I can't find that particular call in ve_mplevels.js
     
    #10
  11. shadowscale1229

    shadowscale1229 Villager Member

    Messages:
    17
    Likes Received:
    1
    First Language:
    English
    Primarily Uses:
    RMMV
    I assume that means that the plug in is broken, is there a way I can fix it, the developer appears to have vanished off the face of the earth.

    EDIT: If no, I will accept my fate and just use a more DND styled spell system from Yanfly.
     
    #11
  12. Shaz

    Shaz Veteran Veteran

    Messages:
    37,307
    Likes Received:
    11,119
    Location:
    Australia
    First Language:
    English
    Primarily Uses:
    RMMV
    That was two questions. You only answered one, and the least important one.
     
    #12
  13. shadowscale1229

    shadowscale1229 Villager Member

    Messages:
    17
    Likes Received:
    1
    First Language:
    English
    Primarily Uses:
    RMMV
    Oh sorry, they both said 1.5.1, I should've specified that.
     
    #13
  14. gstv87

    gstv87 Veteran Veteran

    Messages:
    1,706
    Likes Received:
    720
    First Language:
    Spanish
    Primarily Uses:
    RMVXA
    correction:
    Code:
    mpLevel[level].now = now.clamp(0, max);
    .clamp(0, max) seems to be what's undefined, not the other thing I mentioned.
    which, is still weird, and shouldn't be written that way, but doesn't seem to be the problem the error refers to.
    if that is not a javascript instruction, then it must be a function defined in another script.
    that's why it's "undefined".
     
    #14
  15. Llareian

    Llareian Jack of All Trades, Master of None Veteran

    Messages:
    603
    Likes Received:
    1,400
    Location:
    USA
    First Language:
    English
    Primarily Uses:
    RMMV
    I'm getting errors that it cannot read property "now" of undefined; mpLevels[level] is undefined; since that's the case, attempting to run a clamp operation would indeed result in an undefined is not a function error.

    I believe this is due to Game_BattlerBase._mpLevelValues not being initialized properly; however, I'm too tired at the moment to try to figure out the solution. If no one else can solve this by tomorrow, I'll have another look at it.

    Edit: meant to say mpLevels[level] is an empty object, making mpLevels[level].now undefined
     
    Last edited: Jan 21, 2018
    #15
  16. shadowscale1229

    shadowscale1229 Villager Member

    Messages:
    17
    Likes Received:
    1
    First Language:
    English
    Primarily Uses:
    RMMV
    Gonna guess from the silence that there is nothing I can do.
     
    #16
  17. Andar

    Andar Veteran Veteran

    Messages:
    28,130
    Likes Received:
    6,372
    Location:
    Germany
    First Language:
    German
    Primarily Uses:
    RMMV
    no, it means that the experts have their own live as well and can't always answer within minutes.
    Our rules say "no bumping unless 72 hours have passed" exactly for this reason.

    Don't give up, check the state of this topic again tomorrow and the day after.
    Sometimes it takes weeks to pinpoint an error.
     
    #17
    Llareian and shadowscale1229 like this.
  18. Llareian

    Llareian Jack of All Trades, Master of None Veteran

    Messages:
    603
    Likes Received:
    1,400
    Location:
    USA
    First Language:
    English
    Primarily Uses:
    RMMV
    @Andar, thank you. Yes, my husband got his first day off in 8 days, so I chose to spend my time yesterday enjoying his presence at home and with my family, rather than tracking down bugs in plugins for free.

    @shadowscale1229 I've narrowed down the problem; the plugin is not correctly evaluating the mp level gain notetag. It's adding a string to the mp value rather than just the result as a number. Since clamp is a function of a number, not a string, it generates the "undefined is not a function" error.

    This plugin has quite a few...er..."quirks"... You MUST set up each actor's max MP level. You MUST set up each actor's MP level growth for each level. If you fail to do this, you will either end up with errors or a seemingly inexplicable 0 max MP for a given level.

    Under the heading "Victor Engine" toward the very end, just before the heading "Game_Action", you will need to change the following lines:

    The last line for VictorEngine.MPLevels.processValues4 becomes:
    Code:
    data.MPLevels[level].growth = eval(String(match[3]).trim());
    The last line for VictorEngine.MPLevels.processValues5 becomes:
    Code:
    data.MPLevels[level].gain = eval(String(match[2]).trim());
    Please let me know if there are any questions as to implementing the fix, or if for some reason it doesn't work. Please make sure you pay attention to the note I listed in bold above before reporting further issues. :)
     
    #18
  19. shadowscale1229

    shadowscale1229 Villager Member

    Messages:
    17
    Likes Received:
    1
    First Language:
    English
    Primarily Uses:
    RMMV
    First off, I'd like to apologize for being impatient, thank you for taking time to help me.
    Now, I went into VE_MPLevels and changed those lines, but now when I try to test my game, it starts up with "a is not defined". The only other thing I did was change the version number in the description to 1.00.01, to signify to myself that this was the fixed one. I've attached the console and the lines I changed.
     

    Attached Files:

    #19
  20. Shaz

    Shaz Veteran Veteran

    Messages:
    37,307
    Likes Received:
    11,119
    Location:
    Australia
    First Language:
    English
    Primarily Uses:
    RMMV
    did you start a new game?
     
    #20

Share This Page