I want to run a script on a weapon, where each time I attack there's a small chance of the weapon being dropped. Any idea how this could be done?
Just posted this in another thread too, so here goes:
You can do this by adding an enchantment with a script attatched to it to your weapon, example:
1) Make a new weapon myweapon
2) Make a new enchantment myenchantment
3) Make a new magic-effect myeffect
4) Set the myeffect's settings/variables to:
casting type: fire and forgetdelivery: contactand if you want it to have no cost, base cost: 0
5) Add a papyrus script to your effect modeled after this:
Scriptname myscript extends ActiveMagicEffect{mydescription}Event OnEffectStart(Actor akTarget, Actor akCaster)if akCaster == Game.GetPlayer() Debug.MessageBox("We hit them")EndIfEndEvent6) Add myeffect to myenchantment, then myenchantment to myweapon
The current script will just create a little window in-game whenever the player hits someone with the weapon saying "we hit them"