Skip to main content

modify_exit

Discworld room help

modify_exit

modify_exit settings relating to locks

Below is a list of the modify_exit settings that apply to locks on door-type exits. Settings related to traps on a door or doors in general are documented separately. Each setting is described in detail, with additional notes if necessary and an example of how the setting is used. Where callback functions are used by the setting, the required signature for the function is shown.

difficulty

How difficult the lock on the door is to pick. This also affects how difficult the lock is to probe.

The param is an integer relating to the skill bonus required for the player to probe or pick the lock. The values 0-10 are reserved, these are predefined difficulties where 0 requires no skill and 10 requires an extremely high bonus (only one player in September 2011 would have been able to succeed). A value of 11 or greater specifies an actual skill bonus.

e.g.
modify_exit( "east", ({ "difficulty", 1 }) );
—> The lock on the east door has a lock that is of "very easy"
difficulty to pick.

locked

Whether the door is locked. Setting the door to be locked using this will attempt to force the door closed first.

The param is an integer (1 or 0). A value of 1 specifies that the door is locked, 0 that it isn't.

e.g.
modify_exit( "east", ({ "locked", 1 }) );
—> The east door is set to closed and locked.

unlocked

Whether the door is unlocked. Unlike the "locked" setting, if you specify the door is locked (isn't unlocked) using this setting there is no attempt to force the door closed first.

The param is an integer (1 or 0). A value of 1 specifies the door is unlocked, 0 that it is locked.

e.g.
modify_exit( "east", ({ "unlocked", 1 }) );
—> The east door is set to unlocked.

autolock

Whether the door automatically locks when closed.

The param is an integer (1 or 0). A value of 1 specifies that the door should lock automatically when closed, 0 that it shouldn't.

e.g.
modify_exit( "east", ({ "autolock", 1 }) );
—> The east door is configured to lock automatically when it's closed.

key

The property name defined on valid keys for the door. By default a lock has the param value of "generic key" for this setting, meaning that no actual key is able to lock/unlock the door's lock and it can't be lockpicked either. Unless this setting is changed from the default param value the only way to lock/unlock the door is using calls.

The param is a string or a function pointer to a function that returns a string. The string value or the function's returned string is a property name that must exist on a valid key object. I.e. a valid key will return 1 when the call key->query_property(value) is executed.

e.g.
modify_exit( "east", ({ "key", "tavish_cookie_jar_key" }) );
—> The east door's lock can now be locked/unlocked by a key with the
property "tavish_cookie_jar_key" set to a non-zero value on it.
It may now also be lockpicked.

lock owner

The name of the owner of the lock. This is used for PK-checking, i.e. if the lock is owned by a non-PK then noone can lockpick it, if set to a PK player, then only other PK players can lockpick it.

The param is a string, the name of the player who "owns" the lock.

e.g.
modify_exit( "east", ({ "lock owner", "lanfear" }) );
—> picking the lock on the east door will be allowed or not
depending on the PK status of Lanfear and the player who is
attempting to lockpick it.

lock/unlock func

The function to call when an attempt is made to lock or unlock the door. The function is called before the operation takes place and should return 1 or 0, where 1 indicates that the operation is permitted, 0 if not. If returning 0, notify_fail(string) can be used to print a failure message to the player but this is only displayed as the result of a player using the lock or unlock command, if they are attempting to move through the exit and automatically unlock it in the process the default "The door is locked." message is printed.

The param is an array specifying the object-reference to the object where the function is defined and the function name. Three parameters are supplied to the function, a string (either "lock" or "unlock"), the door object and the player object.

e.g.
modify_exit( "east", ({
"lock/unlock func", ({ this_object(), "func" })
}) );
—> The east door cannot be locked/unlocked, even with the key.

Function signature :-
int func(string open, object door, object player) {
notify_fail("Sorry, not today.\n");
return 0;
}

add pick skill

Add a skill requirement for picking the the lock. The basic lock uses the covert.lockpick.doors skill and the difficulty is set via the "difficulty" setting. This call is optional but allows for creators to design locks that use different skills. The first skill to be added with this call overrides the default covert.lockpick.doors skill and the difficulty setting for picking the lock. For backward compatibility the "difficulty" is left unaltered, considered separate and used to determine lock's probe difficulty. Multiple skill requirements can be assigned for a single lock, on probing the player will be given information about their weakest skill in the set.

The param is a three element array. The first element is a string, the fully specified skill to be checked against. The second element is a string, a player friendly description of the skill. The third element is an integer, relating to the skill bonus required for the player to pick the lock. The values 0-10 are reserved, these are predefined difficulties where 0 requires no skill and 10 requires an extremely high bonus (only one player in September 2011 would have been able to succeed). A value of 11 or greater specifies an actual skill bonus.

e.g.
modify_exit( "east", ({ "add pick skill",
({ "fighting.unarmed.grappling", "grappling", 250 })
}) );
—> fighting.unarmed.grappling replaces covert.lockpick.doors as the
skill required for picking the lock on the east door. The
player will need a bonus of 250 or more in the skill to succeed.

pick tool

Define a tool for picking the lock. The basic lock requires a lockpick to pick it. This call is optional but allows for creators to design locks that require a different tool, or no tool at all. If a tool is described, it can be required or optional and the player can be awarded a bonus to their chance to pick the lock based on that tool. The function is supplied with an array of items that could potentially be tools and that function should return an array consisting only of those potential tools that are valid.

The param is either a single element array consisting of the integer 0, i.e. ({ 0 }), to specifify that no tool is required or a five element array to define the tool. If defining a tool, the first two elements specify the object-reference to the object where the function is defined and the function name. The third element is a string, a descriptive term for the tool that will be printed to the player. The fourth element is an integer (1 or 0) specifying whether the tool is required or optional for picking the lock, a value of 1 indicates it is required, 0 that it is optional. The fifth value can either be an integer which specifies a bonus to award the player in pick attempts if holding a valid tool, or a string which specifies the property name on the tool to query for an integer bonus.

e.g.
modify_exit( "east", ({ "pick tool",
({ this_object(), "func", "wand", 0, 50 })
}) );
—> Overrides the requirement for a lockpick for picking the lock on
the east door. Instead a wand can be used, it is optional but
provides the player with 50 bonus on their attempt to pick the
lock.

Function signature :-
/* Any logic can be used to determine what constitues a valid tool.
* In this example a "wand", all wands happen to have the function
* query_wand_name() and so if any of the supplied objects in the
* possibles array have this function we consider it valid. All
* such valid tools are added to a new array and returned.
*/
object *tool_func(object *possibles) {
object *ret = ({});
foreach(object poss in possibles) {
if (poss->query_wand_name())
ret += ({ poss });
}
return ret;
}

Other modify_exit Types

Detail on each of the other modify_exit types along with examples are available in :-

help modify_exit_exitsSettings that apply to any exit.
help modify_exit_doorsSettings that require a door type exit.
help modify_exit_trapsSettings that are related to traps on doors.

See also

add_exit, remove_exit, modify_exit