Findnearactor: Difference between revisions
mNo edit summary |
Helixhorned (talk | contribs) Fix findnear* semantics. If they returned the closest sprite, there would be no point having the <distance> argument. |
||
(16 intermediate revisions by 10 users not shown) | |||
Line 1: | Line 1: | ||
findnearactor <[[ | '''findnearactor''' <[[tile number]]> <distance> <[[gamevar]]><br> | ||
'''findnearactorvar''' <[[tile number]]> <distance> <[[gamevar]]><br> | |||
'''findnearactorz''' <[[tile number]]> <xydistance> <zdistance> <[[gamevar]]><br> | |||
'''findnearactorzvar''' <[[tile number]]> <xydistance> <zdistance> <[[gamevar]]><br> | |||
'''findnearactor3d''' <[[tile number]]> <distance> <[[gamevar]]><br> | |||
'''findnearactor3dvar''' <[[tile number]]> <distance> <[[gamevar]]><br> | |||
'''findnearsprite''' <[[tile number]]> <distance> <[[gamevar]]><br> | |||
'''findnearspritevar''' <[[tile number]]> <distance> <[[gamevar]]><br> | |||
'''findnearspritez''' <[[tile number]]> <xydistance> <zdistance> <[[gamevar]]><br> | |||
'''findnearspritezvar''' <[[tile number]]> <xydistance> <zdistance> <[[gamevar]]><br> | |||
'''findnearsprite3d''' <[[tile number]]> <distance> <[[gamevar]]><br> | |||
'''findnearsprite3dvar''' <[[tile number]]> <distance> <[[gamevar]]> | |||
These commands get the sprite ID of ''one'' <[[tile number]]> with distance strictly less than <distance> into a <[[gamevar]]>. Note that this does not have to be the ''closest'' such <[[tile number]]>. 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]] to | 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 extending <zdistance> both above and below. The "3d" commands work within a sphere, with a radius of <distance>. | |||
{{varsuffix}} | |||
[[Category:EDuke commands]] | |||
[[Category:Sprite manipulation]] |
Latest revision as of 04:55, 17 February 2013
findnearactor <tile number> <distance> <gamevar>
findnearactorvar <tile number> <distance> <gamevar>
findnearactorz <tile number> <xydistance> <zdistance> <gamevar>
findnearactorzvar <tile number> <xydistance> <zdistance> <gamevar>
findnearactor3d <tile number> <distance> <gamevar>
findnearactor3dvar <tile number> <distance> <gamevar>
findnearsprite <tile number> <distance> <gamevar>
findnearspritevar <tile number> <distance> <gamevar>
findnearspritez <tile number> <xydistance> <zdistance> <gamevar>
findnearspritezvar <tile number> <xydistance> <zdistance> <gamevar>
findnearsprite3d <tile number> <distance> <gamevar>
findnearsprite3dvar <tile number> <distance> <gamevar>
These commands get the sprite ID of one <tile number> with distance strictly less than <distance> into a <gamevar>. Note that this does not have to be the closest such <tile number>. 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 extending <zdistance> both above and below. The "3d" commands work within a sphere, with a radius of <distance>.
Commands with an additional "var" suffix take gamevars rather than constants or defined labels for their inputs. As an alternate short form, "varvar" can be dropped from these commands; for example ife serves an an alias for ifvarvare.