This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| prpl:getnearesttarget [2016/12/02 23:34] – external edit 127.0.0.1 | prpl:getnearesttarget [2025/02/14 14:57] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| <- [[.: | <- [[.: | ||
| - | ===== | + | ===== |
| ^Arguments^Result^Notation^ | ^Arguments^Result^Notation^ | ||
| - | | | | [ - ] | | + | | X Y Range Enemy Untargeted NotNormal NotVirtual OnlyShip |
| === 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' | ||
| + | |||
| + | Returned target will be a PID. | ||
| === Examples === | === Examples === | ||
| - | < | + | < |
| - | i7 = GetIntFromStack(); // | + | #Locate any targetable blue " |
| - | i6 = GetIntFromStack(); | + | CurrentCoords 40 0 0 0 0 0 GetNearestTarget |
| - | i5 = GetIntFromStack(); | + | |
| - | i4 = GetIntFromStack(); | + | |
| - | i3 = GetIntFromStack(); | + | |
| - | i2 = GetIntFromStack(); // cell y | + | |
| - | i1 = GetIntFromStack(); | + | |
| - | stack.Push(new Data(pb.UID)); | + | |
| - | } else { | + | |
| - | stack.Push(new Data(-1)); | + | |
| - | + | ||
| - | </code> | + | |
| + | " | ||
| + | </ | ||