Although there is a simpler way, using Speed = Distance / Time method, BUT, this will only work if the target source is not moving at all, therefore you can have a constant time.
That would be simpler but not "Simplest"
. Here i have one [the simplest]:
I'm going to base the example from the DotA spell:
Impetus of Enchantess
Which just need an ability has a buff on impact [Here i call Impetus (from DotA). Auto cast would even better
And some trigger skills, combined with
damage detection system
Upon receiving damage of a unit, check if it has a buff Impetus, then we'll do the damage job. For example you can have this:
-
UnitTakeDamage
-
Events
-
Game - GDD_Event becomes Equal to 0.00
-
Conditions
-
Actions
-
-------- ---------------------- --------
-
Set TempUnit = GDD_DamagedUnit
-
Set TempUnit2 = GDD_DamageSource
-
Set TempReal = GDD_Damage
-
-------- Impetus --------
-
Set TempInt = (Level of Impetus for TempUnit2)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
TempInt Greater than 0
-
(TempUnit has buff Impetus ) Equal to True
-
Then - Actions
-
Unit - Remove Impetus buff from TempUnit
-
Set TempLoc = (Position of TempUnit2)
-
Set TempLoc2 = (Position of TempUnit)
-
Set TempReal = ((Distance between TempLoc and TempLoc2) x (0.04 x (Real(TempInt))))
-
Unit - Cause TempUnit2 to damage TempUnit, dealing TempReal damage of attack type Chaos and damage type Universal
-
Else - Actions
-
-------- ---------------------- --------
There you go, an auto cast, cool distance-damage and impact checking is done. In case you didn't get it, I'll attach you a demo map, but this one won't use the Damage Detection System i gave so all variables about "GDD_" wouldn't useful anymore. Goodluck
View attachment [Demo]AutoCast.w3x
Caution: There're leaks inside. Destroy those TempLoc and TempLoc2
Hope it's helpful to you as everyone else
P/S: Congratulate on Zephyr's 1st place defskull
(forgot to)