Jump to content

Close door after 3 Second Script


MathLeBeau

Recommended Posts

Attach this to your door.

This works when the door is activated, it's default is 5 seconds and it'll close the door, but you can set the delay property to what you like.

Also has a distance property so the door doesn't close while an actor is standing in it, default is 70 units, this also can be set to what you like (for bigger doorways where you need a further distance to be clear of the door).

 

Scriptname myDoorScript extends ObjectReference

Float Property fDelay = 5.0 Auto
{Optionally set Delay before the door closes, default 5.0 secs}

Float Property fDistance = 70.0 Auto
{Optionally set distance of actors before the door closes so the door doesn't close while an actor in standing in it, default 70.0 units}

Event OnActivate(ObjectReference akActionRef)
    RegisterForSingleUpdate(fDelay)
EndEvent

Event OnUpdate()
    If GetOpenState() < 3
        If !Game.FindClosestActor(Self.X, Self.Y, Self.Z, fDistance)
            SetOpen(False)
        Else
            RegisterForSingleUpdate(fDelay)
        EndIf
    EndIf
EndEvent
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...