Why is my OnUpdate() Event getting sent whilst I am still in menu-mode?
If I place Keening inside the container, and linger in the menu, I can clearly see my display Keening getting enabled in the background. The associated animations however, don't play until the menu has closed.
Here is my script: (trimmed for brevity)
Spoiler
Scriptname MDHDisplayArrayScript extends ObjectReference {Toggle's special display items based on the contents of various containers. Used for Dragon Claws, Dragon Priest Masks, and all Artifacts. Unfortunately our Artifacts need to be split up into specific array's or individual property's.};Control Variablebool Property isClaws = false Autobool Property isMasks = false Autobool Property isDaedric = false Autobool Property isArtifacts = false Autobool Property isElderScrolls = false Auto;List of items allowed into these containersFormList Property ListClaw AutoFormList Property ListMask AutoFormlist Property ListDaedric AutoFormlist Property ListArtifacts Auto;Base-Item (Form) Array'sBook[] Property kScrollArray AutoArmor[] Property kMaskArray AutoArmor[] Property kDaedricArmorArray AutoArmor[] Property kArtifactArmorArray AutoMiscObject[] Property kClawArray AutoPotion[] Property kWhitePhialArray AutoSoulGem[] Property kDaedricSoulGemArray AutoWeapon[] Property kDaedricWeaponArray AutoWeapon[] Property kArtifactWeaponArray Auto;Enable-Parent Array's. Order must match the entries of the above array'sObjectReference[] Property kScrollReference AutoObjectReference[] Property kMaskReference AutoObjectReference[] Property kClawReference AutoObjectReference[] Property kDaedricArmorReference AutoObjectReference[] Property kDaedricWeaponReference AutoObjectReference[] Property kSoulGemReference AutoObjectReference[] Property kWhitePhialReference AutoObjectReference[] Property kArtifactArmorReference AutoObjectReference[] Property kArtifactWeaponReference AutoActor Property PlayerRef AutoBook Property DA04Book AutoWeapon Property Keening AutoMessage Property MessageWarning AutoObjectReference Property DA04Parent AutoObjectReference Property KeeningMount AutoObjectReference Property KeeningParent Auto;=========================================================================================; EVENTS HERE;=========================================================================================Event OnUpdate() UnregisterForUpdate() PlaceKeening()EndEventEvent OnItemAdded(Form akBaseItem, Int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer) If isDaedric If ListDaedric.HasForm(akBaseItem) If (akBaseItem as Armor) CheckDaedricArmors() elseif (akBaseItem as Weapon) CheckDaedricWeapons() elseif (akBaseItem as SoulGem) CheckSoulGems() elseif akBaseItem == DA04Book DA04Parent.Enable() endif Else RemoveItem(akBaseItem, aiItemCount, False, akSourceContainer) MessageWarning.Show() Endif Endif If isArtifacts If ListArtifacts.HasForm(akBaseItem) If (akBaseItem as Armor) CheckArtifactArmors() elseif akBaseItem == Keening RegisterForSingleUpdate(0.2) ;PlaceKeening() elseif (akBaseItem as Weapon) CheckArtifactWeapons() elseif (akBaseItem as Potion) CheckWhitePhial() endif Else RemoveItem(akBaseItem, aiItemCount, False, akSourceContainer) MessageWarning.Show() Endif Endif If isMasks If ListMask.HasForm(akBaseItem) CheckMasks() Else RemoveItem(akBaseItem, aiItemCount, False, akSourceContainer) MessageWarning.Show() Endif Endif If isClaws If ListClaw.HasForm(akBaseItem) CheckClaws() Else RemoveItem(akBaseItem, aiItemCount, False, akSourceContainer) MessageWarning.Show() Endif Endif If isElderScrolls CheckScrolls() endifEndEvent;================================================================================Event OnItemRemoved(Form akBaseItem, Int aiItemCount, ObjectReference akItemReference, ObjectReference akDestContainer) If isDaedric If ListDaedric.HasForm(akBaseItem) If (akBaseItem as Armor) ;what specifically got removed? We don't need excess iteration so limit the function calls. CheckDaedricArmors() elseif (akBaseItem as Weapon) CheckDaedricWeapons() elseif (akBaseItem as SoulGem) CheckSoulGems() elseif akBaseItem == DA04Book DA04Parent.Disable() endif Endif Endif If isArtifacts If ListArtifacts.HasForm(akBaseItem) If (akBaseItem as Armor) CheckArtifactArmors() elseif akBaseItem == Keening RegisterForSingleUpdate(0.2) ;PlaceKeening() elseif (akBaseItem as Weapon) CheckArtifactWeapons() elseif (akBaseItem as Potion) CheckWhitePhial() endif Endif Endif If isMasks If ListMask.HasForm(akBaseItem) CheckMasks() EndIf Endif If isClaws If ListClaw.HasForm(akBaseItem) CheckClaws() Endif Endif If isElderScrolls CheckScrolls() endifEndEvent;=========================================================================================; FUNCTIONS HERE;=========================================================================================Function PlaceKeening() ;Happens inside update event, NOT in menu-mode. (IN THEORY) If GetItemCount(Keening) == 1 KeeningMount.PlayAnimationAndWait("SetDown", "Done") ;debug.notification("SetDown DONE") KeeningMount.PlayAnimation("Open") ;does not happen from inside another cell utility.wait(0.3) KeeningParent.Enable() ;this will get enabled/disabled though elseif GetItemCount(Keening) == 0 KeeningMount.PlayAnimation("Close") ;assumes open utility.wait(0.4) KeeningParent.Disable() utility.wait(0.4) KeeningMount.PlayAnimation("Pickup") ;debug.notification("PickUp DONE") endifEndFunction
It's not the end of the world if I can't get my PlaceKeening() Function to suspend until menu-mode finishes, but it certainly would be nice.
BTW, I did originally try a Utility.Wait(0.2) but the observable behaviour did not change in the slightest.