It has been a while since I've even been on here, much less coded in this language, but I believe mq2melee should enforce facing the target. if not you could create a holyshit that forces facing a target and checking for line of sight and distance from target to be below a certain threshhold. That would use ${Target.LineOfSight} and ${Target.Distance} the ! is the not operator, so
/if (!${Target.LineOfSight}) /face
also
/if (${Target.Distance} < 5 || ${Target.Distance} > 13) /stick 10
While I did code the start of an automation script for the game, it has been over a year. However, both of these make sense logically, the syntax may be off.