Area Awareness Functions
From HEWIKI
(Redirected from Technical:Area Awareness)
Area Awareness Functions are server-side functions which can be called in a script to learn what player nodes are around a given area. The functions return a list of type noderef, which will include all visible player or character nodes within the defined area.
Other types of assets (waypoints, landscape, etc.) are not targeted in the search.
Contents |
Arguments
name | data type | description |
playerSensitive |
boolean | indicates whether players are included in the list of returned nodes |
npcSensitive |
boolean | Indicates whether non-playing characters are included in the list of returned nodes |
boxCenter |
vector3 | The center of the box, in worldspace units |
boxWidth, boxDepth, boxHeight |
float | the dimensions of the box around the center, in worldspace units |
sphereCenter |
vector3 | the center of a sphere, in worldspace units |
sphereRadius |
float | the radius of the sphere, in worldspace units |
sphereInnerRadius, sphereOuterRadius |
float | the inside and outside radii of an annulus (like a hollow ball, only different) |
cylBase |
vector3 | the center of the base of the cylinder |
cylRadius |
float | the radius of the cylinder, in worldspace units |
cylInnerRadius, cylOuterRadius |
float | the inside and outside radii of an annulus (like a doughnut, only different) |
cylDirection |
vector3 | a vector describing the direction the cylinder "goes" (see Vector Directions) |
cylDistance |
float | the height of the cylinder, if the direction were "up" |
coneBase |
vector3 | the 'point' of the cone (shaped like an ice-cream cone) |
coneAngularWidthDegrees |
float | the angle at which the cone "opens out" away from the base. Valid between 0 and 180, exclusive. |
coneDirection |
vector3 | a vector describing the direction the cone "goes" (see Vector Directions) |
coneDistance |
float | the height of the cone, if the direction were "up" |
Function Syntax
All of these functions take a set of parameters, the first two of which are booleans which indicate whether the searched volume is to be player-sensitive,NPC-sensitive, or both. The remaining parameters define the volume.
GetTargetsInBox(playerSensitive as boolean, npcSensitive as boolean, boxCenter as vector3, boxWidth as float, boxHeight as float, boxDepth as float) as list of type noderef GetTargetsInSphere(playerSensitive as boolean, npcSensitive as boolean, sphereCenter as vector3, sphereRadius as float) as list of type noderef GetTargetsInSphericalAnnulus(playerSensitive as boolean, npcSensitive as boolean, sphereCenter as vector3, sphereOuterRadius as float, sphereInnerRadius as float) as list of type noderef GetTargetsInCylinder(playerSensitive as boolean, npcSensitive as boolean, cylBase as vector3, cylRadius as float, cylDirection as Vector3, cylDistance as float) as list of type noderef GetTargetsInCylindricalAnnulus(playerSensitive as boolean, npcSensitive as boolean, cylBase as vector3, cylOuterRadius as float, cylInnerRadius as float, cylDirection as vector3, cylDistance as float) as list of type noderef GetTargetsInCone(playerSensitive as boolean, npcSensitive as boolean, coneBase as vector3, coneAngularWidthDegrees as float, coneDirection as vector3, coneDistance as float) as list of type noderef
Example
// The following would return a list of all pc's (and no npc's) within a 2x2x2 radius box at 0,0,0 location pc as boolean = TRUE npc as boolean = FALSE targets as list of noderef origin as vector3 = (0, 0, 0) width as float = 2.0 height as float = 2.0 depth as float = 2.0 targets = GetTargetsInBox(pc, npc, origin, width, height, depth)