CountProximity

From ZDoom Wiki
Jump to navigation Jump to search

int CountProximity (str classname, float distance [, int flags [, int ptr]])

Usage

Behaves similarly to A_CheckProximity but returns a number of actors found instead of jumping. Performs a check to see if an actor of type classname is within distance. 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.

Parameters

  • 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.
  • 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.

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.
  • CPXF_CHECKSIGHT: Restricts actor counting to only those which can be seen.
  • 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.

Note: CPXF_EXACT and CPXF_LESSOREQUAL do nothing with this function and should not be used.

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 contributions are greatly appreciated.