Hello - I am trying to create a weapon, that does a variety of things based upon your action with it. I am attempting to do this by attaching a script to the weapon in question.
I am trying to accomplish:
1) detect when the weapon is added to your inventory <-- this is not working
2) detect when the weapon is removed from your inventory <-- this is also not working
3) detect when the weapon is grabbed (works just fine)
4) detect when the weapon is equipped and unequipped (works just fine)
The goal is to ultimately do some various cool magic effects depending on the events above. I assume I am using the events incorrectly - or maybe the wrong events?
My current script code is:
Scriptname GBobMagicItemWeapMystery extends ObjectReference ;===============================================import utilityimport form;===============================================Weapon Property ItemDiscovered autoMagicEffect Property EffectWhenAdded autoMagicEffect Property EffectWhenRemoved autoMagicEffect Property EffectWhenEquipped autoMagicEffect Property EffectWhenHit autoEvent OnGrab() Debug.Notification("Grabbing item")endEventEvent OnItemAdded(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer) Debug.Notification("Item added") if !akSourceContainer Debug.Notification("I picked up " + aiItemCount + "x " + akBaseItem + " from the world") elseif akSourceContainer == Game.GetPlayer() Debug.Notification("The player gave me " + aiItemCount + "x " + akBaseItem) else Debug.Notification("I got " + aiItemCount + "x " + akBaseItem + " from another container") endIfendEventEvent OnItemRemoved(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akDestContainer) Debug.Notification("Item removed") if !akDestContainer Debug.Notification("I dropped " + aiItemCount + "x " + akBaseItem + " into the world") elseif akDestContainer == Game.GetPlayer() Debug.Notification("I gave the player " + aiItemCount + "x " + akBaseItem) else Debug.Notification("I gave " + aiItemCount + "x " + akBaseItem + " to another container") endIfendEventEvent OnEquipped(Actor akActor) if akActor == Game.GetPlayer() Debug.Notification("We were equipped by the player!") endIfendEventEvent OnUnequipped(Actor akActor) if akActor == Game.GetPlayer() Debug.Notification("We were unequipped from the player!") endIfendEventEvent OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked) Debug.Notification("We were hit by " + akAggressor)EndEvent
My problem currently lies with the two events "OnItemAdded" and "OnItemRemoved". Neither one of these appear to get executed.
I have yet to test whether the OnHit event works correctly (I want to detect when the weapon successfully hits a target).
Does anyone have any ideas of what I am doing wrong?
Thanks in advance!