Classes:MaxHealth

From ZDoom Wiki
Jump to navigation Jump to 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 will 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.
Maximum health
Actor type Internal Game MiniZDoomLogoIcon.png (ZDoom)
DoomEd Number None Class Name MaxHealth


Classes: InventoryHealthMaxHealth

A MaxHealth increases the maximum health of an actor by way of adding to its maximum health points gain. Only player-based actors, however, can have their maximum health increased by items of this class. It also retains its parent class's functionality of increasing current health.

MaxHealth is never used directly. This class is only used as a base class for items defined in DECORATE or ZScript.

Usage

Max health items support the same properties as health items. The following properties have extra functionality, in addition to that of the health items:

  • Inventory.Amount value
Sets the amount of maximum health points gain this item gives when picked up.
  • Inventory.MaxAmount value
Sets the maximum amount of maximum health points gain that can be reached by picking up this item. If the current maximum health points gain is at this value or above, picking up this item will have no effect on it, though the item could still be picked up to increase current health.

Examples

In addition to increasing current health, this item increases the player's maximum health by 1 point. The maximum health points gain that can be reached with this item is 200.

class VitalityBonus : MaxHealth
{
    Default
    {
        Inventory.Amount 1;
        Inventory.MaxAmount 200;
        Inventory.PickupMessage "Picked up a vitality bonus.";

        +COUNTITEM
        +INVENTORY.ALWAYSPICKUP
    }

    States
    {
    Spawn:
        BON1 ABCDCB 6;
        Loop;
    }
}