a script so you can Select some thing (lock on)

ok im working on an rpg and i want to make my right mouse key able to select an enemy by this i mean

the magic casted will only hit that target (lock on ) and all the sword cuts and fist will it that target as well hits

could some one give me an idea of how to achieve this

Angry ant covered this in a post awhile back.

http://eej.dk/angryant/general/tipsandtricks/pick-me-pick-me/

In your code that locks onto the target you could set its tag to a tag named selected then check if the object hit by the spell is taged with selected if so then hit the target else skip over it.