GetLockKeyRequired(object)

Check whether an object requires a specific key to be unlocked.

int GetLockKeyRequired(
    object oObject
);

Parameters

oObject

The object to check.


Description

Returns a true/false value describing whether or not oObject requires a specific key to be unlocked. Returns TRUE if oObject requires a specific key to be unlocked. Returns FALSE if oObject doesn't require a specific key to be unlocked. There is no error value.

Even though someone says there is no error value, it must return FALSE if oObject is something that cannot be locked (such as a Creature object).



Remarks

GetLockKeyTag() can be used to get the tag of the key needed to unlock a door.

A PC Opening a door with the right key does not need to be scripted, it is run by the game engine. This would be useful mainly for henchmen NPC's to see if they can unlock a locked door - if it needs a key, they normally cannot.


Version

1.22

Example

// This will determine if a specific key is required to unlock a door
void main()
{
    object a;
    a = GetObjectByTag("door");
    if(GetLockKeyRequired(a))    //Requires a key?
        SendMessageToPC(GetFirstPC(),"Requires a key");
}

See Also

functions: SetLockKeyRequired | GetLocked | SetLocked | GetLockedObject | GetLockKeyTag | SetLockKeyTag | GetLockLockable | SetLockLockable
categories: Action on Object Functions | Get Data Functions | Get Data from Object Functions


 author: GoLeM, editor: Jasperre, Mistress