Difference between revisions of "Findnearactor"

From EDukeWiki
Jump to navigation Jump to search
Line 1: Line 1:
'''findnearactor''' <[[actor]]> <distance> <[[gamevar]]>
+
'''findnearactor''' <[[tile number]]> <distance> <[[gamevar]]><br>
 +
'''findnearactorvar''' <[[tile number]]> <distancevar> <[[gamevar]]><br>
 +
'''findnearactorz''' <[[tile number]]> <xydistance> <zdistance> <[[gamevar]]><br>
 +
'''findnearactorzvar''' <[[tile number]]> <xydistancevar> <zdistancevar> <[[gamevar]]><br>
 +
'''findnearactor3d''' <[[tile number]]> <distance> <[[gamevar]]><br>
 +
'''findnearactor3dvar''' <[[tile number]]> <distancevar> <[[gamevar]]><br>
 +
'''findnearsprite''' <[[tile number]]> <distance> <[[gamevar]]><br>
 +
'''findnearspritevar''' <[[tile number]]> <distancevar> <[[gamevar]]><br>
 +
'''findnearspritez''' <[[tile number]]> <xydistance> <zdistance> <[[gamevar]]><br>
 +
'''findnearspritezvar''' <[[tile number]]> <xydistancevar> <zdistancevar> <[[gamevar]]><br>
 +
'''findnearsprite3d''' <[[tile number]]> <distance> <[[gamevar]]><br>
 +
'''findnearsprite3dvar''' <[[tile number]]> <distancevar> <[[gamevar]]>
  
Gets the actor ID of the closest <[[actor]]> within <distance> into a <[[gamevar]]>.  If no actor within range is found, the [[gamevar]] is set to -1.  The input for <[[actor]]> may be its tile number (example: 2000) or its defined name (example: PIGCOP).  The <distance> will be determined on the x and y plane only; for finding actors on the x, y, and z axes use [[findnearactor3d]] instead.
+
These commands get the sprite ID of the closest <[[tile number]]> within <distance> into a <[[gamevar]]>.  If no sprite within range is found, the [[gamevar]] is set to -1.  The input for <[[tile number]]> may be its tile number (example: 2000) or its defined label (example: PIGCOP).
  
 
By getting the actor ID of a nearby actor, the current actor can use [[getactor]]/[[setactor]] to edit the properties of the target actor or [[getangle]] to face the target actor, among other potential uses.
 
By getting the actor ID of a nearby actor, the current actor can use [[getactor]]/[[setactor]] to edit the properties of the target actor or [[getangle]] to face the target actor, among other potential uses.
  
For non-actor sprites or asleep actors, use [[findnearsprite]].
+
The ''actor'' finding commands work on a subset of sprites: currently awake, valid actors.  The ''sprite'' finding commands work on a superset of actors: all sprites, including non-actor sprites or sleeping actors.
 +
 
 +
The normal finding commands limit distance on the x and y plane only.  If you were to visualize its range, it would be an infinitely tall/deep vertical cylinder, with a radius of <distance>.  The "z" commands work within a finite cylinder, with a radius of <xydistance> and a height of 2 times <zdistance>.  The "3d" commands work within a sphere, with a radius of <distance>.
 +
 
 +
Commands with a "var" suffix take [[gamevar]]s rather than constants for their distance value(s).
 +
 
 
[[Category:EDuke commands]]
 
[[Category:EDuke commands]]
 
[[Category:Sprite manipulation]]
 
[[Category:Sprite manipulation]]

Revision as of 21:24, 7 January 2011

findnearactor <tile number> <distance> <gamevar>
findnearactorvar <tile number> <distancevar> <gamevar>
findnearactorz <tile number> <xydistance> <zdistance> <gamevar>
findnearactorzvar <tile number> <xydistancevar> <zdistancevar> <gamevar>
findnearactor3d <tile number> <distance> <gamevar>
findnearactor3dvar <tile number> <distancevar> <gamevar>
findnearsprite <tile number> <distance> <gamevar>
findnearspritevar <tile number> <distancevar> <gamevar>
findnearspritez <tile number> <xydistance> <zdistance> <gamevar>
findnearspritezvar <tile number> <xydistancevar> <zdistancevar> <gamevar>
findnearsprite3d <tile number> <distance> <gamevar>
findnearsprite3dvar <tile number> <distancevar> <gamevar>

These commands get the sprite ID of the closest <tile number> within <distance> into a <gamevar>. If no sprite within range is found, the gamevar is set to -1. The input for <tile number> may be its tile number (example: 2000) or its defined label (example: PIGCOP).

By getting the actor ID of a nearby actor, the current actor can use getactor/setactor to edit the properties of the target actor or getangle to face the target actor, among other potential uses.

The actor finding commands work on a subset of sprites: currently awake, valid actors. The sprite finding commands work on a superset of actors: all sprites, including non-actor sprites or sleeping actors.

The normal finding commands limit distance on the x and y plane only. If you were to visualize its range, it would be an infinitely tall/deep vertical cylinder, with a radius of <distance>. The "z" commands work within a finite cylinder, with a radius of <xydistance> and a height of 2 times <zdistance>. The "3d" commands work within a sphere, with a radius of <distance>.

Commands with a "var" suffix take gamevars rather than constants for their distance value(s).