Using a New Key

A tutorial for G/ZDoom

Depending on the complexity of a map, it would be a great asset to have one or more new keys, over the six existing keys, available. Here I will describe how to set up a new key. While any new key could have whatever name with up to 8 characters long, I will stick to the already established naming convention.

To be able to use the new key in-game, four or five different items must be established:

  1. the new INVENTORY image lump
  2. the new SPRITE image lumps,
    placed between S_START and S_END markers
  3. a DECORATE lump
  4. a LOCKDEFS lump
  5. optionally an ACS scripts lump

Using this method up to 255 keys can be created.


For the purpose of this tutorial, the new key will be a green card key. For the new key image I just recoloured the existing yellow key using Paint.Net

existing INVENTORY keysnew INVENTORY key
STKEYS0 - BLUE card keySTKEYS6 - GREEN card key
STKEYS1 - YELLOW card key
STKEYS2 - RED card key
STKEYS3 - BLUE skull key
STKEYS4 - YELLOW skull key
STKEYS5 - RED skull key

existing SPRITE imagesnew SPRITE images
BKEYA0 and BKEYB0 - BLUE card key GKEYA0 and GKEYB0 - GREEN card key
YKEYA0 and YKEYB0 - YELLOW card key
RKEYA0 and RKEYB0 - RED card key
BSKUA0 and BSKUB0 - BLUE skull key
YSKUA0 and YSKUB0 - YELLOW skull key
RSKUA0 and RSKUB0 - RED skull key

the DECORATE lump

the LOCKDEFS lump

One could open a door with the new key by attaching a lock type line special to the door linedef, but a much better way is the use of SCRIPTS. At first, using scripts may seem more complex but it really is just using the line specials in a text file instead of attaching them to linedefs.

the example pwad

If one wants to use a specific font, as I have done in the example, then the message in the LOCKDEFS lump cannot be used. The reason being, the message will not be displayed in the specified font but the regular font. Therefore the message must be incorporated into the script.

the SCRIPTS lump

Happy fragging.
Kappes Buur, March 21, 2016