It has the Default2StateActivator script.
I put a trigger box around it and will set it as the Activate Parent of the portcullis.
I'm thinking I could use the DefaultActivateSelf script from the Warehouse Ambushes with OnTriggerEnter changed to OnTriggerLeave and most of the part about followers and activation by others removed.
But how will I tell it to only activate if the portcullis is already open?
If I cut away what I think isn't needed it looks like this:
ScriptName CloseDoor extends objectReference
{script that simply activates itself when player leaves trigger}
import game
import debug
bool property doOnce = FALSE auto
{Fire only once? Default: FALSE}
bool property disableWhenDone = FALSE auto
{Disable after activating? Default: FALSE}
bool property playerOnly = TRUE auto
{Only Player Triggers? Default: TRUE}
;************************************
auto State waiting
Event onTriggerLeave(objectReference triggerRef)
Actor actorRef = triggerRef as Actor
if(actorRef == game.getPlayer()); check whether the player is activating
if(PORTCULLIS IS OPEN)
if doOnce == TRUE
gotoState("allDone")
endif
if disableWhenDone
Self.Disable()
endIf
activate(self); pass self as the activating ref
endif
endif
endEvent
endState
;************************************