A_CheckRange

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's attack will redirect if it is further than 100 mapunits from its target.

Actor CleverLostSoul4ZDoomWiki: LostSoul replaces LostSoul
{
  States
  {
  Missile:
    SKUL C 10 Bright A_FaceTarget
    SKUL D 4 Bright A_SkullAttack
  CheckRangeState:
    SKUL CD 4 Bright A_CheckRange( 100, "AttackCorrection", True )
    loop
  AttackCorrection:
    SKUL D 4 Bright A_SkullAttack
    goto CheckRangeState
  }
}

See also

This article is issued from Zdoom. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.