Set position to nearest enemy

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

http://blenderartists.org/forum/showthread.php?t=90813&highlight=nearest+object

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…

track.setObject(nearestEnemy)

However I cant seem to use…

own.setPosition(nearestEnemy)

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]
own.setPosition(enemyObj.getPosition())

Thanks a lot Monster, works great.