SectorDamage

From ZDoom Wiki
Jump to: navigation, search

void SectorDamage (int tag, int amount, str type, str protection_item, int flags)

Usage

Does the damage only when the function is called, and damages everything in the tagged sector.

type can be either a built-in damage type or any further custom-defined type.

Flags

The following flags are supported for this function and can be combined using the logical or operator | :

DAMAGE_PLAYERS
Players in the sector are damaged.
DAMAGE_NONPLAYERS
Shootable non-players in the sector are damaged.
DAMAGE_IN_AIR
Damage actors in the air as well as those on the ground or in the water.
DAMAGE_SUBCLASSES_PROTECT
If an actor is carrying an item derived from the specified protection item, they will be immune to damage. Otherwise, they are only offered protection if they have that exact kind of item.

At a minimum, you must specify DAMAGE_PLAYERS and/or DAMAGE_NONPLAYERS, or nothing will actually receive damage.

Examples

This example kills non-player actors who enter the sector where this script is run. Assign it to run from an Actor Enters Sector thing placed in the sector with the matching tag.

script 1 (int tag)
{
  if (PlayerNumber() < 0)
  {
    PrintBold(s:"Kill the non-players!!!");
    Sector_SetFade(tag, 255, 0, 0);
    
    while (GetActorProperty(0, APROP_Health) > 0)
    {
      SectorDamage(tag, 100, "Fire", 0, DAMAGE_NONPLAYERS | DAMAGE_IN_AIR);
      delay(5);
    }
    
    Sector_SetFade(tag, 0, 0, 0);
  }
}
Personal tools
Namespaces

Variants
Actions
Navigation
ACS
DECORATE
ZDoom mods
Toolbox