Classes:HealthPickup

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.
Health pickup
Actor type Internal Game MiniZDoomLogoIcon.png
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
}