A_GetHurt

From ZDoom Wiki
Jump to: navigation, search

A_GetHurt

(no parameters)

Usage

Decreases the calling actor's health by 1 with a probability of 20%. If the health goes below 0 the actor dies. Main usage is in Wound state.

Examples

This is a rotting zombie, a zombie that is slowly decomposing and will eventually die. Its See, Missile, and even its Pain states all trigger A_GetHurt, lowering its health, and eventually killing it if the player doesn't first. Its pain sound was removed so that it wouldn't make a noise every time A_GetHurt was triggered successfully.

ACTOR RottingZombie : ZombieMan
{
  PainSound ""
  States
  {
  See:
    POSS AABB 4 A_Chase
    POSS B 0 A_GetHurt
    POSS CCDD 4 A_Chase
    POSS D 0 A_GetHurt
    Loop
  Missile:
    POSS E 10 A_FaceTarget
    POSS F 8 A_PosAttack
    POSS E 8 A_GetHurt
    Goto See
  Pain:
    POSS G 3 A_GetHurt
    POSS G 3 A_Pain
    Goto See
  }
}