Classes:PuzzleItem

From ZDoom Wiki
Revision as of 18:38, 12 June 2022 by Inkoalawetrust (talk | contribs) (Puzzle items now have a third property.)
Jump to navigation Jump to search
Note: Wait! Stop! You do not need to copy this actor's code into your project! Here's why:
  1. This actor is already defined in GZDoom, there's no reason to define it again.
  2. In fact, trying to define an actor with the same name will cause an error (because it already exists).
  3. If you want to make your own version of this actor, use inheritance.
  4. Definitions for existing actors are put on the wiki for reference purpose only.
Puzzle item
Actor type Internal Game MiniZDoomLogoIcon.png (ZDoom)
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 three 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.
  • PuzzleItem.FailSound sound
Sound to be played when the item is used, but is not the one requested by UsePuzzleItem. Default is the player class specific *puzzfail sound.

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"
}