User Tools

Site Tools


prpl:getnearesttarget

Differences

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

Link to this comparison view

Next revision
Previous revision
prpl:getnearesttarget [2016/12/02 18:34] – external edit 127.0.0.1prpl:getnearesttarget [2018/07/06 16:06] (current) – Changed OnlyShip argument kajacx
Line 1: Line 1:
 <- [[.:prplreference| PRPL reference]] <- [[.:prplreference#everything_else_2|Everything Else 2]] <- [[.:prplreference| PRPL reference]] <- [[.:prplreference#everything_else_2|Everything Else 2]]
  
-=====  GETNEARESTTARGET  =====+=====  GetNearestTarget  =====
  
 ^Arguments^Result^Notation^ ^Arguments^Result^Notation^
-| | | [ - ] |+X Y Range Enemy Untargeted NotNormal NotVirtual OnlyShip Target | [ int int float bool bool bool bool bool PID ] |
  
  
 === Description === === Description ===
 +Finds the nearest target to the specified cell. If no target is found within Range cells, returns -1. If Enemy is true, returns something red, else something blue. If Untargeted is true, does not target something that a built-in unit is shooting at. If NotNormal is true, does not return ordinary particles. If NotVirtual is true, doesn't return virtual particles (Emergent, Omnis, ship hull...). OnlyShip is self-explanatory, only virtual hull particles will be found, works on both player controlled ships and allied blue ships if Enemy is FALSE.
 +
 +Returned target will be a PID.
  
 === Examples === === Examples ===
-<code> i8 = GetIntFromStack(); //onlyEnemyShip  +<code> 
- i7 = GetIntFromStack(); //excludeVirtual  +#Locate any targetable blue "thing" within 40 cells (default energy mine range) of this Core 
- i6 = GetIntFromStack(); //excludeNormal  +CurrentCoords 40 0 0 0 0 0 GetNearestTarget ->Target
- i5 = GetIntFromStack(); // bool for find untargeted particle  +
- i4 = GetIntFromStack(); // bool for enemy  +
- i3 = GetIntFromStack(); // range in cells  +
- i2 = GetIntFromStack(); // cell y  +
- i1 = GetIntFromStack(); // cell x  +
- stack.Push(new Data(pb.UID));  +
- } else {  +
- stack.Push(new Data(-1));  +
-  +
-</code>+
  
 +"Nearest blue target: " <-Target concat SetText #Show
 +</code>
prpl/getnearesttarget.1480721644.txt.gz · Last modified: 2017/07/21 20:41 (external edit)