Lol using jass for this? You are kidding me
I made a spell that works almost like that yesterday, but with multiply units.
First you move the dummy and let it explode when it a unit.
For the stun time you can use a timer, lets say the arrow got a maximal fly time of 2 seconds. And you want a 5sec maximum stun then you pause the timer when it explode.
Then you check how long the timer ran, and multiply the amount of the timer with 2.
And if the timer is 2.5 seconds then its a 5 second stun. If its only 1sec long then it is 2 seconds stun.
Also you need to set the ability level to the amount of time passed.
Set level of ability for unit to <Timertime> x 2
Also i never played the newest versions of dota. I know only a 1 year old Bversion i played once and the original roc. And no i wont play it because it roxxors or something like that.
Or if you dont like this method, you will need a custom stun system. You will add the special effect and pause the unit for the duration of time passed.
Iam not in the mood doing the math for this. And i just woke up~