Just about anything is possible, it's more so a matter of figuring out how to do it.
That being said, I attached a map containing a Lock On spell I threw together which I think you'll like.
How it works:
1) When you cast Lock On I order a Dummy unit to cast Wand of Illusion on the Hero, creating an illusion that deals full damage. The Dummy also casts a Debuff ability called Lock On on the target of the ability.
2) I then immediately make this Illusion invisible/unselectable by changing it's size and transparency as well as adding the Locust ability to it.
3) Then I turn on a timer that runs every 0.03 seconds, constantly moving the illusion to the position of the Hero.
4) I have another trigger that forces the Illusion to only attack the Lock On target.
5) The Hero can't attack during this time because I disarm it by adding the Cargo Hold (Orc Burrow) ability to it.
6) After 6 seconds I end the spell, destroying the illusion and enabling the ability to attack again by removing Cargo Hold from our Hero.
This is all made possible using a Unit Indexer, a great system to have for GUI mapmaking. Multiple units can use this spell as well. The only catch is that the cooldown of the ability MUST be greater than or equal to the duration of the spell. So if it lasts 10 seconds, the cooldown must be at least 10 seconds.
If you wanted to change the duration of the spell, you would need to increase the 6.00 second Wait in the Lock On trigger as well as the duration of the Lock On Debuff (it's based on Slow) in the Object Editor.
There are some other limitations due to the fact that it's an Illusion doing the attacking and not your Hero, but I think it's still pretty good. If you use a Damage Engine in your map then you can change the source of the damage from the Illusion to your Hero so that covers issues like who kills are credited to when an enemy unit dies. You could also modify this trigger to use a Hero copy of your Hero, like a new unit based on your Hero, but it would require extra work as you'd need to copy over the items and hero level as well.