Need help with YEP WeaponUnleash and DamageCore

Discussion in 'Javascript/Plugin Support' started by NinjaKittyProductions, Dec 21, 2018.

  1. NinjaKittyProductions

    NinjaKittyProductions Professional Murder Hobos Veteran

    Messages:
    330
    Likes Received:
    250
    First Language:
    English
    Primarily Uses:
    RMMV
    Hey gamers,
    I have run into an error when play testing one of my projects. Now, while doing a battle from the database, the problem does not happen. It only happens when playing the game.

    When going into a battle, as soon as it starts, I am met with require(...).Window.get(...).isDevToolOpen

    I will provide screenies below of what I have.

    error1.PNG

    Here is the skill in question. I used WeaponUnleash to replace the weapons attack with skill 85 - Thump 8
    error2.PNG

    Any and all help would be most appreciative. If I have not provided enough information, please let me know so I can clear it up ^_^
     
    #1
  2. Poryg

    Poryg Dark Lord of the Castle of Javascreeps Veteran

    Messages:
    3,928
    Likes Received:
    9,925
    Location:
    Czech Republic
    First Language:
    Czech
    Primarily Uses:
    RMMV
    Plugin list and order would be nice. The problem is not in the notetag from what it looks like.
     
    #2
  3. JamesRyan

    JamesRyan Game Designer Veteran

    Messages:
    589
    Likes Received:
    186
    Location:
    Vietnam
    First Language:
    Vietnamese
    Primarily Uses:
    RMMV
    You cannot use "a" and "b" in Damage Core. It should be "user" and "target" respectively. And somehow I have never successfully used "randomInt" in MV, as it always shows an error :blink:
    I think you should make some changes for your note tag.
    Code:
    <damage formula>
    if (target.def <= (Math.floor(Math.random() * 20) + 1 + user.atk)){
    value = Math.floor(Math.random() * 8) + 1 + user.atk;}
    else{
    value = 0;}
    </damage formula>
    
    Hope it works :cutesmile:
     
    #3
  4. NinjaKittyProductions

    NinjaKittyProductions Professional Murder Hobos Veteran

    Messages:
    330
    Likes Received:
    250
    First Language:
    English
    Primarily Uses:
    RMMV
    Thanks for the quick replies ^_^!

    No problem. The only ones not showing are SRD_SuperToolsEngine and SRD_HUDMaker which are at the very top.
    MT Plugin ORder.PNG

    I tried this and I am still getting the same error. Thank you for the suggestion though. I thought a and b could be used. Didn't know you had to use target and user.
     
    #4
  5. Aloe Guvner

    Aloe Guvner Walrus Veteran

    Messages:
    1,600
    Likes Received:
    1,005
    Location:
    USA
    First Language:
    English
    Primarily Uses:
    RMMV
    The "isDevTools is not a function" error can be solved by updating your plugins - more information here:
    http://yanfly.moe/2018/08/27/lots-of-plugin-updates/

    No, you can use "a" and "b" in the damage formula. Here is the function from YEP_DamageCore, using "a" and "b" is exactly the same as "user" and "target".

    Code:
    Game_Action.prototype.evalDamageFormula = function(target) {
      try {
        var item = this.item();
        var a = this.subject();
        var b = target;
        var user = this.subject();
        var subject = this.subject();
        var s = $gameSwitches._data;
        var v = $gameVariables._data;
        var sign = ([3, 4].contains(item.damage.type) ? -1 : 1);
        var value = 0;
        if (item.damage.custom) {
          eval(item.damage.formula);
          value = Math.max(value, 0) * sign;
        } else {
          value = Math.max(eval(item.damage.formula), 0) * sign;
        }
        return value;
      } catch (e) {
        if (item.damage.custom) {
          Yanfly.Util.displayError(e, item.damage.custom, 'DAMAGE FORMULA ERROR');
        } else {
          Yanfly.Util.displayError(e, item.damage.formula, 'DAMAGE FORMULA ERROR');
        }
        return 0;
      }
    };

    Your issue(s) is(are) in a notetag formula, but not the one that you showed.

    1.) The error message that says "TypeError: Cannot read property 'hp' of undefined"
    The notetag you showed doesn't say 'hp' anywhere, so the issue must be in a different formula.
    2.) The error message that says "ReferenceError: If is not defined"
    Javascript is case-sensitive, you've used "If" which it interprets to be a variable rather than "if" which is used for if-statements. The damage formula you showed doesn't have "If", so the issue is coming from a different formula
     
    #5
  6. NinjaKittyProductions

    NinjaKittyProductions Professional Murder Hobos Veteran

    Messages:
    330
    Likes Received:
    250
    First Language:
    English
    Primarily Uses:
    RMMV
    Thanks @Aloe Guvner ! I went through some of my other skills and have noticed that I have indeed used 'If' instead of 'if' with a few of the formulas. I just found it weird that it would even display the error even when a character does not even have the skill yet.

    I will do some more testing and report back if there are no more issues.
     
    #6
  7. Aloe Guvner

    Aloe Guvner Walrus Veteran

    Messages:
    1,600
    Likes Received:
    1,005
    Location:
    USA
    First Language:
    English
    Primarily Uses:
    RMMV
    Yeah, it's a bit weird, but it just depends on how the plugin author set it up. It would be nice if the error message said which skill had an error so you could try to narrow it down more easily.
     
    #7

Share This Page