Difference between revisions of "SetLocked"

From NWN Lexicon
Jump to: navigation, search
 
(5 intermediate revisions by 4 users not shown)
Line 1: Line 1:
 
 
 
 
 
=SetLocked(object, int)=
 
=SetLocked(object, int)=
  
Line 8: Line 4:
  
 
<nwscript>
 
<nwscript>
[[void | void ]] SetLocked(
+
void SetLocked(
    [[object | object ]] oTarget,
+
    object oTarget,
    [[int | int ]] bLocked
+
    int bLocked
);
+
);
 
</nwscript>
 
</nwscript>
  
Line 23: Line 19:
  
 
TRUE to lock, FALSE to unlock.
 
TRUE to lock, FALSE to unlock.
 
<br />
 
  
 
====Description====
 
====Description====
  
Used by objects or creatures to set the locked status of an object or placeable without checking the Open Locks skill. <br /><br /> Note that DM Force Lock does the same thing as this. You can actually lock doors which cannot be normally re-locked, but it is not recommended.
+
Used by objects or creatures to set the locked status of an object or placeable without checking the Open Locks skill.
  
<br /><br />
+
Note that DM Force Lock does the same thing as this. You can actually lock doors which cannot be normally re-locked, but it is not recommended.
  
 
====Remarks====
 
====Remarks====
  
Alternatively, ActionLockObject and ActionUnlockObject can be used by creatures so appropriate skill checks are made. Make sure, as well, that your door has the 're-lockable' box checked. <br /><br /> You can lock an open door. If you do, it will be locked once it closes.
+
Alternatively, ActionLockObject and ActionUnlockObject can be used by creatures so appropriate skill checks are made. Make sure, as well, that your door has the 're-lockable' box checked.  
 +
 
 +
Of course, you can also lock an open door.
  
<br />
+
When the object is already (un)locked, the On(Un)locked event is still fired.
  
 
====Version====
 
====Version====
Line 45: Line 41:
  
 
<nwscript>
 
<nwscript>
// Unlocked an object with the tag DOOR_TAG
+
// Unlocked an object with the tag DOOR_TAG
void main()
+
void main()
{
+
{
    object oDoor = GetObjectByTag("DOOR_TAG");
+
    object oDoor = GetObjectByTag("DOOR_TAG");
    SetLocked(oDoor, FALSE);
+
    SetLocked(oDoor, FALSE);
}
+
}
 
</nwscript>
 
</nwscript>
  
Line 62: Line 58:
 
|}
 
|}
  
<br />
 
 
----
 
----
<font color="gray">  author: Tom Cassiotis, editor: Jasperre</font><br />  <br />
+
<font color="gray">  author: Tom Cassiotis, editor: Jasperre</font>
 
[[Category:Functions]]
 
[[Category:Functions]]
 
[[Category:Get_Data_from_Object_Functions]]
 
[[Category:Get_Data_from_Object_Functions]]

Latest revision as of 18:06, 24 December 2017

SetLocked(object, int)

Locks or unlocks a door or placeable.

void SetLocked(
    object oTarget,
    int bLocked
);

Parameters

oTarget

The door or placeable to lock

bLocked

TRUE to lock, FALSE to unlock.

Description

Used by objects or creatures to set the locked status of an object or placeable without checking the Open Locks skill.

Note that DM Force Lock does the same thing as this. You can actually lock doors which cannot be normally re-locked, but it is not recommended.

Remarks

Alternatively, ActionLockObject and ActionUnlockObject can be used by creatures so appropriate skill checks are made. Make sure, as well, that your door has the 're-lockable' box checked.

Of course, you can also lock an open door.

When the object is already (un)locked, the On(Un)locked event is still fired.

Version

1.61

Example

// Unlocked an object with the tag DOOR_TAG
void main()
{
    object oDoor = GetObjectByTag("DOOR_TAG");
    SetLocked(oDoor, FALSE);
}

See Also

functions: 

GetLastUnlocked


 author: Tom Cassiotis, editor: Jasperre