I thought I'd make use of "find nearest enemy ship: distance=x, class=y" (custom command from LUV) to find a nearest enemy instead of doing a separate scan for each race but it seems that it may not work when based from a station.
I also tried some alternatives for finding enemies. I copied my lines below. Only enemy 2 and enemy 4 return a value.
Does anyone know what range the "find nearest enemy ship in range: class=z" scans within when based from a station? If it's a static number and it's a high enough range I'm thinking maybe that will be okay. Otherwise, it probably won't be *too* bad of a performance loss to just use the find ship command twice (for player/OCV) because it only needs to check that when traders are required for a station which isn't very often at all.
Thanks.
Code: Select all
* test: only enemy 2 and 4 return OCV OX
$Enemy=[THIS]->find nearest enemy ship: distance=40000, class=[Moveable Ship]
$Enemy2= find ship: sector=[SECTOR] class or type=[Moveable Ship] race=[OCV] flags=[Find.Nearest] refobj=[THIS] maxdist=40000 maxnum=1 refpos=null
$Enemy3=[THIS]->find nearest enemy ship: max.dist=40000
$Enemy4=[THIS]->find nearest enemy ship in range: class=[Moveable Ship]