Helmet added by EquipItem() does not receive OnEquipped() ev

Post » Tue Feb 19, 2013 5:46 am

EDIT: Mistake in title, should read "Helmet added by EquipItem() not receiving OnEquipped() event"

Right, first of all let me explain what I'm doing and how I have things set up.

I have two helmet's, one with an open visor and one with a closed visor. What I'm trying to achieve is the illusion of the visor opening/closing when the player draws/sheathes their weapon.

I have a script attached to both helmets that OnEquipped() adds an ability to the player, then OnUnequipped() removes said ability

The ability is just a copy of one of the vanilla abilities, with one magic effect. This magic effect has "No duration" and "No UI" checked and contains one script that basically tracks using animation events when the player draws/sheathes their weapon and switches the helmets accordingly.

It works...to a degree

In the EffectScript's OnAnimationEvent() event i do EquipItem(newHelmet) followed by RemoveItem(oldHelmet).

Now the removeItem() still sends a OnUnequipped() event to the old helmet thereby removing the ability. The problem is when the new helmet is added by EquipItem() it doesn't receive the OnEquipped() event so my ability never gets re-applied.

I confirmed that the rest of the script is working by manually adding the ability using the console after the switcheroo happens

What I need is an event that I can add to the helmet script that still gets called if the helmet was added by EquipItem so that I can re-apply my ability

Thanks in advance

- Hypno
User avatar
Robert
 
Posts: 3394
Joined: Sun Sep 02, 2007 5:58 am

Post » Tue Feb 19, 2013 1:46 am

known bug:

http://skyrim.nexusmods.com/mods/13298
iirc affects shield as well, that get autoequipped if you switch from a 2handed weapon back to a 1handed weapon (and you did have the 1handed weapon equipped with the shield before)
User avatar
Big mike
 
Posts: 3423
Joined: Fri Sep 21, 2007 6:38 pm

Post » Mon Feb 18, 2013 4:55 pm

Thanks for that mate.

I've had a brainwave...perhaps all that needs to be changed is to swap around the order or the EquipItem() and RemoveItem(). My reasoning is that as it is at the moment, when the new helmet is equipped, the player already has the ability so a new one is not added. But then the old helmet gets removed its OnUnequipped() event removes the ability. I cannot test this at the moment as im stuck at work, but I bet that's it

Well I hope that's it rather then a bug

- Hypno
User avatar
Jhenna lee Lizama
 
Posts: 3344
Joined: Wed Jun 06, 2007 5:39 am


Return to V - Skyrim