MV Help with Yanfly Plugins

Hello,
I am using both http://www.yanfly.moe/wiki/Attachable_Augments_(YEP) and http://www.yanfly.moe/wiki/Item_Core_(YEP) Plugins.

My goal is pretty simple, I want to make attachable augment items have a random value, not all the same value.

Item core will allow items to have different values, but I am struggling to get the augments to have their own values.

This is what I have tried currently, I know it is wrong.


<On Creation Eval>

<Augment: Wood>

AGI: Math.floor(Math.Random() * 10);

</Augment: Wood>

</On Creation Eval>

My goal is to make it so when ever the player gets this item, the augment will give a random value. In this example its between 0 and 9. Please help. Thank you
The problem here is that note tags like these cannot be nested, as they're all read on database load when the project first opens up.

An on creation Eval is a good way to add variance to equipment or usable independent items, but it will not work with a note tag inside of it, because that note tag itself is not javascript to be run.

What you'd actually want to do is find the value this note tag is parsed to on the item, and modify it directly on the item on creation eval. Fortunately, you don't even need to go that far, as the lunatic note tags for the augment plugin include an eval one that can be used to do exactly what you're looking for.

JavaScript:
<Augment Attach Eval: Wood>
 item.params[6] += Math.round(Math.random(9)+1)
</Augment Attach Eval: Wood>

The above tag makes it so that this augment adds between 1 and 10 agi to the item it is put on.

If you also have the ability to remove augments, you'd also need to keep track of what was added by this in order to remove it correctly after:

JavaScript:
<Augment Attach Eval: Wood>
item._woodAgiAdd = Math.round(Math.random(9)+1)
item.params[6] += item._woodAgiAdd
</Augment Attach Eval: Wood>
<Augment Remove Eval: Wood>
item.params[6] -= item._woodAgiAdd
delete item._woodAgiAdd
</Augment Remove Eval: Wood>
Keep in mind this gets a bit messier if you can attach multiple copies of this item. And if you have multiple augments that can add random stats, they should all store their values in different variables on the item, so they don't overwrite each other.

Original thread: https://forums.rpgmakerweb.com/threads/help-with-yanfly-plugins.130536/