Difference between revisions of "Lock - ObjectReference"
Jump to navigation
Jump to search
imported>Vitamant m (1 revision: Clobber re-import by Henning) |
imported>Goggle (→Examples: Calling lock on a door you changed its lock level to in the editor to take a key in-game, will not be unlocked by the modded key under conditions. (See notes)) |
||
Line 29: | Line 29: | ||
PrivateDoor.Lock(false, true) | PrivateDoor.Lock(false, true) | ||
</source> | </source> | ||
== Note == | |||
* If you add a key to a door, and then call this function on it at run-time because the door was unlocked or opened for some reason and it's a vanilla door that already required a key but a key was not chosen for it, your modded version of said door will not override it. The door wont accept your modded version's door key. | |||
== See Also == | == See Also == | ||
*[[ObjectReference Script]] | *[[ObjectReference Script]] | ||
*[[IsLocked - ObjectReference]] | *[[IsLocked - ObjectReference]] |
Latest revision as of 18:30, 2 September 2016
Member of: ObjectReference Script
Locks or unlocks this object. If told to lock it, and no lock is attached, a very easy lock will be attached. If the object is open, and it is told to lock it, the object will be snapped closed.
Syntax[edit | edit source]
Function Lock(bool abLock = true, bool abAsOwner = false) native
Parameters[edit | edit source]
- abLock: Whether to lock or unlock this lock.
- Default: True
- abAsOwner: If true, and on a door, it will behave as if the owner unlocked or locked the door, and flag the adjoining cell as public or private as appropriate.
- Default: False
Return Value[edit | edit source]
None.
Examples[edit | edit source]
; Lock the door
SecurityDoor.Lock();
; Unlock the door, flagging the cell on the other side as public
PrivateDoor.Lock(false, true)
Note[edit | edit source]
- If you add a key to a door, and then call this function on it at run-time because the door was unlocked or opened for some reason and it's a vanilla door that already required a key but a key was not chosen for it, your modded version of said door will not override it. The door wont accept your modded version's door key.