I have an odd issue where the OnItemAdded event isn't triggered when using Take All to remove ANY number of items from a container.
How can I make this work?
Here's the script:
ScriptName dubhKingOfThievesMiscStatFix Extends ReferenceAliasActor Property Player AutoFaction Property PlayerFaction AutoActorBase PlayerBaseEvent OnInit() PlayerBase = Player.GetActorBase()EndEventEvent OnPlayerLoadGame() PlayerBase = Player.GetActorBase()EndEventEvent OnItemAdded(Form akBaseItem, Int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer) Bool bIsContainerMenuOpen = UI.IsMenuOpen("ContainerMenu") If bIsContainerMenuOpen If akSourceContainer Log("I picked up " + aiItemCount + "x " + akBaseItem + " from " + akSourceContainer) If !IsContainerOwnedByPlayer(akSourceContainer) Game.IncrementStat("Items Stolen", aiItemCount) Log("Increased 'Items Stolen' stat by " + aiItemCount) EndIf EndIf EndIfEndEventBool Function IsContainerOwnedByPlayer(ObjectReference aContainer) ActorBase actorOwner Faction factionOwner If aContainer actorOwner = aContainer.GetActorOwner() If !actorOwner actorOwner = aContainer.GetParentCell().GetActorOwner() If !actorOwner factionOwner = aContainer.GetFactionOwner() If !factionOwner factionOwner = aContainer.GetParentCell().GetFactionOwner() EndIf EndIf EndIf If actorOwner Return actorOwner == PlayerBase ElseIf factionOwner Return factionOwner == PlayerFaction Else Return True EndIf Else Return True EndIfEndFunctionFunction Log(String msgTrace) Debug.Trace("King of Thieves: dubhKingOfThievesMiscStatFix> " + msgTrace)EndFunction