Trap
In NetHack, traps are mechanisms on a space which may activate when you or a monster steps on them. Traps can be detected through various methods, and certain types of traps can be disarmed with the #untrap command.
Contents
List of traps
The following traps are activated by stepping on their square:
- anti-magic field
- arrow trap
- bear trap
- dart trap
- fire trap
- hole
- falling rock trap
- land mine
- level teleporter
- magic portal†
- magic trap
- pit
- polymorph trap
- rolling boulder trap
- rust trap
- sleeping gas trap
- spiked pit
- squeaky board
- statue trap
- teleportation trap
- trap door
- vibrating square†
- web
†: The vibrating square and magic portal are internally represented as traps, even though they are meant to aid the player instead of causing peril.
The following traps are activated by interacting with certain items or doors:
Generation
In both filler levels and most special levels, a "random" trap is selected uniformly from the whole set of eligible traps, subject to level difficulty checks and some exclusions.[1] Oddly, special levels that contain maze filler (the Castle, Asmodeus, Baalzebub, Orcus, and all real and fake Wizard's Tower levels, but not the Big Room or the Catacombs) use a completely separate formula that ignores level difficulty for selecting traps in the mazes.[2] It nonetheless ends up working much the same way overall, but actually makes fire traps less common than they would otherwise be in Gehennom on those levels.
The following information pertains to an upcoming version (NetHack 3.7.0). If this version is now released, please verify that the information below is still accurate, then update the page to incorporate it.
While hallucinating, traps may appear on the map and in messages as random or nonexistent trap types, though any messages resulting from triggering the trap are unchanged.Fake bones
Certain types of traps up to dungeon level 4 may have a pre-aged corpse generated on top, along with random cursed weapons, tools, food or gems. These are often referred to as fake bones, based on their similarity to bones files.
Arrow traps, dart traps, falling rock traps, and rolling boulder traps have a 1 − Dlvl − 14 chance of a corpse and items being placed on its square, i.e. this will always be the case with such traps on the first floor.[3] There will always be at least one possession, and there is a 1⁄5 chance of placing an additional possession after each one.[4]
Squeaky boards and rust traps never have a corpse because they are non-lethal. Pits and holes also never generate a corpse - any corpses found in pits are usually from generated monsters that fell in, especially if their associated items are present (e.g. finding an orcish helm with a goblin corpse). Magic traps do not have corpses either as a result of not being specified in the relevant code.
The corpse is an elf slightly less than 1⁄15 of the time[5], a dwarf 2⁄15 of the time, an orc 3⁄15 of the time, a gnome 4⁄15 of the time, and a human the remaining 5⁄15 of the time. If the corpse is a gnome, there is a 10% chance that a cursed candle will be placed on the pile.
The following information pertains to an upcoming version (NetHack 3.7.0). If this version is now released, please verify that the information below is still accurate, then update the page to incorporate it.
As of commit 99141b32, magic traps also generate fake bones piles since they generate on early levels and can kill you instantly.
Following commit ec4691a8, if a human corpse is initially selected, there is a 96% chance that a random player monster corpse will be placed instead.Detection
A user has suggested this page be merged with "Portal detection methods"
Avoiding traps in the dungeon takes patience and care. Therefore, the more time-consuming of these methods are only worthwhile when you are especially vulnerable. You can minimize your chances of stepping on a trap by paying close attention to monsters, pets, noises, and terrain. Be wary of the telltale signs of traps such as conspicuous boulders, suspicious corpses, and piles of rocks, darts, or arrows. Traps that you've already discovered will also not be visible under items like these, so it's a good idea to use the trap id command if you need to step onto that square that looks suspicious, even though you may have already been in that area and discovered all traps. By walking only where you have seen pets or monsters safely walk, you can avoid most traps. Remember where you have safely stepped before. Elbereth can cause monsters to flee, possibly uncovering traps as they do. A leashed pet will whine if it is near a trap. Magic resistance and fire resistance can help nullify some of the more dangerous effects of traps.
The search command is a great way to uncover traps without setting them off. #Untrap can be used on doors and containers. You can improve your chances of finding traps if you:
- have high Luck;
- put on or eat a ring of searching;
- put on a pair of lenses;
- wield Excalibur;
- wield the blessed Master Key of Thievery (or uncursed, if you are a Rogue) without gloves;
- play a role that gets intrinsic searching
- Ranger: Level 1
- Monk: Level 9
- Rogue: Level 10
- Archeologist: Level 10
- Tourist: Level 10
Some items can be useful in detecting traps, although they may have better uses elsewhere:
- scroll of gold detection (read while cursed or confused)
- crystal ball (scry for ^ with high intelligence)
- wand of secret door detection
- spellbook of detect unseen
- The Bell of Opening
Removal
Because of technical limitations in the level format, only one trap can exist on any given square. If you aren't able to #untrap a physical trap, or if the trap is non-physical, you can usually remove most traps by entering the square and digging a pit. This will overwrite the existing trap in the level data, replacing it with a pit trap. You can then leave the pit and avoid it, or fill it by pushing a boulder in. The downside to this strategy is that you must expose yourself to the trap by entering its space.
The following information pertains to an upcoming version (NetHack 3.7.0). If this version is now released, please verify that the information below is still accurate, then update the page to incorporate it.
When you destroy any magical trap (teleportation trap, level teleporter, magic trap, antimagic field, or polymorph trap) by digging on it, or by zapping it with a wand of cancellation or spell of cancellation, you cause a magical explosion that hits the 3x3 area around the trap for 20 + 3d6 damage.History
The "fake bones" found on early traps are introduced in NetHack 3.6.1.
Variants
UnNetHack
FIQHack
Lenses in FIQHack provide automatic searching, making them useful for detecting traps.
xNetHack
In xNetHack, you are asked for confirmation when stepping onto a square with a trap you have already found (and are not clearly immune to). This eliminates the problem of accidentally walking onto traps that you can't see, without needing to use the trap id command at every step. xNetHack also changes the effects of many traps.
References
- ↑ src/mklev.c in NetHack 3.6.6, line 1271
- ↑ src/sp_lev.c in NetHack 3.6.6, line 829
- ↑ src/mklev.c in NetHack 3.6.7, line 1415
- ↑ src/mklev.c in NetHack 3.6.7, line 1487
- ↑ mklev.c in NetHack 3.6.7, line 1498: If an elf corpse is selected for a sleeping gas trap on levels 3-4, it is switched to a human corpse.