Help with Yanfly's Attachable Augments (States and Element script calls)

Hi! I have a question that might be a little difficult... I'm using Yanfly's Attachable Augments script and I got inspired by his duplicity augments tips and tricks. I'm wondering if I can do this idea with states and elements.

Here's what would happen:

attach Fire Orb on a weapon: add Fire as an attack element
attach Fire Orb on an armor: Become immune to Fire damage

Or:

attach Poison Orb on a weapon: add Poison as an attack state (50% chance or something)
attach Poison Orb on an armor: Become immune to Poison state

I know I can use Yanfly's note tags to do these things but not with the duplicity augments way. I really like the offense or defense choice it makes the player make. This is what I've tried so far and of course, it failed:

Element:

<Augment Attach Eval: Orb>
if (DataManager.isWeapon(item)) {
item.attackElements(2);
} else {
item.ElementRate(2) -= 1;
}
</Augment Attach Eval: Orb>

<Augment Detach Eval: Rune>
if (DataManager.isWeapon(item)) {
item.attackElements(2).remove;
} else {
item.ElementRate(2) += 1;
}
</Augment Detach Eval: Rune>

State:

<Augment Attach Eval: Orb>
if (DataManager.isWeapon(item)) {
item.attackStatesRate(4) += 0.5;
} else {
item.stateRate(4) -= 1;
}
</Augment Attach Eval: Rune>

<Augment Detach Eval: Orb>
if (DataManager.isWeapon(item)) {
item.attackStatesRate(4) -= 0.5;
} else {
item.stateRate(4) += 1;
}
</Augment Detach Eval: Rune>

Is my idea even possible? Anyone know how to do this? Thanks for any help!!!
The first problem I see is that you're mixing and matching your terms. You're using the Orb and Rune terms as if they're interchangeable, but for this to work, you need to use either all Orb or all Rune, depending on your augment item. Start by fixing that, and see what happens then.
I fixed that and it still doesn't work. Thanks for catching that though!
Wow, I was literally about to make a thread on just this topic. I hope you can get some assistance on this, I've tried and failed as well. It seems such a natural usage of the plugin and less clunky than making separate categories of augments for weapons and armour.
Maybe try these...I have no idea but it's worth a try.

Element:

<Augment Attach Eval: Orb>
if (DataManager.isWeapon(item)) {
item.attackElement(2);
} else {
item.ElementRate(2) -= 1;
}
</Augment Attach Eval: Orb>

<Augment Detach Eval: Orb>
if (DataManager.isWeapon(item)) {
item.attackElement(2).remove;
} else {
item.ElementRate(2) += 1;
}
</Augment Detach Eval: Orb>

State:

<Augment Attach Eval: Orb>
if (DataManager.isWeapon(item)) {
item.attackStateRate(4) += 0.5;
} else {
item.stateRate(4) -= 1;
}
</Augment Attach Eval: Orb>

<Augment Detach Eval: Orb>
if (DataManager.isWeapon(item)) {
item.attackStateRate(4) -= 0.5;
} else {
item.stateRate(4) += 1;
}
</Augment Detach Eval: Orb>

I mainly just made sure the Evals matched to Orb (which I know you said you tried but just to have that part be correct, I then got rid of the plurals in your item.attackStatesRate and attackElementsRate. I'm probably wrong but for some reason I don't think it's supposed to be plural. If it doesn't work I too would like to know how to do it.
I don't think it worked for me 🙁. It seems like it should be a simple if/else statement. Hopefully someone can crack it, it would be a really handy option.
This is gonna annoy me if I can't figure it out. I think that we need to look at the code directly and see if we can determine where and how the equipment is handled, because that's the part we need.

Edit: I think I have something. Try this:

Element:

<Augment Attach Eval: Orb>
var text = '';
if (DataManager.isWeapon(item)) {
text += '2';
ItemManager.applyAugmentAttackElement(item, text, true);
} else {
text += '2, 50%';
ItemManager.applyAugmentElement(item, text, true);
}
</Augment Attach Eval: Orb>

<Augment Detach Eval: Orb>
var text = '';
if (DataManager.isWeapon(item)) {
text += '2';
ItemManager.applyAugmentAttackElement(item, text, false);
} else {
text += '2, 50%';
ItemManager.applyAugmentElement(item, text, false);
}
</Augment Detach Eval: Orb>

State:

<Augment Attach Eval: Orb>
var text = '';
if (DataManager.isWeapon(item)) {
text += '4, 50%';
ItemManager.applyAugmentAttackState(item, text, true);
} else {
text += '4';
ItemManager.applyAugmentStateResist(item, text, true);
}
</Augment Attach Eval: Orb>

<Augment Detach Eval: Orb>
var text = '';
if (DataManager.isWeapon(item)) {
text += '4, 50%';
ItemManager.applyAugmentAttackState(item, text, false);
} else {
text += '4';
ItemManager.applyAugmentStateResist(item, text, false);
}
</Augment Detach Eval: Orb>

Some of the text numbers may need changed for your purposes, but try that and see if it works.
As far as I can tell, they both work well. Haven't tested every situation so I'll wait for others to confirm. Thanks a lot!
Can confirm. Tested Shockra's code, seems to check out. Thank you Shockra.
I tested it too. Looks like it all works. Thanks a bunch Shockra! This is great.

Original thread: https://forums.rpgmakerweb.com/threads/help-with-yanflys-attachable-augments-states-and-element-script-calls.76608/