Target selection programming-HELP

I have been programming for a while and can do most functions, but I need help on this issue.
How do i have an actor target one specific actor when several targets are available.
it would be good to also have other parameters and such, but i can work that in later easy.
I need a script where an actor can select a target (an actor with an "enemy" variable set to true) out of several possible targets,
probably using range as the deciding factor, and use the targets variables (like x, y, velocity's and angles) for the targeting script.
It is probably related to an array of all the x's and y's of the targets and the actor picking the one with the one with the lowest distance, but I have no Idea how to do it!!
SOMEONE HELP ME!!!!!
How do i have an actor target one specific actor when several targets are available.
it would be good to also have other parameters and such, but i can work that in later easy.
I need a script where an actor can select a target (an actor with an "enemy" variable set to true) out of several possible targets,
probably using range as the deciding factor, and use the targets variables (like x, y, velocity's and angles) for the targeting script.
It is probably related to an array of all the x's and y's of the targets and the actor picking the one with the one with the lowest distance, but I have no Idea how to do it!!
SOMEONE HELP ME!!!!!