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,462
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.
  • WildTurkey WildTurkey:
    is there a stephen green in the house?
    +1
  • The Helper The Helper:
    What is up WildTurkey?
  • The Helper The Helper:
    Looks like Google fixed whatever mistake that made the recipes on the site go crazy and we are no longer trending towards a recipe site lol - I don't care though because it motivated me to spend alot of time on the site improving it and at least now the content people are looking at is not stupid and embarrassing like it was when I first got back into this like 5 years ago.
  • The Helper The Helper:
    Plus - I have a pretty bad ass recipe collection now! That section of the site is 10 thousand times better than it was before
  • The Helper The Helper:
    We now have a web designer at my job. A legit talented professional! I am going to get him to redesign the site theme. It is time.
  • Varine Varine:
    I got one more day of community service and then I'm free from this nonsense! I polished a cop car today for a funeral or something I guess
  • Varine Varine:
    They also were digging threw old shit at the sheriff's office and I tried to get them to give me the old electronic stuff, but they said no. They can't give it to people because they might use it to impersonate a cop or break into their network or some shit? idk but it was a shame to see them take a whole bunch of radios and shit to get shredded and landfilled
  • The Helper The Helper:
    whatever at least you are free
  • Monovertex Monovertex:
    How are you all? :D
    +1
  • Ghan Ghan:
    Howdy
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?

      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