User Tools

Site Tools


4rpl:commands:nearestspecialtarget

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
Last revisionBoth sides next revision
4rpl:commands:nearestspecialtarget [2021/02/14 18:05] – created virgilw4rpl:commands:nearestspecialtarget [2024/01/12 23:22] – [Description] Forward note for spores, blobs, etc. Vertu
Line 7: Line 7:
  
 ===== Description ===== ===== Description =====
-Finds the nearest unit that is tagged as a special target within range (a float) from worldPosition (a vector3). The 'specialTarget' argument should be 1 through 4. 1 is for units that snipers target, is for units that missile launchers target3 and 4 are for 4rpl use.+Finds the nearest unit that is tagged as a special target within range (a float) from worldPosition (a vector3). The 'specialTarget' argument is a V4 that specifies the target types. See [[GetUnitSpecialTarget]]. 
 + 
 +If no unit matching the special target parameter is found-1 is returned. 
 + 
 +:NOTE: For clarification: Line Of Sight is not factored. If you want to use this API with LOS restrictions, see [[4rpl:commands:getterrainlos|GetTerrainLOS]].\\ 
 +:WARNING: Spores, Blobs, etc, aren't special targets and will not be detected.
                          
 ===== Examples ===== ===== Examples =====
 <code 4rpl> <code 4rpl>
-GetNearestSpecialTarget(GetUnitPosition(self) GetUnitRange(self) false) ->unit+GetNearestSpecialTarget(V4(1 1 0 0) GetUnitPosition(self) GetUnitRange(self) false) ->unit
 </code> </code>
  
 <=[[4rpl:start| Index]] <=[[4rpl:start| Index]]