ScriptName NNWTorSkript extends ObjectReference

ObjectReference Property Tor Auto Hidden
Faction Property PlayerFaction Auto
Import Utility
int status

Event OnTriggerEnter(ObjectReference AkActivator)

Tor = GetLinkedRef()
If(Game.GetPlayer()==AkActivator)||((AkActivator as Actor).IsInFaction(PlayerFaction))
status = Tor.GetOpenState()
EndIf
	If(status == 3)
	Tor.SetOpen()
	EndIf
EndEvent

Event OnTriggerLeave(ObjectReference AkActivator)

If(Game.getPlayer()==AkActivator)||((AkActivator as Actor).IsInFaction(PlayerFaction))

status = Tor.GetOpenState()

	if(status == 1)
	Tor.SetOpen(false)
	elseif(status == 2)
	Utility.Wait(3)
	Tor.SetOpen(false)
	EndIf
EndIf
EndEvent
