Talk:SetEnchantment

Revision as of 03:05, 30 September 2011 by imported>Lanceor

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)

On the first, thanks, that's good (frustrating) to know. A fair few things work that way, but I didn't realize this was one. Do weapons update immediately? Seem like they would (which helps because you can't un/re-equip weapons as easily due to sheathing/unsheathing issues).
On the second, that's actually because of how this function works. It changes the base object, rather than an individual instance. A lot of OBSE functions do that. The thing is, vanilla Oblivion functions never did that, and so Bethesda doesn't have Oblivion save those things. However, if a form is a part of the savefile anyway (a so-called dynamic form, such as player-made potions and enchantments, or more usefully, things made with CloneForm), then the changes do save. So the answer to the second issue is to use CloneForm before making those changes (which is usually a good idea anyway, to avoid changing every instance of the object).
That issue is known, but it's a difficult thing to teach people on the Wiki because it applies to so many functions; it's hard to say where that info should go...
Dragoon Wraith TALK 13:11, 29 September 2011 (EDT)
I did further testing using custom items with obvious effects: a sword that alternates between fire and shock damage and a helmet that alternates between fortify speed and drain speed. A quest script toggles the enchantments every 10 seconds. Here's what I found:
  • Armour enchantments won't update until reequipped. The magic effects page in the journal is correct.
  • Weapon enchantments will update instantly. However, the enchantment shader (e.g. the orange edge glow for fire damage) will remain whatever it was when it was equipped.
  • This might be an easy way to give weapons any enchantment shader desired, simply by specifying a default enchantment with the desired shader, then updating it to the enchantment that you really want.
I've updated the main page to reflect these findings. :)
Lanceor 04:05, 30 September 2011 (EDT)
Return to "SetEnchantment" page.