Actor equipitem not applying armor enchantments

Post » Wed Jun 20, 2012 3:37 am

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.
User avatar
Klaire
 
Posts: 3405
Joined: Wed Sep 27, 2006 7:56 am

Post » Tue Jun 19, 2012 10:08 pm

Anyone, please? Am I doing something really stupid?
User avatar
Anthony Rand
 
Posts: 3439
Joined: Wed May 09, 2007 5:02 am

Post » Wed Jun 20, 2012 4:51 am

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?
User avatar
steve brewin
 
Posts: 3411
Joined: Thu Jun 21, 2007 7:17 am

Post » Wed Jun 20, 2012 5:07 am

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.
User avatar
Joanne Crump
 
Posts: 3457
Joined: Sat Jul 22, 2006 9:44 am

Post » Tue Jun 19, 2012 11:00 pm

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?
User avatar
Dona BlackHeart
 
Posts: 3405
Joined: Fri Dec 22, 2006 4:05 pm

Post » Wed Jun 20, 2012 5:01 am

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.
User avatar
Je suis
 
Posts: 3350
Joined: Sat Mar 17, 2007 7:44 pm

Post » Wed Jun 20, 2012 5:38 am

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?
User avatar
Anthony Diaz
 
Posts: 3474
Joined: Thu Aug 09, 2007 11:24 pm

Post » Wed Jun 20, 2012 8:38 am

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?
User avatar
OnlyDumazzapplyhere
 
Posts: 3445
Joined: Wed Jan 24, 2007 12:43 am

Post » Wed Jun 20, 2012 3:17 am

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/
User avatar
Tikarma Vodicka-McPherson
 
Posts: 3426
Joined: Fri Feb 02, 2007 9:15 am

Post » Wed Jun 20, 2012 12:47 am

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.
User avatar
Pants
 
Posts: 3440
Joined: Tue Jun 27, 2006 4:34 am

Post » Wed Jun 20, 2012 1:18 am

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?
User avatar
Dylan Markese
 
Posts: 3513
Joined: Sat Dec 01, 2007 11:58 am

Post » Wed Jun 20, 2012 11:39 am

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!
User avatar
Jessica Phoenix
 
Posts: 3420
Joined: Sat Jun 24, 2006 8:49 am

Post » Wed Jun 20, 2012 6:37 am

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)
User avatar
keri seymour
 
Posts: 3361
Joined: Thu Oct 19, 2006 4:09 am


Return to V - Skyrim