Knockback, hows it done?

L

locksftw

Guest
Ive heard lots of people adding a knockback effect to an ability, and seen it in maps, how is this done? i assume it involves moving the unit quickly a distance away from a point, but i can only find 'unit- move unit (instantly)' which is instant :/ so im confused.
Locksftw
 

Accname

2D-Graphics enthusiast
Reaction score
1,464
it is moved instantly, but it is moved about 100 times a second.

when the unit got hit by the triggering spell it will get added into a unitgroup and every 0.01 - 0.05 seconds another trigger will pick all units within that group and move them intantly to a point with offset 4 and angle (facing of (picked unit) + 180).
 

Beetlebomb

New Member
Reaction score
43
You can do this by making a trigger that either has an event that runs off of "Every x seconds" or when a timer expires.

What you can do for a simple knockback ability would be to set up variables that lock the position of the targeted unit and also the angle and distance between the caster and target. Then make a spell trigger that activates a timer. The other trigger with the expiring timer event will go off and use the variables activated from the Spell trigger and then move the targeted unit to position of targeting unit(in variable form) +10 distance.

It's very hard to describe it, but if you can't figure it out or get help later in the day I can help you.

I'll post a trigger I made with knockback later today.
 

BoterhaM

New Member
Reaction score
2
Code:
Knockback
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
        (Ability being cast) Equal to Knockback 
    Actions
        Set KnockBackTarget = (Target unit of ability being cast)
        Set KnockBackLocation[1] = (Position of (Triggering unit))
        Set KnockBackLocation[2] = (Position of KnockBackTarget)
        Countdown Timer - Start KnockBackTimer as a Repeating timer that will expire in 0.03 seconds
        Wait 1.00 seconds
        Countdown Timer - Pause KnockBackTimer

Code:
Knockback2
    Events
        Time - KnockBackTimer expires
    Conditions
    Actions
        Set KnockBackLocation[3] = (Position of KnockBackTarget)
        Set KnockBackLocation[4] = (KnockBackLocation[3] offset by 6.00 towards (Angle from KnockBackLocation[1] to KnockBackLocation[2]) degrees)
        Special Effect - Create a special effect attached to the overhead of KnockBackTarget using Abilities\Spells\Human\FlakCannons\FlakTarget.mdl
        Unit - Move KnockBackTarget instantly to KnockBackLocation[4]
        Custom script:      call RemoveLocation(udg_KnockBackLocation[3])
        Custom script:      call RemoveLocation(udg_KnockBackLocation[4])

Variables: KnockBackLocation = point array var
KnockBackTarget = unit var
KnockBackTimer = timer var

Note: the offset by 6 can be set to a higher value (indicting a further knockback): offset by 6 knockbacks for about 300 units.
 

Beetlebomb

New Member
Reaction score
43
lol, thanks BoterhaM for putting it up.

Also if you want to limit how far the knockback will go just make a variable that increases eachtime the trigger is ran and then when it equals to the distance variable you can tell it to pause the timer :) makes it MUI if u add arrays to the equation. adding a wait action also works :p
 

BoterhaM

New Member
Reaction score
2
lol, thanks BoterhaM for putting it up.

Also if you want to limit how far the knockback will go just make a variable that increases eachtime the trigger is ran and then when it equals to the distance variable you can tell it to pause the timer :) makes it MUI if u add arrays to the equation. adding a wait action also works :p

;)

do you mean intenger variable? like

Knockback 2 trigger:
Set DistanceVar = +1

Knockback trigger:
If then else
If: DistanceVar = 30
Then: End Trigger? o0
Else: eat shit and die

IntegerKnockBack = 300
 

ic3_water

Member
Reaction score
0
I have make a knock back but when i attack it in every direction , the target alway go to behind :nuts: Any one can fix it ?
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top