Yanfly's Attachable Augments problem

Discussion in 'Javascript/Plugin Support' started by JamesRyan, Jun 7, 2017.

  1. JamesRyan

    JamesRyan Game Designer Veteran

    Messages:
    588
    Likes Received:
    185
    Location:
    Vietnam
    First Language:
    Vietnamese
    Primarily Uses:
    RMMV
    I have encountered a big issue when using this plugin (Link to it: http://yanfly.moe/2016/04/15/yep-92-attachable-augments-rpg-maker-mv/). Most of things worked well until i touched these two note tags "Param: +x%" and "Param: -x%" when setting up the augment items. I'm going in detail for this:

    • First, i have a sword which only grants the user +5 ATK and a Reinforcement Gem (Augment) which can be attached to the sword to grant +50% HIT. Below is the note tags i use for my Gem:
    [​IMG]

    • And here is my character's status without Gem attached to the sword (HIT is still 95% and there is no gems attached into the sword):
    [​IMG]
    [​IMG]

    • So here i attach my Gem to my sword to see if my character gains the effect or not, and it works well (raises HIT from 95% to 145%, also add prefix "Precise" to the sword)
    [​IMG]
    [​IMG]

    • However, the problem starts from here. As you can see above, i do add note tag to decrease 50% HIT (HIT: -50%) when this gem is detached from the equipment, also delete the prefix "Precise" (Cancel Prefix: Precise). Upon detaching, the prefix disappears as intended, but my character's HIT is still 145%. This means the 50% bonus HIT still remains in the equipment without Gem.
      • It seems that the "HIT: +50%" is stuck on the attached equipment. Detaching gem from it does not remove its affection on my character. Only unequipping the equipment can solve the problem.
      • This problem does not occur when using note tag "Param: +x" (without %). But this note tag cannot add Ex-Params and Sp-Params. So i guess the "Param: +x%" has a problem (even with params like ATK, DEF, etc).
      • I did try in a fresh project, with only YEP Core Engine, Item Core, Status Menu Core & this Attachable Augments, the problem still occured.

    So i'm wondering if it is a bug caused by the plugin, or am i doing something wrong? I will be very grateful if you can help me about this.

    Edit: Another member also encountered this problem and reported to Yanfly via THIS thread. I'm sure this is truly a bug.
     
    Last edited: Jun 7, 2017
    #1
  2. shockra

    shockra Slightly Crazy Programmer Veteran

    Messages:
    403
    Likes Received:
    176
    Location:
    US
    First Language:
    English
    Primarily Uses:
    RMMV
    I'm wondering why you decided to make the attach and detach effects in separate notetags. I think this effect can be accomplished more simply if you just used <Augment: Reinforcement Gem></Augment: Reinforcement Gem>. That notetag will manage the augment when attached and detached without needing 2 separate pieces of code. That way, you won't need as much code to add and remove the effect. It might not fix your problem, but I think it's worth a shot.
     
    #2
    JamesRyan likes this.
  3. Kyo Panda

    Kyo Panda Veteran Veteran

    Messages:
    34
    Likes Received:
    24
    Location:
    Brazil
    First Language:
    Portuguese
    Primarily Uses:
    RMMV
    In the line 1312 of the plugin you will find the following:

    Code:
    rate -= 1;
    Change it to:

    Code:
    if (add) rate -= 1;
    ---

    The problem is that our favorite furball uses the same function to attach and detach augments and, to properly calculate the percentage given by the item, he reduces this value (which was multiplied by 0.01) by 1 (and don't ask me when this -0.5 turns into a +50%). But, when removing, as it's the same function, it subtracts this rate once again, making it -50%. It shouldn't be a problem for a trait that will be removed, but the delete function needs this value to stay the same to properly locate it in the traits array:

    Code:
    ItemManager.deleteTraitFromItem = function(mainItem, code, dataId, value) {
        var index = this.getMatchingTraitIndex(mainItem, code, dataId, value);
        if (index >= 0) mainItem.traits.splice(index, 1);
    };
    
    ItemManager.getMatchingTraitIndex = function(mainItem, code, dataId, value) {
      var i = mainItem.traits.length;
      while (i--) {
        var trait = mainItem.traits[i];
        if (trait.code !== code) continue;
        if (trait.dataId !== dataId) continue;
        if (trait.value !== value) continue;
        return i;
      }
      return i;
    }
    The value is the rate in the function, so it's looking for a trait that has the same code, dataId and value, but because the rate changes when it's being removed, it never finds it and fails to remove it.

    :rwink:
     
    #3
    King Gerar likes this.
  4. JamesRyan

    JamesRyan Game Designer Veteran

    Messages:
    588
    Likes Received:
    185
    Location:
    Vietnam
    First Language:
    Vietnamese
    Primarily Uses:
    RMMV
    @shockra Thanks! You are right. I was missing that part (only see Attach and Detach) :D Should have been more careful on reading :D

    @Kyo Panda I did change line 1312 to what you suggested, and it worked well (but only with both <Augments Attach: type> and <Augments Dettach: type> note tags, not work with just <Augments: type>). It is still a bit complicated to setup, but i'm used to it already :D I will use this temporary solution until Yanfly officially fixes this. Thank you very much :D

    Edited: Looks like it only works on Ex-params. There is no effect on normal params (ATK, DEF, MAT, etc) and Sp-params.
     
    Last edited: Jun 8, 2017
    #4
  5. Kyo Panda

    Kyo Panda Veteran Veteran

    Messages:
    34
    Likes Received:
    24
    Location:
    Brazil
    First Language:
    Portuguese
    Primarily Uses:
    RMMV
    Could you give us examples of the tag's templates you're using? I want to make some tests to see what is going on.
     
    #5
  6. JamesRyan

    JamesRyan Game Designer Veteran

    Messages:
    588
    Likes Received:
    185
    Location:
    Vietnam
    First Language:
    Vietnamese
    Primarily Uses:
    RMMV
    I'm still using the same note tags i wrote in my thread above, but instead of Ex-params, i used something else like Sp-param or normal params (already changed line 1312 to what you suggested).
    • For example, i want a gem that grants +50% ATK:
    Code:
    <Augment Attach: Reinforcement Gem>
    ATK: +50%
    Change Prefix: Precise
    </Augment Attach: Reinforcement Gem>
    
    <Augment Detach: Reinforcement Gem>
    ATK: -50%
    Cancel Prefix: Precise
    </Augment Detach: Reinforcement Gem>
    • Or a gem that grants +50% PHA:
    Code:
    <Augment Attach: Reinforcement Gem>
    PHA: +50%
    Change Prefix: Precise
    </Augment Attach: Reinforcement Gem>
    
    <Augment Detach: Reinforcement Gem>
    PHA -50%
    Cancel Prefix: Precise
    </Augment Detach: Reinforcement Gem>
    The same error still occurs. Bonus is applied when attaching gem into socket, but it is still there even when gem is detached.

    • Besides, your temporary solution works on Ex-params, but not with just this note tag. Looks like it needs both two note tags <Augment Attach: type> and <Augment Detach: type> to take effect.
    Code:
    <Augment: Reinforcement Gem>
    EVA: +50%
    Change Prefix: Precise
    </Augment: Reinforcement Gem>
     
    #6
  7. JamesRyan

    JamesRyan Game Designer Veteran

    Messages:
    588
    Likes Received:
    185
    Location:
    Vietnam
    First Language:
    Vietnamese
    Primarily Uses:
    RMMV
    Bump. Haven't heard and news from Yanfly.
     
    #7
  8. JamesRyan

    JamesRyan Game Designer Veteran

    Messages:
    588
    Likes Received:
    185
    Location:
    Vietnam
    First Language:
    Vietnamese
    Primarily Uses:
    RMMV
    I gotta bump this. Really need it fixed at the moment.
     
    #8
  9. Kyo Panda

    Kyo Panda Veteran Veteran

    Messages:
    34
    Likes Received:
    24
    Location:
    Brazil
    First Language:
    Portuguese
    Primarily Uses:
    RMMV
    In the same function of the rate -= 1, just a little above, search for this:

    Code:
      value = parseFloat(value * 0.01);
    And try changing for:

    Code:
      if (add) {
        value = parseFloat(value * 0.01);
      }
    Sorry, I wasn't receiving notifications for this topic. >-<"
     
    #9
  10. JamesRyan

    JamesRyan Game Designer Veteran

    Messages:
    588
    Likes Received:
    185
    Location:
    Vietnam
    First Language:
    Vietnamese
    Primarily Uses:
    RMMV
    Thanks @Kyo Panda. I changed it but it was not really working. The issue still happened with both Params (ATK to LUK) and Sp-params ;_;

    Edit: I guess i should use Add Passive State to my gems and provide bonus params there instead. Hope Yanfly will release a new update for this plugin soon. Thank you so much for helping me @Kyo Panda
     
    Last edited: Jun 24, 2017
    #10

Share This Page