Spoiler
Event OnMenuClose (String menuName)if Rayg_JordisHired If menuName == "Dialogue Menu" String sActorName = (GetReference() As Actor).GetBaseObject().GetName() if sActorName == "Jordis the Sword-Maiden" if ((GetReference() As Actor).GetItemCount(DLC1ArmorDawnguardHelmetHeavy) == 1) if (!(GetReference() As Actor).IsWeaponDrawn()) (GetReference() As Actor).UnequipItem(DLC1ArmorDawnguardHelmetHeavy, true) Endif RegisterForAnimationEvent(GetActorReference(), "weaponDraw") RegisterForAnimationEvent(GetActorReference(), "weaponSheathe") bHasHelmet = true Debug.Notification("Follower Has Helmet") Elseif ((GetReference() As Actor).GetItemCount(DLC1ArmorDawnguardHelmetHeavy) == 0) if bHasHelmet UnregisterForAnimationEvent(GetActorReference(), "weaponDraw") UnregisterForAnimationEvent(GetActorReference(), "weaponSheathe") bHasHelmet = false Debug.Notification("Follower no longer has Helmet") Endif Endif EndIf EndIfEndifEndEventEvent OnAnimationEvent(ObjectReference akSource, string asEventName)if asEventName == "weaponDraw" (GetReference() As Actor).EquipItem(DLC1ArmorDawnguardHelmetHeavy, false, true) Debug.Notification("Follower draws weapon")elseif asEventName == "weaponSheathe" (GetReference() As Actor).UnequipItem(DLC1ArmorDawnguardHelmetHeavy, true) Debug.Notification("Follower sheaths weapon")endifEndEvent
With this when I give Jordis the helmet, she promptly unequips it when we leave dialogue, puts it on when she draws her weapon and unequips it again when she sheaths her weapon. So far so good. But when we go past loading screen, two things happen:
First she puts on the helmet again like normal. And secondly, OnAnimationEvent stops firing.
If I put an OnLoad event that rechecks thing and unequips and reregisters as needed like this:
Spoiler
Then the script works as intended and continues to work past loading screen.Event OnLoad()if ((GetReference() As Actor).GetItemCount(DLC1ArmorDawnguardHelmetHeavy) == 1) RegisterForAnimationEvent(GetActorReference(), "weaponDraw") RegisterForAnimationEvent(GetActorReference(), "weaponSheathe") bHasHelmet = true if (!(GetReference() As Actor).IsWeaponDrawn()) (GetReference() As Actor).UnequipItem(DLC1ArmorDawnguardHelmetHeavy, true) EndifElseif ((GetReference() As Actor).GetItemCount(DLC1ArmorDawnguardHelmetHeavy) == 0) if bHasHelmet UnregisterForAnimationEvent(GetActorReference(), "weaponDraw") UnregisterForAnimationEvent(GetActorReference(), "weaponSheathe") EndifEndif Debug.Notification("Follower Loaded")endEvent
Okay, so here are my two question:
Is abPreventEquip in UnequipItem broken, or just doesn't work on NPCs? I flagged it as true, but Jordis cheerfully ignores that and equips the helmet anyway when she rechecks her inventory.
As for OnAnimationEvent: Is it intended behaviour for that to stop working (automatically unregister itself or something) after a loading screen? If no, what did I do wrong?