//Put this Onheartbeat of door void main() { object oTarget = OBJECT_SELF; if (GetIsNight()== TRUE) { SetLocked(oTarget, TRUE); } else { SetLocked(oTarget, FALSE); } }