Script to Auto Close Doors?

Can soeone please share and Auto doo close scrip and where to put it?
Like i open the door walk though and 30 seconds later it closes .

Thank you
Katana

Here you go hun

Right Click on the door and pick Properties & a new window will open…

  • Click the Tab Scripts.
  • Click the button Edits near OnOpen

then paste this code in:

void main()
{
DelayCommand(30.0, ActionCloseDoor(OBJECT_SELF));
}

  • save it with a name.

This code will auto close the door after 30 seconds.

L0BSTER

1 Like

Perfect thank you

While Lobster’s script will work, I usually make my auto-close scripts more complicated for several reasons. For one thing, it’s possible to “stack” a large number of delayed commands if a player is foolish enough to open and close the door several times before the auto-close takes effect, so I add a do-once variable which is removed once the auto-close takes effect. For another thing, I believe that it’s not appropriate to auto-close a door when there is a PC nearby, so I often set it up so that the auto-close script first checks for a PC nearby (in the same area and within a certain distance) and only closes the door if neither is true, otherwise it sets up another delay.

2 Likes