Talk:SetEnchantment
Works on Arrows
It's supposed to work on arrows in 14a, but wasn't it brought up in one of the first threads that it was still broken?--Speedo 12:21, 3 April 2008 (EDT)
- Yes it was, reverted.--Haama 13:57, 3 April 2008 (EDT)
- As of v17 it works on arrows, so i think the "doensn't work" note should be removed.
Enchantment disapearance
Hello,
I use setenchantment in one of my mods and after a few quit/reload the enchantment that was on my weapon disappears. any idea how to fix that? I also have another problem the charge of the weapon enchantment is blocked. example: the charge is 1/1. I hit a creature and after the charge is still 1/1.
here is my script:
scn abukaienchspellscript
ref weapon ref clone ref script ref caster short kk
begin scripteffectstart
if player.getitemcount aaatorturedsoul > 9 && aaaokariscythecasterref.kk > 9
set caster to getself set weapon to caster.GetEquippedObject 16
if weapon == 0 || player.GetEquipped aaasoulextractor3t == 1 message "Soul injection has failed", 3 else
player.removeitem aaatorturedsoul 10 set kk to aaaokariscythecasterref.kk - 10 set aaaokariscythecasterref.kk to kk
set clone to CloneForm weapon player.removeitem weapon 1 player.additem clone 1 SetObjectCharge 1 clone SetEnchantment aaauuudaggerench clone SetWeaponReach 100000000 clone player.equipitem clone
endif
else message "I don't have enough torured souls", 3 endif
end
Tests on usage of this function
I've been (trying to) use this function extensively and noticed that there seems to be some limitations that may cause grief for modders.
- If an item is already equipped when its enchantment is changed, the new enchantment will only affect the actor after the item is unequipped and then re-equipped (according to the magic effects page in the journal).
- Changes to enchantments are not saved. Any items modified with this function will revert to their default enchantment on loading a saved game
The workaround seems to be a clunky un-equip and re-equip whenever the enchantment is changed. An object or quest script may be needed to check for a "wrong" enchantment on reloading a saved game and then force a re-equip. Lanceor 01:18, 29 September 2011 (EDT)