AI lua scripts can call ai_nearestEntity and the engine will push two X,Y positions if they exists. Otherwise the script will receive nil values.