OnLockStateChanged - ObjectReference

From the Fallout4 CreationKit Wiki
Revision as of 17:40, 15 September 2016 by imported>Goggle (→‎Examples: Event is sent for doors locked by default as the game locks them when loading into the cell. See notes.)
Jump to navigation Jump to search

Member of: ObjectReference Script

Event called when the lock on this object's state changes. (Locked, unlocked, level changed, etc)

Syntax

Event OnLockStateChanged()

Parameters

None.

Examples

Event OnLockStateChanged()
  if IsLocked()
    Debug.Trace("We are locked!")
  endIf
endEvent

Note

  • Doors that are locked by default are not locked when the player is not in the cell. When loading into the cell, then the door is locked. An unfortunate side effect to this is that this event will be sent as a result due to the door switching its lock state to whatever the default is when loading into the cell, making it unreliable. If you wish to do something when the door is unlocked by the player, use OnOpen - ObjectReference as a possible alternative.

See Also