×
Меню
Индекс

MSFD Locking and Unlocking doors or chests

 
Lock, short_enum_locklevel
Unlock
 
My_Door->Lock, 50
 
GetLocked      (returns Boolean/short)
 
If ( GetLocked == 1 )
          Unlock
Endif
 
(only Door and container objects)
 
These functions are used to lock and unlock doors or containers. The GetLocked function returns 1 when the calling object is locked. Lock locks the object with the lock level specified (0-100). Lock 0 has an odd effect though. The door/container will be neither openable nor pickable. Unlock removes any lock, regardless of lock level.
 
Example script:
Here is a sample script by qwert, which makes a chest function as a security skill-training device by constantly relocking it:
 
Begin PC_Security_Skill_Trainer
 
float timer
 
if ( menumode == 1 )
return
endif
 
set timer to timer + GetSecondsPassed
if ( timer > 10 )
set timer to 0
endif
 
if ( timer == 0 ) ;using a timer to relock after 10 seconds pass
"Storm_Chest_Trainer"->Lock 50
endif
 
End