HealThing

From ZDoom Wiki
Jump to navigation Jump to search

248:HealThing (amount, max)

Usage

Gives health to the actor that activated the special.

Parameters

  • amount: the amount by which to heal.
  • max: the maximum value the actor's health can reach when healed.

If max is 0 or the actor to heal is a non-player, GiveBody is called to handle the healing, with the specified amount passed to it while leaving GiveBody's max parameter's value as the default.

If max is greater than 0 and the actor to heal is a player, amount is added to the actor's health with no modifications to it; if max is 1, the actor is healed up to the maximum set by the soulsphere, which is 200 (this maximum value could be changed via DeHackEd). Otherwise, if it is greater than 1, the actor is healed up to that value.


Error.gif
Warning: do not use negative amounts if max is greater than 0. While negative amounts are acceptable for use with the call to GiveBody, if max is greater than 0, HealThing uses those negative amounts as they are, thus reducing the actor's health. HealThing does not kill the actor if it reduces its health to 0 or less, and instead, leaves it in a broken state.


Examples

This new berserk powerup uses HealThing to heal the player to full health.

class NewBerserk : Berserk
{
    States
    {
    Pickup:
        TNT1 A 0 A_GiveInventory("PowerStrength");
        TNT1 A 0 HealThing(100);
        TNT1 A 0 A_SelectWeapon("KoolFist");
        Stop;
    } 
}

External links