Scriptname zzzTrapDoorActScript extends ObjectReference  

MiscObject property itemToAdd auto

Cell Property zzzTrapDoorActCell  Auto  

ObjectReference Property zzzTrapDoorActIn  Auto  

ObjectReference Property zzzTrapDoorActOut  Auto  

Event OnLoad()
	BlockActivation()
EndEvent

Event OnActivate(ObjectReference akActionRef)
	if Game.GetPlayer().IsSneaking() == True
		Game.GetPlayer().AddItem(itemToAdd, 1)
		Delete()
		Return
	Else
		Activate(Game.GetPlayer(), true)
	EndIf
		If (akActionRef.GetParentCell() != zzzTrapDoorActCell)
		zzzTrapDoorActOut.MoveTo(akActionRef)
		akActionRef.MoveTo(zzzTrapDoorActIn)
	Else
		akActionRef.MoveTo(zzzTrapDoorActOut)
	EndIf
EndEvent