Container

From NetHackWiki
Revision as of 18:34, 1 August 2024 by Thidwick (talk | contribs) (Generation: reorder -- group the bags)
Jump to navigation Jump to search

A container is a type of tool that appears in NetHack, and is designed for the purpose of storing and removing items.

List of containers

The following items are considered containers:

Although the bag of tricks is defined with the CONTAINER macro in objects.c and appears as a bag while unidentified, it cannot actually store items.[1] Statues can hold items, and floor squares and ice squares can contain items buried within - while treated somewhat similar to containers in the code, these are not considered container tools.

Generation

Containers created via normal generation (i.e. outside of bones files or trap "bones") are always uncursed and may contain the following quantities of items:[2]

Container Contents Lockable
sack 0–1 items No
bag of holding 0–1 items No
oilskin sack 0–1 items No
large box 0–5 items Yes
chest 0–7 items Yes
ice box 0–20 corpses No

Containers that can be locked have a 45 chance of generating as locked, and a separate 110 chance of generating with a container trap.[3]

Containers in the hero's starting inventory will always be empty. Otherwise, for containers other than the ice box, each of the items in randomly generated containers are created with the following probabilities:[4]

Type Probability
gem or stone 18%
comestible 15%
potion 18%
scroll 18%
spellbook 12%
gold 7%
wand 6%
ring 5%
amulet 1%

There are some special cases for the contents of containers:[5]

  • Gold is increased to 2.5x its normal amount.
  • Gems will not include rocks.
  • A bag of holding will not contain an object that would explode it.

Description

Containers can store an unlimited number of items. Containers on the ground can be opened with the #loot extended command, which is used to view a container's contents and add and/or remove items, including stashing a singular item (or stack of items); they can also be emptied with the #tip command, which will dump the contents onto the ground at the character's square. A container in the character's inventory is used by applying it, which works the same as looting, and can also be tipped to deposit its contents on the ground. Tipping a container while levitating will cause fragile items to break.

Large boxes and chests can be locked, requiring an unlocking tool, the wand of opening, or the spell of knock in order to open, and may also have a container trap hidden on them, which will trigger if the box is opened, locked, unlocked, or else the character fails an untrap attempt. It is possible to force a locked container and break the lock open, though this comes with risks: Forcing the lock with a bladed weapon exercises dexterity, but risks breaking that weapon unless it is cursed, while forcing the lock with a blunt weapon exercises strength, but may destroy the container and possibly some or all of its contents. Kicking a locked container can break open the lock, but can also destroy items inside the container, particularly fragile ones. A broken lock can be repaired with the wand of locking, the wand of opening, the spell of wizard lock, or the spell of knock.[6]

The contents of containers are generally protected from being affected by fire, cold, shock, or cancellation: magical containers (i.e. the bag of holding) also protect their contents from being destroyed if the container is kicked, thrown, dropped down stairs, or dropped while levitating. Water will wet the contents of sacks and bags of holding; applying grease to these containers protects against wetting until it wears off. Lava will destroy any container that touches it outright and burn up any flammable contents that spill out, unless the container is an ice box or is fireproof[7] - containers cannot be fireproofed directly, though polymorphing an erosion-proofed tool can produce a fireproof container.[8]

If a container is polymorphed, its contents are lost regardless of what the resulting item is.

There are limitations to what can be placed in a container:

  • Unique items cannot ever be placed into containers.
  • Large boxes, ice boxes, and chests are too big to fit into any other container.
  • Placing certain items in a bag of holding will cause it to explode and destroy any items within - see the article on the bag of holding for specific details.

Some monsters can pick up containers, but most will not attempt to access their contents, with one notable exception: a gelatinous cube that engulfs a container made of an organic material (i.e. all except the ice box) will eat the container, destroying it and harmlessly engulfing the contents regardless of whether it would eat those items normally. A character polymorphed into a gelatinous cube can only eat these containers if they are empty.

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.

Monsters can make use of containers, and will use unlocking tools to open locked containers.

Strategy

Randomly generated containers are typically used as stash locations, and common places for stashes often include a guaranteed container or two, such as the Quest home level and the Castle - the latter even provides a cursed scroll of scare monster to deter monsters with.

Many characters carry two bags: a primary bag of holding with much of their stuff and a secondary bag, not a bag of holding, with items such as a wand of cancellation, some holy water, a blessed scroll of remove curse, and a scroll of scare monster. In an emergency, the character can #tip the secondary bag and spill the scroll of scare monster directly onto the floor in one action.

History

The ice box first appears in Hack 1.0, while all other containers are introduced in NetHack 3.0.0.

In NetHack 3.2.0 and previous versions, including some variants based on those versions, a popular technique for identifying worthless glass was called "kickboxing". Players would gather a large pile of gems, name all of them "fake red" or whatever color, dump them in a box, and then repeatedly kick the box until they were all broken, then retrieve the remaining gems and un-name them, informally identifying worthless glass of all colors. Starting in NetHack 3.2.0, worthless glass no longer breaks, so kickboxing no longer works.

The ability to #tip containers is added in NetHack 3.6.0 - some variants based on NetHack 3.4.3 and earlier versions may not include this feature.

Messages

You hear a muffled shatter.
You kicked or threw a container, or dropped it from a significant height, and broke at least one item inside it.
You hear a muffled cracking.
As above, and at least one egg inside was destroyed.
That would be an interesting topological exercise.
You attempted to place a container inside itself.

Variants

Some variants of NetHack add new containers, while others may change how certain containers function - a common quality-of-life addition is to allow identifying the beatitude of a container's contents by dropping it on an altar. The magic chest is also a common addition to many variants, with each one implementing it differently (e.g. it may be an item or a dungeon feature). Other common changes include giving monsters the ability to utilize containers like a player character can, as well as enabling a bag of tricks to carry items under certain circumstances.

Variants that implement object materials may alter a container's properties based on its material.

SLASH'EM

SLASH'EM adds the medical kit, a container that can only hold pills, bandages and phials and cannot be refilled - the medical kit must be looted from the ground in order to view its contents, and applying one will instead take a random pill from the kit and consume it.

SporkHack

SporkHack introduces a maximum carrying capacity for containers, with the default being 1000 aum; large boxes can carry 3000 aum worth of items, while ice boxes, chests and bags of holding have unlimited carrying capacity. SporkHack also adds a couple of new containers:

  • Iron safe, which has unlimited carrying capacity and can only be locked and unlocked by magic or stethoscope
  • small sack, which has only 200 aum of carrying capacity

The bag of poo is an object that is defined as a container but cannot be used to store items, similar to the bag of tricks.

UnNetHack

UnNetHack adds the iron safe from SporkHack, and makes the bag of tricks usable as a container once it runs out of charges.

AceHack

In AceHack, placing a container on an altar identifies the beatitude of the container and its contents. Monsters are also capable of looting containers, can carry items in bags, and will take out items from their container to use.

dNetHack

dNetHack, notdNetHack and notnotdNetHack add three new containers:

The massive stone crates that replace the boulders in Sokoban combine the properties of a container and a boulder (as they are filled with food), but cannot be used as a proper container.

Placing a container on an altar identifies the beatitude of the container and its contents.

Maids that pick up lockable containers with broken locks will mend them.

DynaHack

DynaHack includes the iron safe from SporkHack, and adds the magic chest as a dungeon feature that is generated at fixed points in the dungeon and shares its contents across each magic chest.

NetHack Fourk

NetHack Fourk adds the magic chest as a dungeon feature that contains randomized items suited to a character's current role - magic chests can be created in any location by reading a scroll of consecration while confused.

FIQHack

In FIQHack, monsters are capable of looting containers and will carry and use items in bags. The Castle chest is special-cased to prevent monsters from stealing the guaranteed wand of wishing.

FIQHack also adds the magic chest as an item that behaves like a dungeon feature similar to DynaHack and Nethack Fourk: they cannot be picked up, teleported, polymorphed, etc. Minetown, Sokoban, the Castle, Orcus-town, and the Quest home level all have magic chests, and magic chests can be created by wishing for one.

TNNT (the game)

TNNT (the game) adds the swap chest, a magic container that enables players to exchange objects between games.

xNetHack

In xNetHack, monsters are capable of looting containers and will carry and use items in bags, and placing a container on an altar identifies the beatitude of the container and its contents.

SpliceHack

In SpliceHack, the bag of rats is defined as a container but cannot actually be used as one, similar to the bag of tricks.

EvilHack

EvilHack includes the iron safe from SporkHack, and magic chests are implemented as dungeon feature-like objects similar to DynaHack, and are generated at fixed locations in the dungeon - there are also special magic keys that are required to lock and unlock the chest. EvilHack also adds the crystal chest, a type of container that can only be unlocked or locked through magical means and is immune to other forms of magic.

Monsters are capable of looting containers and will carry and use items in bags, and placing a container on an altar identifies the beatitude of the container and its contents.

Many containers can be made of various materials, and can be made erosion-proof by wielding one and reading a non-cursed scroll of enchant weapon while confused.

SlashTHEM

In addition to SLASH'EM details, SlashTHEM adds two new containers:

Hack'EM

Hack'EM includes the medical kit from SLASH'EM, the iron safe from SporkHack, and the crystal chest from EvilHack, and allows the bag of tricks and bag of rats to be used as containers when out of charges. Monsters are capable of looting containers and will carry and use items in bags, and placing a container on an altar identifies the beatitude of the container and its contents.

References