Rattlerx5150 Posted December 31, 2016 Share Posted December 31, 2016 I have a mod with a heavy security door. the door is locked with a key (Requires Key) in the geck I would like a script that , when the door is closed manually, the door will automatically lockI dont want the script to force the door closed I dont want to have to use a button or switch to lock the door Can this be done? Link to comment Share on other sites More sharing options...
kitcat81 Posted December 31, 2016 Share Posted December 31, 2016 DoorScriptEvent OnActivate(ObjectReference akActionRef) If akActionRef == Game.GetPlayer() If Self.IsLocked() == false Self.SetOpen(false) Self.Lock() EndIfEndIfEndEvent Link to comment Share on other sites More sharing options...
Rattlerx5150 Posted December 31, 2016 Author Share Posted December 31, 2016 DoorScriptEvent OnActivate(ObjectReference akActionRef) If akActionRef == Game.GetPlayer() If Self.IsLocked() == false Self.SetOpen(false) Self.Lock() EndIfEndIfEndEventDoesnt work, but thank you anyway Link to comment Share on other sites More sharing options...
kitcat81 Posted December 31, 2016 Share Posted December 31, 2016 DoorScriptEvent OnActivate(ObjectReference akActionRef) If akActionRef == Game.GetPlayer() If Self.IsLocked() == false Self.SetOpen(false) Self.Lock() EndIfEndIfEndEventDoesnt work, but thank you anywayMaybe depends on the lock, works with a usual door for me.What exactly is not working? Link to comment Share on other sites More sharing options...
Rattlerx5150 Posted December 31, 2016 Author Share Posted December 31, 2016 the script saves and appears to be good but when you close the door, it does not lock Link to comment Share on other sites More sharing options...
kitcat81 Posted December 31, 2016 Share Posted December 31, 2016 Then it might be something with the door settings. I use similar script that locks and unlocks the settlement door but without using any key. It just works only for player.But unforunatelly it seems there is no option to set your personal lock. It locks doors with generic novice locks and your key most probably would not work with it. Link to comment Share on other sites More sharing options...
caleb68 Posted December 31, 2016 Share Posted December 31, 2016 Try this: Scriptname DoorClosenLockScript extends ObjectReference Const Event OnClose(ObjectReference akActionRef) If akActionRef == Game.GetPlayer() If Self.IsLocked() == false Self.SetOpen(false) Self.Lock() Self.SetLockLevel(LockLevel) EndIf EndIf EndEvent Group DoorPRoperties Int Property LockLevel Auto Const {Level of door lock} EndGroup attach that script directly to the door, it should lock the door when it is closed, the property on it 'locklevel' is so you can set the lock level of the door, by default it defaults to novice when you relock a door. lock levels are 1-4, 4 being master there is also a script that you can attach to a trigger box already in the game called CloseLockDoorScript you'd add a default empty trigger on either side of the door, and add the script to it, You want to set the property 'CloseDoor' to true, 'LockDoor' to true, and set the 'LockLevel' then link your trigger to the door using linkcustom01 as the keyword. That triggerbox method would cause the door to automatically close and lock behind the player when they enter the trigger box. you'd have to make sure its set far enough infront of the door to keep the door from pushing the player back out when it closes. Either Method should work fine for you. Link to comment Share on other sites More sharing options...
kitcat81 Posted December 31, 2016 Share Posted December 31, 2016 I was actually wrong, decided to test it as I was curious why it won`t work for you. My script works for Covenant doors if adding a locklevel of Covenant doors to it which is zero. Event OnActivate(ObjectReference akActionRef) If akActionRef == Game.GetPlayer() If Self. IsLocked() == false Self.SetOpen(false) Self.Lock() SetLockLevel(0) else Self.UnLock() Self.SetOpen() EndIf EndIf EndEvent Link to comment Share on other sites More sharing options...
caleb68 Posted December 31, 2016 Share Posted December 31, 2016 I was actually wrong, decided to test it as I was curious why it won`t work for you. My script works for Covenant doors if adding a locklevel of Covenant doors to it which is zero. Event OnActivate(ObjectReference akActionRef) If akActionRef == Game.GetPlayer() If Self. IsLocked() == false Self.SetOpen(false) Self.Lock() SetLockLevel(0) else Self.UnLock() Self.SetOpen() EndIf EndIf EndEvent without trying your script, the problem I see with it is when the player opens the door, it will automatically close and lock on them rather then only locking when the door is closed, hense why I used the event 'OnClose' instead of 'OnActivate', that way the door will only lock if its closed, and will remain open until then. Link to comment Share on other sites More sharing options...
kitcat81 Posted December 31, 2016 Share Posted December 31, 2016 (edited) without trying your script, the problem I see with it is when the player opens the door, it will automatically close and lock on them rather then only locking when the door is closed, hense why I used the event 'OnClose' instead of 'OnActivate', that way the door will only lock if its closed, and will remain open until then. No, it does not do this - it`s a toggle.It does something only when player activates it, one action at a time. Either closes and locks or unlocks and opens. Activating = pressing "E" on the door. I tested it in the game as this is a script I`m using for my settlements just without a lock level and key. Without lock level it won`t let to unlock it with some certain key so for using key need to set a lock level. Just a note that for using it without lock level and key in settlements there should be an additional event like this : Event OnWorkshopObjectPlaced(ObjectReference akReference) Self.BlockActivation() EndEvent Edited December 31, 2016 by kitcat81 Link to comment Share on other sites More sharing options...
Recommended Posts