A_CheckRange

From ZDoom Wiki
Jump to: navigation, search

state A_CheckRange (float distance, int offset [, bool 2d_check])
state A_CheckRange (float distance, str "state" [, bool 2d_check])

Note: Jump functions perform differently inside of anonymous functions.

Jumps if the calling actor is beyond distance range from all player pawns. If 2d_check is true, the z-coordinates are not taken into account when calculating the distance, making the distance check 2D-based instead of being 3D-based. Default is false.

Examples

This lost soul will be follow you then miss less than 100 map units:

Actor CleverLostSoul4ZDoomWiki: LostSoul replaces LostSoul
{
  Translation "64:79=32:47", "128:143=37:47", "144:151=43:47"
  Health 50
  States
  {
  Missile:
    SKUL C 10 Bright A_FaceTarget
    SKUL D 4 Bright A_SkullAttack
    SKUL CD 4 Bright A_CheckRange( 100, "AttackCorrection", True )
    Goto Missile + 2
  AttackCorrection:
    SKUL D 4 Bright A_SkullAttack
    Goto Missile + 2
  }
}

See also