Creating a "laced" item.

Hello! I was wondering if there was some way to script or create a consumable item that, when used, can "lace" a weapon to have a one time application of a state like Poison when attacking with the laced weapon. After attacking once, the weapon returns to normal. What would be the easiest way to go about creating something like this?
You can do this pretty simply with Yanfly's BuffStatesCore plugin.
Put this into a state, and have the lace item apply it.
Spoiler: Code
Code:
<Custom Apply Effect>
//Sets the number of times the weapon will "lace" the effect
user._timesToApply = 1;
//If you have this state show its remaining turns, will show how many times the state can "lace" a status
user.setStateCounter(stateId, user._timesToApply);
</Custom Apply Effect>
<Custom Confirm Effect>
//Checks if a physical attack
if(this.isPhysical()){
//Adds the state(in this case, poison) and subtracts 1 from the lace ammount
target.addState(4);
user._timesToApply -= 1;
user.setStateCounter(stateId, user._timesToApply);
//removes the state if lace amount has been used up
if(user._timesToApply == 0)
user.removeState(stateId);
}
</Custom Confirm Effect>
This is easy to do without scripting or plugins, I believe. Here's the breakdown:

You want to create a state (call it 'Poisoned Weapon' or w/e). In Traits, go to the Attack tab, and select Poison from the Attack State dropdown (and if desired, and your game has a poison element, also the Attack Element dropdown). Make your state last only 1-2 turns (this is dependent on what battle system you're using as once you get into some common advanced options like atb/ctb etc. you really need to have a feel for what a "turn" really is in your battle system. So set it to however many turns it will take the poisoner to make one attack. This is the only "kludgy" part since it's an approximation. If it were me, I'd add "Remove By Damage" at some percent between 50% and 100% too, since it seems to me that getting hit while you're holding a poisoned shortsword should have a good chance of ruining the coat of poison on that shortsword, but this part's completely optional.

Then, you simply make an item with a scope of User so that the character can cast the "Poisoned Weapon" state on herself. (It may be desirable to use the Required Weapon dropdowns, if you want to be able to apply poison to a dagger or a kukri, but not to a claymore or a greatclub, but this can only be done using skills, not items.)

EDIT: @rainyday's post is a more elegant way of doing it but I like to teach people how to do things w/o necessarily resulting to plugins or JavaScript so they get a better understanding of what the default functionality can achieve. Here are some screenshots from where I happen to have done exactly this in my own game, and I'll point out how the magic of Yanfly helped in all the places it did.

Here is the basic state, which is not as elegant as Rainyday's YF based scriptlet, but gets the job done:
Poison Weapon.jpg

Here is the skill that applies the poison. Note that it cost an item to use, a functionality allowed by Yanfly's SkillCostItems plugin.

skillcostitem.jpg

So, you see there that the poison can only be applied by a character with access to the Physick skill type, and they must have a dagger or crossbow equipped and the poison in their inventory to poison their weapon.

poisonsynthesis.jpg

Lastly, this shows how a Physicker ("Doktor") can use his Mix skill to synthesize the poison needed to use the skill from different ingredients (in this case, Distilled Alcohol, Aqua Tofani, and Hemlock). This is thanks to Yanfly's ItemSynthesis script. Note that the Curare item this produces can't be used by just anyone--it is not in fact a usable item, as it has no scope and no occasion--it needs to be used as "ammo" by a physicker with the Poison Tip skill.

My poison is essentially based on this nasty nasty stuff (which you absolutely cannot remotely make from the ingredients I listed) which is why it inflicts paralysis as well as DoT.

Original thread: https://forums.rpgmakerweb.com/threads/creating-a-laced-item.117237/