Jump to content

Scripting Help! How to put a Door on a timer so that it will close and Lock itself after being opened?


Recommended Posts

Hello again! So as it says in the title, I have a treasury vault in my mod, and I would like it so that after the player, unlocks and opens the door the door will close and lock itself after a short period of time. And I still looking at scripts like they are written in some form of elvish would really appreciate help in this!

 

Thank you for your help!

Link to comment
Share on other sites

Hello again! So as it says in the title, I have a treasury vault in my mod, and I would like it so that after the player, unlocks and opens the door the door will close and lock itself after a short period of time. And I still looking at scripts like they are written in some form of elvish would really appreciate help in this!

 

Thank you for your help!

 

There are a couple different ways you can do this.

First do you just want the door to close and lock so no one else can enter, or do you want to trap the player inside the room? And is the door opened with a key or a lever the first time the player enters?

Link to comment
Share on other sites

Place the script on the door (object reference in cell view)

 

Event OnActivate()

Utility.Wait(10) ;or whatever time you want

Self.SetOpen(false); close door

Utility.Wait(1) ;little bit of breathing space.

Self.Unlock(false); lock door

EndEvent

 

You can use checks on door if need be using GetOpenState() that's up to you.

 

Additionally you can also place a script on a trigger box around the door. Either way. .aside from the event (OnActivate or on trigger enter etc) the native functions (setopenstate etc) are the meat of the script.

 

EVENT = When this happens I want my script to do something.

 

FUNCTION = This is the something that I want my script to do.

 

Google is your friend :)

Link to comment
Share on other sites

  • Recently Browsing   0 members

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