Skip to main content

modify_exit

Discworld room help

modify_exit

modify_exit settings relating to traps

Below is a list of the modify_exit settings that apply to traps on door-type exits. Settings related to locks 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.

setup trap

Define a trap for the door. This sets up a basic trap on a door. If armed, the trap will be triggered when a player picks the lock or opens the door (depending on the which trigger you specify). If triggered the message will be printed and the effect will be added to the player. The trap can be configured not to be player-rearmable, to be rearmable a maximum number of times or infinitely rearmable. The default skill for disabling a basic lock is covert.lockpick.traps.

The param is a six element array, due to the length of the descriptions I've given each element of the array its own paragraph:-

The first element is an integer, relating to the skill bonus difficulty. The values 0-10 are reserved to represent predefined difficulties. Level 0 difficulty 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.

The second element is a string defining how the trap is triggered, either "open" or "pick". If "open" the trap is triggered when the door is opened, if "pick" the trap is triggered when the lock is picked.

The third element is a string, the long description of the trap which the player will see on a successful probe.

The fourth element is either a string to print to the player when the trap is triggered, or an an array of two strings, messages to be printed to the player and the room respectively. No $ expansion is performed on any messages.

The fifth element is the effect to inflict on the player if they trigger the trap, it is either an integer specifying the number of hitpoints to remove, a string specifying the path of an effect, or an array where the first element specifies the path of an effect and subsequent elements are passed as parameters when adding the effect to the player.

The sixth element is an array of two integers ({ rearmable, disarms }) that sets whether the trap is rearmable by players and whether it disarms after being triggered. If rearmable is 0, it cannot be armed by a player, if it is -1 if it can be rearmed indefinitely, if it is a positive number it can be rearmed that many times before the arming mechanism is broken. If disarms is 0 the trap will not be disarmed after it has been triggered, if 1 it will be.

e.g.
modify_exit( "east", ({ "setup trap", ({
250,
"pick",
"A device in the lock of the door looks like it controls a "
"small blade, which would shoot out if it is picked carelessly.",
"A small blade shoots out from the lock on the door, "
"stabbing you.\n",
({ "/std/effects/poisons/poison_effect", 5 }),
({ 0, 0 })
}) }) );
—> Adds a trap to the east door, that will be triggered if the lock
is picked while the trap is active. The player will require a
bonus of at least 250 in covert.lockpicking.traps to disable to
trap successfully. When triggered the player will have the
"poison_effect" applied to them with a parameter of 5. The trap
cannot be armed by players but does not disarm when triggered.

trap armed

Whether the trap is armed. This call bypasses the trap's rearmable/disarms configuration, it also ensures that the trap on the other side of the door is updated to the same state automatically.

The param is an integer (1 or 0), where the value 1 specifies that the trap is armed, 0 that it is disabled.

e.g.
modify_exit( "east", ({ "trap armed", 1 }) );
—> The trap on the east door is now armed.

add trap skill

Add a skill requirement for disabling the trap. The basic trap uses the covert.lockpick.traps skill and the difficulty supplied as one of the "setup trap" setting values. This call is optional but allows for creators to design traps that use different skills. The first skill to be added with this call overrides the default covert.lockpick.traps skill and the difficulty value supplied to "setup trap" for disabling the lock. For backward compatibility the "setup trap difficulty" is left unaltered, considered separate and used to determine trap's probe difficulty. Multiple skill requirements can be assigned for a single trap, 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 disable the trap. 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 trap skill",
({ "magic.methods.mental.charming", "charming", 250 })
}) );
—> magic.methods.mental.charming replaces covert.lockpick.traps as the
skill required for disabling the trap on the east door. The
player will need a bonus of 250 or more in the skill to succeed.

trap tool

Define a tool for disabling the trap. A basic trap requires a lockpick to disable it. This call is optional but allows for creators to design traps 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 disable the trap 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 disabling the trap, 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 disabling 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", ({ "trap tool",
({ this_object(), "func", "lit torch", 0, 50 })
}) );
—> Overrides the requirement for a lockpick for disabling the trap on
the east door. Instead a lit torch can be used, it is optional but
provides the player with 50 bonus on their attempt to disable the
trap.

Function signature :-
/* Any logic can be used to determine what constitues a valid tool.
* In this example a "lit torch", a lightable torch has "torch" set as
* the name, and "lit torch" as the short string when lit. 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_name() == "torch" &&
poss->query_short() == "lit torch")
ret += ({ poss });
}
return ret;
}

remove trap

Remove the currently defined trap from the door. This call will make no attempt to remove traps from the other side of the door.

The param is either the integer 0 which specifies that all trap configuration be removed and any trap disarmed, or a string ("pick" or "trap") specifying that only traps triggered the same way should have their base configuration removed. I'd recommend always using 0 to avoid any unexpected trap state.

e.g.
modify_exit( "east", ({ "remove trap", 0 }) );
—> deletes all trap configuration from the east door and disables
any traps. Effectively this deletes any trap that was present.

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