AFAIK, the NPC has to really be in combat to do damage, otherwise the NPC's you see sparring in various places would all be dead.
One way might be to use a script to determine if there is an actor within the correct range and direction, and use the StartCombat command... but this is likely to be a messy with attacking NPC running around, blocking and shouting "I've fought mudcrabs more fearsome than you!" and other friendly greetings.
Another way might be to directly damage the target to simulate getting hit. You could do this by moving a small, initially disabled trigger zone directly in front of the swinging NPC, and enable it at the peak of every swing, disabling it again one frame later.
Both ideas will need a fair bit of scripting and testing though.