The effect will close and lock chests and doors. If the door or the lock is broken, it will be repaired. If the doorway has no door at all, a door will be created. (If there is something in the doorway, the spell will not work.) Drawbridges will be closed.
|A trapdoor appears beneath you.||You were aware of the hole and are not blind. The wand will be identified as a wand of locking.|
|Some dust swirls beneath you.||You were not aware of the trap or you are currently blind.|
|Some frost swirls beneath you.||You were not aware of the trap, which was on an ice square.|
You can use wizard lock to lock a door if you do not have a key or lock pick. However, given the frequency of keys and lock picks, this is not a common use, since it needs a charge or 10 Power (keys and lock picks are free) and is more effort to use than applying a key. The main advantages of wizard lock over a locking tool are that you need not be adjacent to the door to use it, and that it works on empty doorways and open doors in addition to closed doors. This makes it an action faster in the best case, and considerably faster in the worst case, because sometimes intelligent monsters will open doors before a locking tool can lock them. As such, wizard lock is particularly appropriate when you are being chased, most likely in the early game or on the Astral Plane, as it is guaranteed to close and lock a door in one turn, whereas doing so manually requires at least two (and often more, as you may fail to close or lock the door in one turn). Monsters rarely carry keys, so an immediately locked door is usually safe; shopkeepers, however, have keys, and riders and enemies with particularly high strength can bypass locked doors.
If you have a wand of locking and a wand of opening, you could theoretically smash a number of monsters in a drawbridge by zapping them alternately. However, you could only do this a few times before the charges run out, and so this is not a common strategy. It would be slightly more doable if you had the spell versions, knock and wizard lock, but it would still cost 15 Power for each open and close, and clearing the castle this way can sometimes take nearly a hundred turns (that's 1500 power).
If you need to remove a trapdoor and don't have a boulder handy to fill it, you can use this spell to remove it, provided that you have levitation, flying, or a lot of patience to step on it repeatedly until you escape it. Note that this does not work for holes, so it cannot be used to close holes that monsters have created by zapping wands of digging downwards.
Locking chests is useless in terms of protecting the items inside (monsters do not open boxes), but the ability to repair the lock could be useful in unusual situations. Prior to NetHack 3.6.0, if a box contains an unidentified gray stone, you might wish to destroy the box without taking out the stone, so that you can kick it to see if it is a loadstone. You can attempt to destroy the box by #forcing it with a blunt weapon; if this fails to destroy the chest, you can use wizard lock to repair the lock and try again. (NetHack 3.6.0 introduces the tip command, which safely removes the stone and makes this strategy obsolete.) Additionally, a locked chest or box can be used to contain a troll corpse and prevent it from reviving; if the only box you have nearby has a broken lock, you can use wizard lock to lock it in.
If a monster has damaged the walls of your stash, you can use wizard lock to fill them in with doors and give yourself a bit more shelter.
Any single object can prevent a door from forming or closing. If you want to use wizard lock to create a door on a certain square, then you need to remove any objects from there. This is mostly an issue if you want to lock a door after slaying some monster there, and the monster dropped something. If the monster dropped a heavy corpse or a loadstone, then you might not be capable of clearing the square manually, although a wand of teleportation or the teleport away spell can potentially vacate objects from the doorway.
Monsters that can pass locked doors
Other than xorns, most of these monsters are slow, so you should still be able to flee them. You might consider fighting one, knowing that the other monsters remain stuck behind the door.
- (zap.c, line 2710) Zapping downwards at a hole.