Alright, I thought about it, and here's the best I could come up with:
Let's say it's a fireball spell.
You make a trigger specifically checking for that spell, it sets a variable to, anything. (Event: a unit casts an ability, ability = firebal, set var = 1, set var = target unit of ability being cast)
Then you have another trigger, this one is:
Event: a unit is attacked
Condition: variable = on/true/1 whatever, and variable2 = unit
Actions: Then you can do all that distance from attacking unit or damage source/speed of projectile and reset both variables.
Would that work (I haven't tested so I don't know for sure)?
If the A unit is attacked doesn't work, you can use WE Unlimited's Any Unit Takes Damage.
Also, I guess you'd have to add in there more variables, like who was the target of the fireball spell.
You could just use a chain lightning spell you know? Instant projectile. No time lapse?