Wizard mode

From NetHackWiki
Revision as of 03:04, 30 July 2021 by Agulp (talk | contribs) (Note that in wizard mode, special levels with <100% chance of appearing will always appear. Important to know when testing dungeon generation.)
Jump to navigation Jump to search

In NetHack, wizard mode is a debug mode in which the player may try out anything they might want to test. Games played in wizard mode do not contribute in the record file but do appear in the logfile.

Entering wizard mode

Public servers

Public servers in general restrict wizard mode access to their administrators, among other reasons to prevent users from creating custom bones levels to the benefit or detriment of other users.

Windows

To get to the wizard mode, you must start the game with the command nethack -D -u wizard. The -D stands for debug and -u name names you wizard, which must be done to enter the wizard mode.

In Windows, for the sake of convenience, you can create a shortcut to wizard mode, so you don't have to access the DOS prompt to enter the above command every time. Right click on the NetHack icon and choose "create shortcut". Right click on the shortcut and choose "properties". In the "Target" text box, type the following, including quotes:

  • "<file path and file name>" -D -u wizard

For example, it may look like this:

  • "C:\Program Files\NetHack\nethack-343-win\NetHackW.exe" -D -u wizard

Unix

On UNIX-based systems, the ability to enter wizard mode is typically restricted to specific user accounts. This means that there isn't a standard way to invoke it which works on all systems. Things which may work include:

  • Start the game with nethack -D. This may work, or it may take you into explore mode instead. You will be able to tell as soon as you have restored a file or selected a character. If you are in explore mode the game gives the message "You are in non-scoring explore/discovery mode." If you are in wizard mode it gives no such message.
  • Edit a system-wide configuration file (/usr/games/lib/nethackdir/sysconf by default), and then start as above. Adding a username to the WIZARDS line would allow that user to access wizard mode with nethack -D: WIZARDS=root youruser. Setting WIZARDS to * would allow any user to access wizard mode, which is fine for a single-user system: WIZARDS=*. Depending on where the game is installed, editing the sysconf file may require root access.
  • Start as root using sudo `which nethack` -D. This may start NetHack, and may get you into wizard mode, albeit at a cost of not using a options you may have set in a .nethackrc file in your home directory. If you run a system used by others, and have NetHack included with support for the shell escape command, granting permission to run NetHack with sudo is extremely dangerous, as it would allow the user to create a shell as root without permission being separately granted, and without sudo (with its password prompt and logging) having to be called at the time the shell was launched.
  • Change the WIZARD_NAME in include/config.h to your own username, then compile NetHack again. This may be rather cumbersome if you did not intend to recompile it beforehand.
  • Run gdb on NetHack using gdb `which nethack`. Some text will scroll by, but you can ignore it for now. Type run and press enter, NetHack should start. Create your character, or restore your save file, just as you would to play normally, then press control-c. NetHack should freeze up if you are using X11, or might disappear completely with the text console version. The terminal you started gdb in will have a prompt. It will replace NetHack in console mode, or it will be in the terminal for X11 NetHack. At the gdb prompt type set main::flags.debug = 1 and press enter, then type cont and press enter. Congratulations, you are now in wizard mode!

macOS

As a Unix system, macOS has proper user accounts, and so you need to create a user named wizard (short name form, not full name). When logged in as that user, you can enter wizard mode by pasting

cd /Applications/NetHack.app/; ./Contents/MacOS/nethack -D

into Terminal.app, which lives in the utilities folder. If you didn't install NetHack into the global applications folder, you will have to adjust the "/Applications/NetHack.app/" part accordingly.

Commands

Wizard mode has several commands that are not present in the normal game:

Key Explanation
ctrl + E detect secret doors and traps
ctrl + F map the current level (even if magic mapping is blocked)
ctrl + G create monster by name or class; specify * for a normal random monster
ctrl + I show identities of items in pack
ctrl + O same as #overview in NetHack 3.6.1, or #wizwhere before
ctrl + T do intra-level teleport
ctrl + V do trans-level teleport
ctrl + W make a wish
ctrl + X show attributes including intrinsic attributes
Extended command Explanation
#levelchange change experience level
#lightsources show mobile light sources
#panic panic test
#polyself polymorph self
#seenv show seen vectors
#stats show memory statistics
#terrain show current level (more options than in normal play)
#timeout look at timeout queue
#vanquished disclose counts of dead monsters sorted in various ways
#vision show vision array
#wizbury buries adjacent objects
#wizdetect reveal hidden things around you (same as ctrl + E)
#wizgenesis create a monster (same as ctrl + G)
#wizidentify show identities of items in pack (same as ctrl + I)
#wizintrinsic give yourself any intrinsic for 30 turns
#wizlevelport teleport to another level (same as ctrl + V)
#wizmakemap recreate the current dungeon level
#wizmap map the current level (same as ctrl + F)
#wizrumorcheck validate first and last rumor for true and false set
#wizsmell smell a monster
#wizwhere show dungeon placement of all special levels
#wizwish make a wish (same as ctrl + W)
#wmode show wall modes

You can view the list of wizard mode commands at any time from the ? menu, provided that you are in wizard mode. In any case the extended command #? shows you a list of all available extended commands.

You can also use some additional environment variables to help you debug: WIZKIT, SHOPTYPE, SPLEVTYPE, and NH_HEAPLOG

Wishing

Wishing has much fewer limits in wizard-mode: you can wish for all traps (except for holes/trap doors on levels with undiggable floor), certain dungeon features (fountains, thrones, sinks, pools, lava, graves, trees and iron bars), artifacts, unique items, exact number of charges or plusses on items that have those, exact number of stackable items and altars with exact alignment (for example, "chaotic altar").

Bones

Whenever you enter a new dungeon level, if a bones file exists for that level, the game will ask you if you want to load that file. Otherwise, it will generate the level normally.

Options

The following additional options are available in wizard mode. All of them are boolean options.

Option Explanation
menu_tab_sep Formats menu entries using TAB to separate columns.
monpolycontrol Prompts for the new form whenever any monster changes shape.
sanity_check Runs more debug checks on monsters, objects, and map before each turn.
travel_debug Shows the pathfinding progression for the travel command.
wizweight Shows the weight of all objects.

Tips

Suppose that you want to try an experiment by fighting a flesh golem with a wand of lightning. Enter wizard mode, then use ctrl + W to ask for a "wand of lightning" or an "uncursed wand of lightning (0:99)". Use ctrl + I to verify the identity of the wand. Then use ctrl + G and request a "flesh golem". You can also use ctrl + T to teleport away from the flesh golem (even on a non-teleport level), since ctrl + G will cause it to spawn next to you.

Want to instead send a tame flesh golem against Vlad? Use ctrl + V and type "?" to get a menu of significant dungeon levels. Choose "tower1", the top of Vlad's Tower. Use ctrl + F to map the level, ctrl + W to wish for a light source, and ctrl + T to teleport to Vlad's throne room. Finally, use ctrl + G and request a "tame flesh golem" to spawn your pet.

Powering your character

A user has suggested improving this page or section as follows:

"Under what circumstances do to-hit, damage etc. bonuses still overflow? I was able to reproduce it in NetHack 3.6.1 with two rings of increase accuracy, but not with one ring and a +127 weapon."

There are some shortcuts to improve your character, so that you can skip straight to whatever you're testing:

  • #levelchange to set your level to whatever is appropriate. This is capped at 30 and doesn't give you the kind of stats that an actual level 30 character would have (extra HP/MP from potions, maxed out stats from exercise, etc)
  • Wish for "15 blessed potion of gain ability" to boost your attributes.
  • Wish for "10 blessed potion of full healing" to boost your maximum HP or "10 blessed potion of gain energy" to boost max Pw.
  • Wish for armor to reduce your AC. You could wish for a typical ascension kit, or if you just want (near) invincibility, over-enchanted items like a blessed fireproof +50 cloak of magic resistance and a blessed +50 silver dragon scale mail.
  • Wish for artifacts.
  • Wish for absurdly overenchanted weapons. A +20 Grayswandir will kill virtually every monster in one hit, and a stack of +50 silver daggers can be used as ridiculously powerful projectiles. Weapons with extremely high enchantments, like +127, will often miss due to integer overflow in the to-hit calculations (specifically, if the total bonus exceeds 127, it will wrap around into the negatives).
  • Intrinsics are hard to gain. The best bet is either the appropriate ring or blessed tins of dragon meat. If you need many intrinsics, you can also wish for an uncursed amulet of magical breathing which will help you eat more corpses. The extended command #wizintrinsic can also be used to gain any intrinsic temporarily, such as monster detection. Wizard mode characters already have free access to controlled teleportation without the intrinsics.
  • Create a tame Rider

If you're doing more than a quick delve in wizard mode, you may want to use the wizkit, which lets you give your character a list of items at the start of the game without having to wish for each one.

Prayer

Even wizard mode wishes will increase your prayer timeout. The wizard mode #pray command lets you "force the gods to be pleased", so this might not be a problem. If you want to make your god happy, you can ctrl + W wish for an altar of your alignment ("lawful altar", "neutral altar" or "chaotic altar"), then wish for "50 Umber hulk (or whatever other monster you please) corpses" and #offer away!

Dealing with chameleons or doppelgangers

If you are playing with #monpolycontrol but annoyed that some offscreen monster is repeatedly polymorphing, then wishing for "2 uncursed scrolls of genocide" and genociding "chameleon" or "doppelganger" will work.

Levelcide

If you read a blessed scroll of genocide and choose "*", every monster on the level will be immediately removed, but no species are genocided. This is useful if you need privacy for complex experiments, or if you are severely overwhelmed by an immense horde. This method removes peaceful and tame monsters, so don't use it if you want to keep alive your pet, the Quest leader, priests, etc. However, the removal of any peaceful or tame monsters has no effect on luck or alignment that you would get from killing peaceful or tame monsters normally.

Special rooms and levels

If you want to test shopkeeper behavior or see a lot of soldiers, use the environment variable SHOPTYPE to guarantee that the appropriate room is generated on every level, so you won't have to hunt for it. (SHOPTYPE=! for a potion shop and SHOPTYPE=s for a barracks)

Use SPLEVTYPE to guarantee that you get, for example, the Catacombs version of Mine's End.

Death

You can die in wizard mode just as in any other game. However, if you do die, you have the option to Die? (yn) and deny death like explore mode. If you do choose to die, and are on an eligible level (including levels that are normally too shallow), you will get the option to Save bones? (yn) as well. If you die by, say, genociding yourself, you will get the prompt as well. The only times this will not work is if you levelport to a negative dungeon level or offer the Amulet of Yendor to Moloch; you can deny death, but you will find yourself on the surface and escape the dungeon.

Other

Wizard-mode games will prompt whether to Unlink bones? when entering a bones level. Answering 'y' will delete the bones file, 'n' will keep it.

If you approach your quest leader without a high enough alignment record to get permission, but your experience level is high enough, you will be given the option to set your alignment record to 20.

Special levels with less than 100% probability of appearing in the dungeon, such as the Big Room, will always appear if there is space available.

SLASH'EM

In SLASH'EM, in general, you can get into wizard mode by passing -uwizard -Z instead.

On Debian/Ubuntu, you need to start Slash'em as root using:

"sudo /usr/games/slashem -uwizard -Z".

Wizard mode in SLASH'EM can be even more broken, thanks to the larger number of objects and artifacts. Some of those can grant powerful extrinsics that would be far harder to obtain in vanilla (but of course, this is wizard mode, it doesn't really matter). For example, if you have a ring of invisibility, a shimmering dragon scale mail, Nighthorn (or an amulet of reflection, though that means you can't have the next one on at the same time), an amulet of magical breathing, and a cloak of magic resistance (the armor and cloak can be both +127 for needlessly overpowered defense), you can become, for all intents and purposes, excruciatingly hard to get at to all but the deadliest monsters, even in SLASH'EM. For extra protection, it is very easy in wizard mode to be crowned ((coaligned altars + unicorn corpses) + (diamonds + coaligned unicorns)).

UnNetHack

After enabling the showdmg option, the amount of damage inflicted will be printed during fight.

See also


This page may need to be updated for the current version of NetHack.

It may contain text specific to NetHack 3.6.1. Information on this page may be out of date.

Editors: After reviewing this page and making necessary edits, please change the {{nethack-361}} tag to the current version's tag or {{noversion}} as appropriate.