Need help with an error

Discussion in 'RPG Maker MV' started by Animebryan, May 24, 2019.

  1. Animebryan

    Animebryan Feels like I'm slowly dying! Veteran

    Messages:
    328
    Likes Received:
    150
    Location:
    Marysville, CA
    First Language:
    English
    Primarily Uses:
    RMMV
    After creating a new skill to test out a TP draining skill, my playtesting comes to a crashing halt thanks to some stupid error. At first I thought it was caused by using SRD's HUD Maker to customize my Battle HUD, so I disabled both plugins & tried again with the default layout (default for YEP Battle Core). I'm still getting the error:

    Stupid error!.png
    Don't know why the Skill Core needs to draw Actor HP but its apparently causing enough of a conniption fit to crash the game. Only does this with my new Absorb skill. God I wish this engine would stop sucking!
     
    Last edited: Jun 12, 2019
    #1
  2. Aloe Guvner

    Aloe Guvner Walrus Veteran

    Messages:
    1,521
    Likes Received:
    959
    Location:
    USA
    First Language:
    English
    Primarily Uses:
    RMMV
    1. Do you have YEP Damage Core installed?
    2. You say this happens after you execute a skill, show us that skill's damage formula
     
    #2
    caethyril likes this.
  3. Shaz

    Shaz Veteran Veteran

    Messages:
    37,358
    Likes Received:
    11,150
    Location:
    Australia
    First Language:
    English
    Primarily Uses:
    RMMV
    Is this an error that happens when you use new plugins on an old project?

    What version of MV are you using? You can find that in Help About or somewhere like that, in the menu.
    What version are your core files? You can find out by opening the project folder, going into the js subfolder, and opening the rpg_core.js file - the core file version should be on the first few lines. If there's no version shown there, it means you have 1.0.0
     
    #3
  4. Animebryan

    Animebryan Feels like I'm slowly dying! Veteran

    Messages:
    328
    Likes Received:
    150
    Location:
    Marysville, CA
    First Language:
    English
    Primarily Uses:
    RMMV
    Yeah, I have Damage Core. Here's the skill's setup:
    TP Drain Skill.png

    There's hardly any 'new' plugins as I've been using this setup for a while now. I'm using Version 1.6.1 & the rpg core js file is version 1.6.1 as well.
     
    #4
  5. Andar

    Andar Veteran Veteran

    Messages:
    28,153
    Likes Received:
    6,375
    Location:
    Germany
    First Language:
    German
    Primarily Uses:
    RMMV
    even if there is no new plugin, can you still give us a screenshot of your plugin manager with all plugins listed?
    Sometimes errors like this are caused by incompatible plugins or plugins that are in the wrong order - and sometimes such errors don't get triggered until a playthrough gets to a certain data combination that disturbs the plugins.

    EDIT:
    And please try adding an ;0 to your damage formula. The engine expects a return number to be processed as the result of any damage formula, only using javascript code without returns can cause problems, so force a zero as the last number of the damage formula.
     
    #5
  6. Animebryan

    Animebryan Feels like I'm slowly dying! Veteran

    Messages:
    328
    Likes Received:
    150
    Location:
    Marysville, CA
    First Language:
    English
    Primarily Uses:
    RMMV
    Here's the list:
    Plugin List.png
     
    #6
  7. Aloe Guvner

    Aloe Guvner Walrus Veteran

    Messages:
    1,521
    Likes Received:
    959
    Location:
    USA
    First Language:
    English
    Primarily Uses:
    RMMV
    The MV code includes a safety check against "undefined" return values in the damage formula. I've described the technical details of the issue here, if you are curious.

    To verify what I'm saying, use that exact same damage formula in a project without plugins and there will be no crash.

    The reason I asked if you had YEP Damage Core installed is that plugin for some reason removes that safety check against undefined values, I would consider that a bug/oversight in the plugin.

    Please follow the advice of Andar's edit, add a single statement "0;" to the end of the formula, and that will solve your issue.
     
    #7
  8. Animebryan

    Animebryan Feels like I'm slowly dying! Veteran

    Messages:
    328
    Likes Received:
    150
    Location:
    Marysville, CA
    First Language:
    English
    Primarily Uses:
    RMMV
    Now I have not 1 but 2 errors! (It never ends!)
    Stupid error!.png

    Also, I deleted the damage formula afterward & it didn't crash with either of these 2 errors, so the damage formula is still flawed.
    Code:
    a.gainTp(50);b.gainTp(-50) 0;
     
    #8
  9. Kes

    Kes Global Moderators Global Mod

    Messages:
    20,406
    Likes Received:
    10,415
    First Language:
    English
    Primarily Uses:
    RMVXA
    Put the semi-colon before the zero, not after.
     
    #9
  10. Andar

    Andar Veteran Veteran

    Messages:
    28,153
    Likes Received:
    6,375
    Location:
    Germany
    First Language:
    German
    Primarily Uses:
    RMMV
    that is the wrong code, @Aloe Guvner misspelled his advice.
    Like I said above you should have added ;0 and not 0;

    That is the cause for the first error - but it has nothing to do with the second one (as far as I know).
    My guess is that the second one is something different that was masked by the original type error because the computer can only report errors to the point where they break the engine.
     
    #10
    Aloe Guvner likes this.
  11. Animebryan

    Animebryan Feels like I'm slowly dying! Veteran

    Messages:
    328
    Likes Received:
    150
    Location:
    Marysville, CA
    First Language:
    English
    Primarily Uses:
    RMMV
    Yay! It finally works without crashing. Now if only I can regulate the TP drained to not take more than what the target has.
     
    #11
  12. Andar

    Andar Veteran Veteran

    Messages:
    28,153
    Likes Received:
    6,375
    Location:
    Germany
    First Language:
    German
    Primarily Uses:
    RMMV
    Code:
    r=b.tp;a.gainTP(r);b.gainTP(-r);0
    will create a temporary variable r to store the current tp value of the target. you can then use it in any code inside the damage formula, even with an if to give two different formula depending on what value it has or whatever other code you want
     
    #12
    caethyril likes this.
  13. Animebryan

    Animebryan Feels like I'm slowly dying! Veteran

    Messages:
    328
    Likes Received:
    150
    Location:
    Marysville, CA
    First Language:
    English
    Primarily Uses:
    RMMV
    So how would this work if I wanted to set it to take only x% but only up to whatever it has?
     
    #13
  14. Andar

    Andar Veteran Veteran

    Messages:
    28,153
    Likes Received:
    6,375
    Location:
    Germany
    First Language:
    German
    Primarily Uses:
    RMMV
    r=0.5*b.tp would be 50% of current TP for example
    for comparison you'll need an if structure, but I don't have the correct syntax ready as I haven't done much with javascript.

    something like
    if r<50 then drain r else drain 50
     
    #14
  15. Shaz

    Shaz Veteran Veteran

    Messages:
    37,358
    Likes Received:
    11,150
    Location:
    Australia
    First Language:
    English
    Primarily Uses:
    RMMV
    If you want to take up to 30% of TP, but less if they have less, it would be this:

    Code:
    r = Math.min(b.tp, 30); a.gainTP(r); b.gainTP(-r); 0
     
    #15
    Animebryan and Aloe Guvner like this.
  16. Animebryan

    Animebryan Feels like I'm slowly dying! Veteran

    Messages:
    328
    Likes Received:
    150
    Location:
    Marysville, CA
    First Language:
    English
    Primarily Uses:
    RMMV
    mY hAtE fOr ThIs EnGiNe Is ReAl!
    Another stupid error!.png
     
    #16
  17. Shaz

    Shaz Veteran Veteran

    Messages:
    37,358
    Likes Received:
    11,150
    Location:
    Australia
    First Language:
    English
    Primarily Uses:
    RMMV
    sorry.

    a.gainTp and b.gainTp, not .gainTP
     
    #17
    Animebryan likes this.
  18. Animebryan

    Animebryan Feels like I'm slowly dying! Veteran

    Messages:
    328
    Likes Received:
    150
    Location:
    Marysville, CA
    First Language:
    English
    Primarily Uses:
    RMMV
    OK, it works finally! Sucks that the coding is case sensitive.
     
    #18

Share This Page