I'm currently trying to make a spell that would cast an enchantment to my currently equipped weapon, but only lasts for a limited time (the new SKSE has a setEnchantment function now - I can mention SKSE in this forum right?). Problem is, if the weapon isn't unique the enchantment applies to EVERY identical weapon in the game. This means that if my enemy has the same sword as I do and I cast the spell, then both of our weapons will have the enchantment. So is there a way to duplicate my weapon using script? And if possible a function that removes the item once the magic effect wears off (to avoid game bloating)? The idea is to duplicate my weapon > add it to my inventory > set enchantment > equip. My script works so far, other than that particular problem.
Any help would be much appreciated!
Here's my current code.
Scriptname castEnchantment extends activemagiceffect Enchantment Property thisEnchantment Auto WEAPON Property thisWeapon Auto Enchantment Property noEnchantment Auto Event OnEffectStart(Actor ckTarget, Actor ckCaster) RegisterForUpdate(0.1) thisWeapon = Game.GetPlayer().GetEquippedWeapon() as Weapon thisWeapon.setEnchantment(thisEnchantment) Game.GetPlayer().UnequipSpell(thisSpell, 0)EndEventEvent OnUpdate() if(Game.GetPlayer().IsWeaponDrawn()) thisWeapon.setEnchantment(noEnchantment) UnregisterForUpdate() endifEndEventEvent OnEffectFinish(Actor ckTarget, Actor ckCaster) thisWeapon.setEnchantment(noEnchantment) UnregisterForUpdate()EndEvent