Jump to content

Auto Lock Door Script


BrokenSwords

Recommended Posts

Hello, Darryl here.

 

Could someone help me sort this script out.

 

I'm making house mod that's in the gameworld and not a seperate cell but I don't know how to auto lock a door, I know a little of scripting but not a lot.

 

The door has a key for the player only, there's already a script in the game that allows NPC's to auto lock doors but it stops the player, I have taken this and modiified it to what I thought would work but alas it doesn't.

 

I've attached a picture of thier script (top) and my modifed script (bottom).

 

I hope I get some replies.

 

Yours truely.

Darryl.

Link to comment
Share on other sites

If i'm right then the set openstate 0 is used to close the door.

I'm not great at scripting but maybe this might work.. :unsure:

 

Begin OnActivate

 

if isActionRef Player == 1

lock 2

SetOpenState 1

 

else

 

if isActionRef Player == 0

lock 2

SetOpenState 0

 

Activate

 

endif

endif

end

 

hopefully this works

Link to comment
Share on other sites

Hey Darryl,

 

I had the same need awhile ago and used the OnClose function as a trigger to reset the lock status (255). Any item that has an animated close sequence can use the OnClose function. I will post a copy of my super simple script tonight when I get home from work.

Edited by maxrsp
Link to comment
Share on other sites

So, what I did was create a duplicate door form and added the following script:

 

Scn ModAutoLock

 

Begin OnClose ModMyArmoryDoor

 

ModMyArmoryDoor.Lock 255

 

End

 

I then used this object and set it to be default locked and associated it with a key.

 

I've seen this done a bunch of different ways; they all worked but few were this elegant ;)

Edited by maxrsp
Link to comment
Share on other sites

  • Recently Browsing   0 members

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