
First off, I'm overriding the PlayerHorse script. When the player is sneaking (heh, got that figured out), instead of activating the horse and allowing the player to climb aboard, it instead activates a chest reference.
The chest reference has a custom ObjectReference script attached. I've overridden the OnOpen and OnClose events and if you enter the cell with the chests and open/close them, the events will fire off properly.
The problem comes when I'm firing off the Activate function on the object, the chest opens, the OnActivate Event fires off, but neither the OnOpen nor OnClose events will trigger.
Here's the overridden horse script. I've attached the ChestReference to the HorseChest ObjectReference Property:
Spoiler
Scriptname PlayerHorseScript extends ReferenceAlias bool bDelayActivationEvent OnDeath(Actor akKiller) MySelf = GetActorReference() HorseChest.RemoveAllItems(akTransferTo = MySelf, abKeepOwnership = true)EndEventEvent OnUnload() If MySelf.IsDead() == 1 ; disable the dead horse if it is unloaded MySelf.Disable() MySelf.Delete() ; added a new horse that can be bought at the stables Myself = StablesPosition.PlaceActorAtMe(LvlHorseSaddled) Alias_HorseRef.ForceRefTo(MySelf) Alias_HorseRef.GetRef().SetFactionOwner(StablesFaction) EndIfEndEventEvent OnActivate(ObjectReference akActionRef) If bDelayActivation bDelayActivation = false GetActorReference().BlockActivation(True) Else If (akActionRef == Game.GetPlayer() && Game.GetPlayer().IsSneaking()) ;Debug.MessageBox("Sneak Activate Horse!!") HorseChest.Activate(Game.GetPlayer(), False) Else ;Debug.MessageBox("Normal Activate Horse!! " + HorseChest) ;Set Speed of horse based on weight in chest Debug.MessageBox("SaddleBags Weight = " + (HorseChest as _MDHorseChestScript).GetWeight()) ;Enable activations and have player mount horse bDelayActivation = true GetActorReference().BlockActivation(False) GetActorReference().Activate(Game.GetPlayer()) EndIf EndIf EndEventActor Property MySelf Auto ObjectReference Property StablesPosition Auto ActorBase Property LvlHorseSaddled Auto ReferenceAlias Property Alias_HorseRef Auto Faction Property StablesFaction Auto ObjectReference Property HorseChest AutoAnd here's the script attached directly to the chest object reference in the Cell:
Spoiler
Scriptname _MDHorseChestScript extends ObjectReference Event OnInit() Weight = 1.0EndEventFloat Function GetWeight() Return WeightEndFunctionEvent OnActivate(ObjectReference akActionRef) Debug.MessageBox("OnActivate Weight = " + Weight)EndEventEvent OnOpen(ObjectReference akActionRef) PCWeightBefore = Game.GetPlayer().GetAV("InventoryWeight") Debug.MessageBox("OnOpen Weight = " + Weight)EndEventEvent OnClose(ObjectReference akActionRef) PCWeightAfter = Game.GetPlayer().GetAV("InventoryWeight") Weight = Weight +(PCWeightBefore - PCWeightAfter) Debug.MessageBox("OnClose Weight = " + Weight)EndEventFloat Property Weight AutoFloat Property PCWeightBefore AutoFloat Property PCWeightAfter Auto