Classes:Key

From ZDoom Wiki
Jump to: navigation, search
Note: Wait! Stop! Before you copy this actor's definition into your mod, remember the following things:
  1. You do not need to copy that actor, since it is already defined.
  2. In fact, it's not just useless, it's actually harmful as it can cause problems.
  3. If you want to modify it, or use a modified version, using inheritance is the way to go.
  4. The actor definitions here are put on the wiki for reference purpose only. Learn from them, don't copy them.
  5. There is only one exception: if what you want is changing Ammo capacity, you need to create a new type from Ammo.
Key
Actor type Internal Game MiniZDoomLogoIcon.png
DoomEd Number None Class Name Key


Classes: InventoryKey
 →DoomKey
 →HereticKey
 →HexenKey
 →StrifeKey

Keys are items that are used to open locked doors. The base class Key is never used directly. It is always the base class for predefined items (like Doom's Red Keycard) or for items defined in DECORATE.


Using in DECORATE

Keys use some of the basic Inventory properties but it is impossible to carry more than one of each key at any time. Therefore the amount settings don't have any function.

If the Species property is set to an existing key, the new key will work locks in the same way as the old one. For example, setting the key's species to RedCard will allow it to open locks as if it were a red keycard.

Keys don't define any properties of their own. If you want to define entirely new keys, you must use the LOCKDEFS lump to assign them to locks.


Examples:

actor SilverKey : Key 10280
{
  inventory.pickupmessage "Picked up the silver key."
  inventory.icon "SLVKA0"
  states
  {
  Spawn:
    SLVK A -1
    stop
  }
}
actor GoldKey : Key 10281
{
  inventory.pickupmessage "Picked up the gold key."
  inventory.icon "GLDKA0"
  states
  {
  Spawn:
    GLDK A -1
    stop
  }
}
actor BronzeKey : Key 10282
{
  inventory.pickupmessage "Picked up the bronze key."
  inventory.icon "BRNKA0"
  states
  {
  Spawn:
    BRNK A -1
    stop
  }
}

DECORATE definition

ACTOR Key : Inventory native
{
  +DONTGIB
  +INVENTORY.INTERHUBSTRIP
  Inventory.PickupSound "misc/k_pkup"
}