Classes:Health

From ZDoom Wiki
Revision as of 06:23, 29 November 2019 by Blue Shadow (talk | contribs) (added info about MaxAmount and the maximum health points gain)
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
Actor type Internal Game MiniZDoomLogoIcon.png (ZDoom)
DoomEd Number None Class Name Health


Classes: InventoryHealth
 →CrystalVial
 →HealthBonus
 →Medikit
 →MegasphereHealth
 →Soulsphere
 →Stimpack

A Health item adds a certain amount to the player's health points. Items of this type are always effective when picked up. They cannot be placed in the inventory; to have health items in inventory, use HealthPickup. Health is never used directly. This class is only used as a base class for predefined items (like Doom's Stimpack or for items defined in DECORATE.


Using in DECORATE

Health items support all the basic Inventory properties. However, they use a few of them differently:

  • Inventory.Amount value
Sets the amount of health this item gives when picked up.
  • Inventory.MaxAmount value
Sets the maximum amount of health you can get with this item. If this is greater than 0, the maximum health points gain is added to this to determine the final maximum amount.

In addition they define one new property:

  • Health.LowMessage value, message
When pickupper's health is lower than value, the pickup message is set to message.

Examples:

ACTOR Whiskey : Health 10715
{
  Inventory.PickupMessage "You drank some booze."
  Inventory.Amount 5
  Inventory.MaxAmount 200
  +COUNTITEM
  States
  {
  Spawn:
    RWHI A -1
    Stop
  }
}
ACTOR DogFood : Health 10575
{
  Inventory.PickupMessage "Ate some dog food. Woof!"
  Inventory.PickupSound "dog/sight"
  Inventory.Amount 4
  Inventory.MaxAmount 200
  +COUNTITEM
  +INVENTORY.ALWAYSPICKUP
  States
  {
  Spawn:
    AWI1 A -1
    Stop
  }
}

COUNTITEM flag means that counts toward item percentage.

DECORATE definition

ACTOR Health : Inventory native
{
  Inventory.Amount 1
  Inventory.MaxAmount 0
  Inventory.PickupSound "misc/health_pkup"
}