A lot of improvements could be done about this.
First of all it makes no sense that only projectiles stun people.
It should happen when taking damage from both melee and ranged and it should be based on damage dealt.
Secondly, why not make the target become slowed down instead of stunned?
And again, how much and for how long you are slowed down should be based on damage received.