Classes:PuzzleItem

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.
Puzzle item
Actor type Internal Game MiniZDoomLogoIcon.png
DoomEd Number None Class Name PuzzleItem


Classes: InventoryPuzzleItem
 →PuzzBook1
 →PuzzBook2
 →PuzzCWeapon
 →PuzzFlameMask
 →PuzzFWeapon
 →PuzzGear1
 →PuzzGear2
 →PuzzGear3
 →PuzzGear4
 →PuzzGemBig
 →PuzzGemBlue1
 →PuzzGemBlue2
 →PuzzGemGreen1
 →PuzzGemGreen2
 →PuzzGemRed
 →PuzzMWeapon
 →PuzzSkull

PuzzleItems are special inventory items that don't have any function themselves. They can be used with the UsePuzzleItem special to trigger special actions that depend on the presence of these items in a player's inventory. Essentially they act like keys that get removed once they have been used. The base class PuzzleItem is never used directly. It is always the base class for predefined items (like Hexen's Clock gears or for items defined in DECORATE).


Using in DECORATE

PuzzleItems use the basic Inventory properties to define their behavior as inventory items. In addition they define two additional properties:

  • PuzzleItem.Number value
Defines the number that has to be used with UsePuzzleItem to identify the item.
  • PuzzleItem.FailMessage string
Message to be displayed when this item is used and not the one requested by UsePuzzleItem.

Examples:

actor PigHead : PuzzleItem 19018
{
  puzzleitem.number 17
  inventory.pickupmessage "A Pig's head"
  inventory.defmaxamount
  inventory.icon "PIGHEAD"
  states
  {
  Spawn: 
    PHED A -1
    stop
  }
}

DECORATE definition

ACTOR PuzzleItem : Inventory native 
{
  +NOGRAVITY
  +INVENTORY.INVBAR
  Inventory.DefMaxAmount
  Inventory.UseSound "PuzzleSuccess"
  Inventory.PickupSound "misc/i_pkup"
}