A_JumpIfMasterCloser

From ZDoom Wiki
Jump to: navigation, search

state A_JumpIfMasterCloser (int distance, int offset [, bool noz])
state A_JumpIfMasterCloser (int distance, str "state" [, bool noz])

Note: Jump functions perform differently inside of anonymous functions.

Usage

Jumps the given offset forward or to the given state if the distance to the master is lower than the given value.

Note: This function does not take into account the radius of either actor, so it's possible that either one wide actor or both being wide can prevent the jump from ever occurring. It's important that a blocking actor takes their own radius into account through means such as A_JumpIfMasterCloser(radius + distance, "label") to help avoid such occurrences.

Parameters

  • distance - The distance an actor's master must be in order to jump. Distance is in units, similar to to the radius of A_Explode.
  • offset/state - The offset number of frames to jump forward, or the state label to jump to.
  • noz - If true, the function disables vertical distance checking. The default is false, which includes comparing the distance between how high the calling actor is to the master.

Examples

If this ZombieMan's master is away from him, the zombieman will forget it.

actor TraitorZombieman : ZombieMan
{
    States
    {
    See:
      POSS A 0 A_JumpIfMasterCloser(1024, 2)
      POSS A 0 A_RearrangePointers(AAPTR_DEFAULT, AAPTR_NULL, AAPTR_DEFAULT)
      POSS AABBCCDD 4 A_Chase
      Loop
    }
}