Okay lemme put it down step by step: (note: this is for GUI)
Make a trigger (obviously) and name it "GUI".
-
-
Events
-
Unit - A unit Starts the effect of an ability
(Generic Unit Event)
-
Conditions
-
(ability being cast) Equal to KnockBack
(Ability Comparison) oh, and "KnockBack" is just some ability I made, insert your own ability here
Now add 3 variables:
Caster - Unit
Target - Unit
Location - point
And set these variable
-
Actions
-
Set variable Caster = (Triggering Unit)/(Casting Unit)
-
Set variable Target = (Target Unit of ability being Cast)
-
Set variable Location = (Position of Caster)
(general Action)
Now make a new trigger, name it "Knock" or "Push" (or whatever)
-
Events
-
Time - Every 0.04 seconds of game time
(note: reason for 0.04 seconds of game time - it runs really smoothly and looks epic
)
Now untick the "Initially On" box, so that it doesn't run forever.
Okay, this trigger only needs 1 action. This is the actual trigger that makes the knockback effect.
-
Unit - Move (variable TARGET) instantly to Point with polar offset
Now this is kind of the tricky part.
Okay, now take the
Location variable
Make the offset by Arithmetic. You will see:
1.00 + 1.00 - both in blue
Click on the first "1.00"
Make it: Math - Distance between points -
Distance between
Location and
(Position of
Target).
Now click the second 1.00 and make it's value 5. (just do it
)
Now make it "towards (math - angle between points)"
make it Angle from
Location to Position of
Target.
I'll include a few Screenshots If you don't understand, cause It's rather hard to explain it like this
P
Now go back to the trigger "GUI"
add actions:
-
Actions
-
Trigger - Turn on Knock/push<gen>
-
Wait - 1.00 seconds
-
Trigger - Turn off Knock/push<gen>
Why wait 1 second? Cause watching somebody getting knocked back for 10 seconds is pretty lame
That's pretty much it! Just wait a sec lemme attach those screenshots.
Hope this helped