MV Need Help with YEP_AttachAugment plugin

I've looked through the forum a bit and searched for a possible answer, but nothing really helped me. I have both AttachAugments and ItemPicture from Yanfly... You can use them together to change the picture that an item uses after you attach an augment. It's a pretty cool feature and had a lot of uses.

But it also has its drawbacks. If I want to use the augment on another type of item, say instead of a sword I use it on a staff. but the image will always be of the sword regardless of what you attach it to. I could make multiple augments and just make them exclusive to the weapon/item type, but that's tedious and time consuming.

I tried using the lunatic function on it and got something like this:

<Augment Attach Eval: Armament>
if (actor.isWtypeEquipped(1)) {
item.applyAugmentSetPictureImg(item, "Force3", 0, true);
}
if (actor.isWtypeEquipped(2)) {
item.applyAugmentSetPictureImg(item, "Power1_", 0, true);
}
</Augment Attach Eval: Armament>

The problem is... this doesn't work and I can't figure out how to make it work. Thus, come to the forums and hope the gurus that are here can help me out.

Thank you
The problem is... this doesn't work and I can't figure out how to make it work.
In your notetags, what is actor? I don't see anything in the Attachable Augment documentation that says there's any actor variable inside those notetags, so the engine has no idea what that word means.

Why don't you just check the weapon type of the item? Try something like:
Code:
if (item.isWeapon() && $dataWeapons[item.itemId()].wtypeId==1)
In your notetags, what is actor? I don't see anything in the Attachable Augment documentation that says there's any actor variable inside those notetags, so the engine has no idea what that word means.

Why don't you just check the weapon type of the item? Try something like:
Code:
if (item.isWeapon() && $dataWeapons[item.itemId()].wtypeId==1)
Well, I have no doubt that the code you gave me will work for the weapon type check, but I think the rest of the code is wrong or something since it still doesn't work...
Well, I have no doubt that the code you gave me will work for the weapon type check, but I think the rest of the code is wrong or something since it still doesn't work...
I did not look up the other functions you called, I presumed you had reason to believe those were correct and had used them other places.

Why don't you do something more basic to make sure the code is actually being run?

Code:
if (item.isWeapon() && $dataWeapons[item.itemId()].wtypeId==1)
    $gameVariables.setValue(10, 1000);

Then slap an NPC event on the map that does a Show Text and says what the value of variable 10 is.
I did not look up the other functions you called, I presumed you had reason to believe those were correct and had used them other places.

Why don't you do something more basic to make sure the code is actually being run?

Code:
if (item.isWeapon() && $dataWeapons[item.itemId()].wtypeId==1)
    $gameVariables.setValue(10, 1000);

Then slap an NPC event on the map that does a Show Text and says what the value of variable 10 is.
Ok, so I tested this just like you suggested and found that it doesn't work... But I went further and tested this code:
Code:
if ($gameVariables.value(1) === 0)
    $gameVariables.setValue(1, 250)

To see if the Eval could handle an if/else conditional branch in the first place... I found out that it does handle them since this simple code worked. So, I tried this simple code with my other factors:
Code:
item.applyAugmentSetPictureImg(mainItem, text, slot, true)
I found out that this is flawed. I also found out that the Eval function will only work until it doesn't... this means that if the Eval Line works it will run the line, but as soon as it hits a bad line it can't run the entire Eval stops and doesn't continue.

So i'm thinking of doing something a little simpler for this Eval -
Code:
if ($gameVariables.value(1) === 1)
     item.applyAugmentSetPictureImg(mainItem, text, slot, true)
I'll change the variable to match the item as needed, but the problem now is the second part... This:
Code:
item.applyAugmentSetPictureImg(mainItem, text, slot, true)
Since this doesn't work at all, I don't know how to make it work since I have very limited JS experience.

Any Suggestions?
It's wrong because of item

The applyAugmentSetPictureImg() isn't a method of items, it's a method of the ItemManager.

Change it to this.applyAugmentSetPictureImg
It's wrong because of item

The applyAugmentSetPictureImg() isn't a method of items, it's a method of the ItemManager.

Change it to this.applyAugmentSetPictureImg
Ok... I think I'm getting the arguments wrong since it's still not doing what I want it to do... I put this in the Eval:
Code:
this.applyAugmentSetPictureImg(mainItem, 'Force3', slot, true)
Force3 is the name of the picture file I'm trying to change it to.

Just for reference, this is a snippet from the Augment Plugin that deals with the Change Picture, it's where I got the above code from.
Code:
if (Imported.YEP_X_ItemPictureImg) {
    // CHANGE PICTURE IMAGE: x
    if (line.match(/CHANGE PICTURE IMAGE:[ ](.*)/i)) {
      var text = String(RegExp.$1).trim();
      return this.applyAugmentSetPictureImg(mainItem, text, slot, true);
    } else if (line.match(/CANCEL PICTURE IMAGE:[ ](.*)/i)) {
      var text = String(RegExp.$1).trim();
      return this.applyAugmentSetPictureImg(mainItem, text, slot, false);
    }
I'm either not using it right, or I grabbed the wrong line.

I tried change this: this.applyAugmentSetPictureImg to this: ItemManager.applyAugmentSetPictureImg to see if that would work, but it didn't... Still at a loss.
Slot is not a word, it's the number of the slot you're augmenting.

If you don't know what that is, it looks like you should be able to use the variable slotId
Slot is not a word, it's the number of the slot you're augmenting.

If you don't know what that is, it looks like you should be able to use the variable slotId
That worked... Thank you so much for helping me!

Original thread: https://forums.rpgmakerweb.com/threads/need-help-with-yep_attachaugment-plugin.149259/