Classes:HealthPickup

From ZDoom Wiki
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.
Health pickup
Actor type Internal Game MiniZDoomLogoIcon.png (ZDoom)
DoomEd Number None Class Name HealthPickup


Classes: InventoryHealthPickup
 →ArtiHealth
 →ArtiSuperHealth
 →MedicalKit
 →MedPatch
 →SurgeryKit

HealthPickups are items that are placed in the inventory and give some health when activated. The base class HealthPickup is never used directly. It is always the base class for predefined items (like Heretic's Quartz Flask or for items defined in DECORATE.

The maximum amount of health that can be given with a HealthPickup is the current default maximum health which normally is 100.


Using in DECORATE

HealthPickups use the basic Inventory properties to define their behavior as inventory items. The only new information they require is the amount of health they give. For this they use the standard health actor property.

Additional properties
  • HealthPickup.AutoUse value
Determines whether (and how) the item is set to be automatically used when the player's health drops below a certain point.
The following values are accepted:
0 - Item will never be auto-used.
1 - Item will be automatically used when the player would die from damage taken, but only if the currently-selected skill level has the "autousehealth" flag set. (Like the Quartz Flask from Heretic/Hexen)
2 - Item will be automatically used when the player would die from damage taken, but only if the currently-selected skill level has the "autousehealth" flag set or during a deathmatch game. (Like the Mystic Urn from Heretic/Hexen)
3 - Item is auto-used when the player drops below 50% health; if the player has more than 1 such item, they will continue to be consumed until the player is over 50% health. However, if damage takes the player below 0% health, this will not save them from death. (Like Strife's small health items).

Examples

actor MedKit : HealthPickup 7012
{
  health 25
  inventory.maxamount 15
  inventory.icon "I_MDKT"
  inventory.pickupmessage "You picked up the Medkit."
  +COUNTITEM
  states
  {
  Spawn:
    MEDK A -1
    stop
  }
}
actor MedPatch : HealthPickup 2011
{
  health 10
  HealthPickup.Autouse 3
  Inventory.MaxAmount 20
  Inventory.Icon "I_STMP"
  Inventory.PickupMessage "You picked up the Med patch."
  States
  {
  Spawn:
    STMP A -1
    Stop
  }
}

DECORATE definition

ACTOR HealthPickup : Inventory native 
{
  Inventory.DefMaxAmount
  +INVENTORY.INVBAR
}