CheckProximity: Difference between revisions
From Eternity Wiki
Jump to navigationJump to search
(Created page with "'''ACS function''' ''boolean'' '''CheckProximity'''(''int tid'', ''str classname'', ''fixed distance''[, ''limit''[, ''flags'']]) Counts the actors of type ''classname'' clo...") |
No edit summary |
||
(3 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
{{ACSFunction|description=Counts the actors of type ''classname'' close to a tagged thing, returning TRUE if they're more (or less, depending on ''flags'') than a given ''limit''. It can also have the side effects (if ''flags'' set this way) to change a monster's target, among other things. | |||
|usage=''boolean'' '''CheckProximity'''(''int tid'', ''str classname'', ''fixed distance''[, ''limit''[, ''flags'']]) | |||
|parameters= | |||
Counts the actors of type ''classname'' close to a tagged thing, returning TRUE if they're more (or less, depending on ''flags'') than a given ''limit''. It can also have the side effects (if ''flags'' set this way) to change a monster's target, among other things. | |||
*''tid'': [[TID]] of thing to check proximity of actors against. Only works for one tagged thing. | *''tid'': [[TID]] of thing to check proximity of actors against. Only works for one tagged thing. | ||
*''classname'': class of actors to look for near the tagged thing. Supports both [[EDF]] names and ZDoom compatibility names. | *''classname'': class of actors to look for near the tagged thing. Supports both [[EDF]] names and ZDoom compatibility names. | ||
Line 11: | Line 7: | ||
*''limit'': number of actors to compare against. Without any specific flags, this function will return true if number is >= ''limit''. Default: 1 | *''limit'': number of actors to compare against. Without any specific flags, this function will return true if number is >= ''limit''. Default: 1 | ||
*''flags'': various flags. Default: none. NOTE: anything available in "zdefs.acs" but not mentioned here is unimplemented. The flags are: | *''flags'': various flags. Default: none. NOTE: anything available in "zdefs.acs" but not mentioned here is unimplemented. The flags are: | ||
:*'''CPXF_LESSOREQUAL''' or 2: function returns true if number of nearby actors is <= ''limit'. | :*'''CPXF_ANCESTOR''' or 1: count actor if ''classname'' belongs to one of its thingtype ancestors (using the '''inherits''' or colon syntax in the [[EDF]] thingtype). | ||
:*'''CPXF_LESSOREQUAL''' or 2: function returns true if number of nearby actors is <= ''limit''. | |||
:*'''CPXF_NOZ''' or 4: do not calculate altitude difference between actors and tagged thing. By default, Z contributes to the distance. | :*'''CPXF_NOZ''' or 4: do not calculate altitude difference between actors and tagged thing. By default, Z contributes to the distance. | ||
:*'''CPXF_COUNTDEAD''' or 8: also count dead actors. By default they're skipped. | :*'''CPXF_COUNTDEAD''' or 8: also count dead actors. By default they're skipped. | ||
Line 20: | Line 17: | ||
:*'''CPXF_FARTHEST''' or 512: if setting target or tracer, pick the farthest actor found in ''distance'' range. | :*'''CPXF_FARTHEST''' or 512: if setting target or tracer, pick the farthest actor found in ''distance'' range. | ||
:*'''CPXF_CLOSEST''' or 1024: if setting target or tracer, pick the closest actor found in ''distance'' range. | :*'''CPXF_CLOSEST''' or 1024: if setting target or tracer, pick the closest actor found in ''distance'' range. | ||
:*'''CPXF_CHECKSIGHT''' or 4096: only pick | :*'''CPXF_CHECKSIGHT''' or 4096: only pick actors to which a line of sight from tagged thing exists. | ||
Returns TRUE if the conditions have been met. | |||
[[ | |seealso= | ||
*[[CheckSight]] | |||
|id=<code>-98:CheckProximity(3, 6)</code>}} |
Latest revision as of 11:51, 21 November 2020
Description[edit]
This is an ACS built-in function.
Counts the actors of type classname close to a tagged thing, returning TRUE if they're more (or less, depending on flags) than a given limit. It can also have the side effects (if flags set this way) to change a monster's target, among other things.
Usage[edit]
boolean CheckProximity(int tid, str classname, fixed distance[, limit[, flags]])
Parameters[edit]
- tid: TID of thing to check proximity of actors against. Only works for one tagged thing.
- classname: class of actors to look for near the tagged thing. Supports both EDF names and ZDoom compatibility names.
- distance: maximum distance (in fixed point) actors must be to tagged thing.
- limit: number of actors to compare against. Without any specific flags, this function will return true if number is >= limit. Default: 1
- flags: various flags. Default: none. NOTE: anything available in "zdefs.acs" but not mentioned here is unimplemented. The flags are:
- CPXF_ANCESTOR or 1: count actor if classname belongs to one of its thingtype ancestors (using the inherits or colon syntax in the EDF thingtype).
- CPXF_LESSOREQUAL or 2: function returns true if number of nearby actors is <= limit.
- CPXF_NOZ or 4: do not calculate altitude difference between actors and tagged thing. By default, Z contributes to the distance.
- CPXF_COUNTDEAD or 8: also count dead actors. By default they're skipped.
- CPXF_DEADONLY or 16: only count dead actors.
- CPXF_EXACT or 32: function returns true only if number of nearby actors is exactly limit.
- CPXF_SETTARGET or 64: add the side effect of changing tagged thing's "target" (monster's enemy or projectile's originator) to one of the encountered actors. Combine this with CPXF_FARTHEST or CPXF_SLOWEST to pick a well-defined target. Otherwise it will prefer an arbitrary (but not random) one.
- CPXF_SETTRACER or 256: add the side effect of changing tagged thing's "tracer" (seeker missile destination or MBF friend leader) to one of the encountered actors. Combine with same flags as for CPXF_SETTARGET.
- CPXF_FARTHEST or 512: if setting target or tracer, pick the farthest actor found in distance range.
- CPXF_CLOSEST or 1024: if setting target or tracer, pick the closest actor found in distance range.
- CPXF_CHECKSIGHT or 4096: only pick actors to which a line of sight from tagged thing exists.
Returns TRUE if the conditions have been met.
Return value[edit]
Examples[edit]
No examples given.
Notes[edit]
No particular notes.
This function's identification in zspecial.acs
is: -98:CheckProximity(3, 6)
.