Page 1 of 1

Actor equipitem not applying armor enchantments

PostPosted: Wed Jun 20, 2012 3:37 am
by Klaire
Hi all,


As part of a magic effect, I am equipping the target with a number of items (present in the target's inventory) with a while loop calling equpitem. While testing with my player char, I noticed that the enchantments from the items are not being applied to the player. Unequipping and re-equipping the same items again manually (via the inventory screen) causes the enchantment effects to become active again.

Is this a bug, or am I doing something wrong?

Any help appreciated.

Actor equipitem not applying armor enchantments

PostPosted: Tue Jun 19, 2012 10:08 pm
by Anthony Rand
Anyone, please? Am I doing something really stupid?

Actor equipitem not applying armor enchantments

PostPosted: Wed Jun 20, 2012 4:51 am
by steve brewin
I suppose I shouldn't expect much after eight days but here's hoping... could anyone possibly have an idea why this doesn't work?

Actor equipitem not applying armor enchantments

PostPosted: Wed Jun 20, 2012 5:07 am
by Joanne Crump
while loops and any script that involves OnEquip or OnUnequip will break if you use favorites menu. its a skyrim bug. there are even vanilla weapons that break because of this.

Actor equipitem not applying armor enchantments

PostPosted: Tue Jun 19, 2012 11:00 pm
by Dona BlackHeart
On a related topic...is there a way to go through an actor or chest's inventory and do something to each item? Like check to see if it's in a formlist and dropping it if it is?

Actor equipitem not applying armor enchantments

PostPosted: Wed Jun 20, 2012 5:01 am
by Je suis
On a related topic...is there a way to go through an actor or chest's inventory and do something to each item? Like check to see if it's in a formlist and dropping it if it is?
You can't loop through the inventories, and I was gonna say no until you mentioned the formlist :)

Use your formlist with GetItemCount() and RemoveItem(). Not dropping but setting a destination container.

Actor equipitem not applying armor enchantments

PostPosted: Wed Jun 20, 2012 5:38 am
by Anthony Diaz
So if you wanted to force an NPC to wear any clothes they have (Like in the "Knocking an NPC out" thread we saw earlier) you could make a formlist with all available clothing/equipment in it, and on GetItemCount() >= 1 call NPC.EquipItem on the item from the list?

Actor equipitem not applying armor enchantments

PostPosted: Wed Jun 20, 2012 8:38 am
by OnlyDumazzapplyhere
while loops and any script that involves OnEquip or OnUnequip will break if you use favorites menu. its a skyrim bug. there are even vanilla weapons that break because of this.

Thanks for this, though I'm a little confused - I'm not using the favourites menu in this case AFAIK. Is it simply a matter of multiple equipitem calls within the same event block causing a skip of the equip events? Or is it specifically an issue with favourited objects?

Actor equipitem not applying armor enchantments

PostPosted: Wed Jun 20, 2012 3:17 am
by Tikarma Vodicka-McPherson
So if you wanted to force an NPC to wear any clothes they have (Like in the "Knocking an NPC out" thread we saw earlier) you could make a formlist with all available clothing/equipment in it, and on GetItemCount() >= 1 call NPC.EquipItem on the item from the list?
Yep, you'll know there's at least one item in the formlist that they possess, so you could then loop the formlist and do a GetitemCount on each one to find an item.
(I hadn't seen the "Knocking an NPC out" thread, found it now though.)

@sirtaj,
You'll get a better response to coding threads if you let people see the code. As willing as people are to help, it's hard to spot a bug in a description of what you think the code does.
See http://www.gamesas.com/topic/1347469-how-to-ask-for-scripting-help/

Actor equipitem not applying armor enchantments

PostPosted: Wed Jun 20, 2012 12:47 am
by Pants
Sorry, you're perfectly right, I should have done that earlier. This is the magic effect that removes the current equipment on cast and re-equips on end. (I doubt it's relevant, but the caster and target are the same - this is usually cast as a result of a proximity trigger):

Scriptname zsEquipmentEffectScript extends activemagiceffectForm[] equippedItemsint numEquippedItemsEvent OnEffectStart(Actor akTarget, Actor akCaster)equippedItems = new Form[100]akTarget.unequipAll()EndEventEvent OnEffectFinish(Actor akTarget, Actor akCaster)int equipIdx = 0while (equipIdx < numEquippedItems)  if (equippedItems[equipIdx] != NONE)   akTarget.equipItem(equippedItems[equipIdx], false, true)   equippedItems[equipIdx] = NONE  endif  equipIdx += 1endWhilenumEquippedItems = 0EndEventEvent OnObjectUnequipped(Form akBaseObject, ObjectReference akReference)equippedItems[numEquippedItems] = akBaseObjectnumEquippedItems += 1EndEvent

The current result: unequip and requip take place, but enchantment effects of the equipment are not applied to the PC on re-equip. Manually re-equipping the same objects via the inventory screen causes the enchantments to become active again.

Actor equipitem not applying armor enchantments

PostPosted: Wed Jun 20, 2012 1:18 am
by Dylan Markese
I can't see any reason why that shouldn't work.

Are the items you're testing http://www.gamesas.com/topic/1360690-major-bug-with-equipitem-and-custom-enchanted-items/ too?

Actor equipitem not applying armor enchantments

PostPosted: Wed Jun 20, 2012 11:39 am
by Jessica Phoenix
I have this problem as well and seems that it only affects custom enchanted items. Both papyrus and console version of EquipItem functions are bugged. I want fix please Bethesda!

Actor equipitem not applying armor enchantments

PostPosted: Wed Jun 20, 2012 6:37 am
by keri seymour
Yes, as it happens I've been testing this with user-enchanted equipment, so that's probably the issue. Thanks for reviewing my code.


(I suppose this isn't the best place to grumble again about a lack of a proper bug tracker for the CK and the game, but WTH)