Set position to nearest enemy

Hi guys, Im experimenting with the script provided by Skullbunny on the following thread

Im trying to modify it so instead of tracking to the nearest enemy I set an object to copy the nearest enemy’s position. (For a targeting reticule). With track to you can use…


However I cant seem to use…


Im pretty useless at coding so I probably missed something obvious, I would appreciate it greatly if anyone could help me out. Thanks in advance.

requires nearestEnemy to be a string with the name of an object

enemyObj = GameLogic.getCurrentScene().getObjectList()["OB"+nearestEnemy]

Thanks a lot Monster, works great.