A_CheckProximity

From ZDoom Wiki
Jump to: navigation, search

state A_CheckProximity (str jump, str classname, float distance [, int count [, int flags [, int ptr]]])

Note: Jump functions perform differently inside of anonymous functions.

Usage

Performs a check to see if an actor of type classname is within distance, and checks to see the population within distance is greater or equal to count. These conditions can be modified with flags and will count any actor, as long as it is the same classname. Can be performed based upon the actor's pointer as well. For use in ACS, see CheckProximity.

Parameters

  • jump: The state to jump to when the number of actor classname is found.
  • classname: The name of the actor to check for.
  • distance: Determines how far this function should search for the actors, similar to A_JumpIfCloser. Must be greater than 0.
  • count: The number of actors the function must find within distance in order to jump. Default is 1.
  • flags: Can be combined using the '|' separator. Default is 0.
    • CPXF_ANCESTOR: Search the inheritance of an actor, if it has any, for a partial match akin to CheckClass.
    • CPXF_NOZ: Disables Z height checking -- the function will only care about the actor being in range for X and Y coordinates, regardless of how high or low an actor is.
  • CPXF_CHECKSIGHT: Restricts actor counting to only those which can be seen.

Only one of the two following may be used due to mutual exclusion:

  • CPXF_COUNTDEAD: By default, the function only counts living actors. This causes the function to also accept dead ones. This only makes sense for monsters.
  • CPXF_DEADONLY: Inverses the function to only count dead monsters instead of living ones.

Only one of the two following may be used due to mutual exclusion:

  • CPXF_LESSOREQUAL: The function will jump if it finds the number of actors equivalent to number or less, instead of greater.
  • CPXF_EXACT: The function will only jump if the exact number is found defined by count.

Specifying one of the following flags makes the jump state optional to define, allowing a blank state "" to be used:

  • CPXF_SETTARGET: Sets the first actor matching classname as the calling actor's target.
  • CPXF_SETMASTER: Sets the first actor matching classname as the calling actor's master.
  • CPXF_SETTRACER: Sets the first actor matching classname as the calling actor's tracer.

The following flags rely on using one of the SET* flags above:

  • CPXF_FARTHEST: The actor gets the furthest classname actor within distance from the pointer's location.
  • CPXF_CLOSEST: The actor gets the closest classname actor within distance to the pointer's location.
  • CPXF_SETONPTR: The pointer exchange is set on the calling actor's pointer instead of itself.
  • ptr: The actor pointer to do the checking around. The jump is only performed by the original calling actor, however. Default is AAPTR_DEFAULT.

Examples

Nuvolachalk.png Note: This article lists no examples. If you make use of this feature in your own project(s) or know of any basic examples that could be shared, please add them. This will make it easier to understand for future authors seeking assistance. Your contibutions are greatly appreciated.