A_JumpIfHealthLower

From ZDoom Wiki
Jump to navigation Jump to search

state A_JumpIfHealthLower (int health, int offset [, int pointer])
state A_JumpIfHealthLower (int health, str "state" [, int pointer])

Note: Jump functions perform differently inside of anonymous functions.

Usage

Jumps offset amount of states forward, or to the state label state, if the health of the calling actor (or calling actor's pointer) is lower than the given value.

The default value for pointer is AAPTR_DEFAULT, which corresponds to the caller itself.

Examples

This script would cause a boss monster to switch its mode of attack when it reaches 5000 health

  States
  {
  Missile:
     POSS E 2 A_FaceTarget
     POSS E 2 A_JumpIfHealthLower(5000, "LowHealthAttack")
     POSS F 2 A_PosAttack
     Goto See
  LowHealthAttack:
     POSS E 2 A_CPosAttack
     Goto See
  }