Classes:PuzzleItem

From ZDoom Wiki

Jump to: navigation, search
Puzzle item
Actor type Internal Game
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"
}
Personal tools