a unit comes close to another unit then knock the unit away

W

wc3andIlikei

Guest
I would like some help with a trigger that does so when a unit come close to another unit it knocks the unit backwards(or from the direction the unit comes from). Hope you understand what I mean-> :nuts:
 

Larcenist

REP: Respect, Envy, Prosperity?
Reaction score
211
Does this apply to when a unit comes withing X range of any unit, or just a specific unit?
 
W

wc3andIlikei

Guest
They I found where spells that knocked em back, I was looking for a trigger that knocked the unit when an enemy unit comes within range. Trying to make some seige engines try to knock eachother into a hole.
 

Larcenist

REP: Respect, Envy, Prosperity?
Reaction score
211
Are the siege engines preset on the map or do they spawn occasionally?
 

Kazuga

Let the game begin...
Reaction score
110
I made this ability for around 2 weeks ago for my hero arena, it drags a unit to your loaction (with chain lightning as base spell, also by this the chain lightning looks like a energy beam that drags him). Once he's at your location you knock him up in the air and back again from where he came from, (notice that this is the only part that can get wrong in my trigger, he might be knocked in a diffren location).

Anyway here is the triggers:
Code:
DragKnock
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
        (Ability being cast) Equal to DragKnock 
    Actions
        Set DragKnockCaster = (Casting unit)
        Set DragKnockCasterTarget = (Target unit of ability being cast)
        Set DragKnockAngle = (Angle from (Position of DragKnockCasterTarget) to (Position of DragKnockCaster))
        Unit - Pause DragKnockCasterTarget
        Trigger - Turn on Drag <gen>
        Animation - Change DragKnockCaster's animation speed to 5.00% of its original speed
        Animation - Play DragKnockCaster's attack animation
        Trigger - Run Anti dragstuck <gen> (checking conditions)
Code:
Drag
    Events
        Time - Every 0.03 seconds of game time
    Conditions
    Actions
        Set DragKnockPoint = ((Position of DragKnockCasterTarget) offset by 50.00 towards DragKnockAngle degrees)
        Set DragKnockpoint = (Distance between (Position of DragKnockCaster) and (Position of DragKnockCasterTarget))
        Unit - Move DragKnockCasterTarget instantly to DragKnockPoint
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                DragKnockpoint Less than or equal to 100.00
            Then - Actions
                Trigger - Run Knock animation <gen> (ignoring conditions)
                Trigger - Turn off (This trigger)
            Else - Actions
        Custom script:   call RemoveLocation (udg_DragKnockPoint)

Code:
Knock animation
    Events
    Conditions
    Actions
        Unit - Make DragKnockCaster face DragKnockCasterTarget over 0.00 seconds
        Unit - Pause DragKnockCaster
        Sound - Play HeroBladeMasterYesAttack2 <gen> at 100.00% volume, attached to DragKnockCaster
        Unit - Cause DragKnockCaster to damage DragKnockCasterTarget, dealing 250.00 damage of attack type Chaos and damage type Normal
        Animation - Play DragKnockCaster's attack animation
        Unit - Make DragKnockCaster face DragKnockCasterTarget over 0.00 seconds
        Set DragKnockAngle = (Angle from (Position of DragKnockCaster) to (Position of DragKnockCasterTarget))
        Unit - Unpause DragKnockCaster
        Animation - Change DragKnockCaster's animation speed to 100.00% of its original speed
        Trigger - Turn on Knock <gen>
        Trigger - Run Anti knockstuck <gen> (checking conditions)
        Trigger - Turn off (This trigger)
Code:
Knock
    Events
        Time - Every 0.03 seconds of game time
    Conditions
    Actions
        Unit - Add Storm Crow Form to DragKnockCasterTarget
        Unit - Remove Storm Crow Form from DragKnockCasterTarget
        Animation - Change DragKnockCasterTarget flying height to ((Current flying height of DragKnockCasterTarget) + 300.00) at 0.00
        Set DragKnockPoint = ((Position of DragKnockCasterTarget) offset by 50.00 towards DragKnockAngle degrees)
        Unit - Move DragKnockCasterTarget instantly to DragKnockPoint
        Animation - Change DragKnockCasterTarget flying height to 0.00 at 300.00
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Distance between (Position of DragKnockCaster) and (Position of DragKnockCasterTarget)) Greater than or equal to 600.00
            Then - Actions
                Unit - Unpause DragKnockCasterTarget
                Trigger - Turn off (This trigger)
            Else - Actions

Hope this helped :rolleyes:.
If you have any questions or if this didn't help please say so, so that I can help you further (if I now handle the power that is required :p).
 

Larcenist

REP: Respect, Envy, Prosperity?
Reaction score
211
Then you can keep track of the units by doing something like this:

First Trigger:

Code:
Events
Elapsed game time is 1 second

Conditions

Actions
set bj_wantDestroyGroup = true
Pick every units in playable map area matching unit-type of (matching unit) equal to siege engine and do actions
 Loop
 set EngineCount = EngineCount + 1
 set Engine[EngineCount] = picked unit
 Add to Second Trigger <gen> the event A unit gets within X range of Engine[EngineCount]

Second Trigger:

Code:
Events

Conditions

Actions
// set all variables and then add an event for Third Trigger <gen> to activate the knockback.

Third Trigger:

This is a knockback trigger, just experiment your way to it.

Edit: No idea if this'll work though, never tried it myself.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • 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 The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1

      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