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:
 
Does this apply to when a unit comes withing X range of any unit, or just a specific unit?
 
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.
 
Are the siege engines preset on the map or do they spawn occasionally?
 
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).
 
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.
  • The Helper The Helper:
    News portal has been retired. Main page of site goes to Headline News forum now
  • The Helper The Helper:
    I am working on getting access to the old news portal under a different URL for those that would rather use that for news before we get a different news view.
  • Ghan Ghan:
    Easily done
    +1
  • The Helper The Helper:
    https://www.thehelper.net/pages/news/ is a link to the old news portal - i will integrate it into the interface somewhere when i figure it out
  • Ghan Ghan:
    Need to try something
  • Ghan Ghan:
    Hopefully this won't cause problems.
  • Ghan Ghan:
    Hmm
  • Ghan Ghan:
    I have converted the Headline News forum to an Article type forum. It will now show the top 20 threads with more detail of each thread.
  • Ghan Ghan:
    See how we like that.
  • The Helper The Helper:
    I do not see a way to go past the 1st page of posts on the forum though
  • The Helper The Helper:
    It is OK though for the main page to open up on the forum in the view it was before. As long as the portal has its own URL so it can be viewed that way I do want to try it as a regular forum view for a while
  • Ghan Ghan:
    Yeah I'm not sure what the deal is with the pagination.
  • Ghan Ghan:
    It SHOULD be there so I think it might just be an artifact of having an older style.
  • Ghan Ghan:
    I switched it to a "Standard" article forum. This will show the thread list like normal, but the threads themselves will have the first post set up above the rest of the "comments"
  • The Helper The Helper:
    I don't really get that article forum but I think it is because I have never really seen it used on a multi post thread
  • Ghan Ghan:
    RpNation makes more use of it right now as an example: https://www.rpnation.com/news/
  • The Helper The Helper:
  • The Helper The Helper:
    What do you think Tom?
  • tom_mai78101 tom_mai78101:
    I will have to get used to this.
  • tom_mai78101 tom_mai78101:
    The latest news feed looks good
  • The Helper The Helper:
    I would like to see it again like Ghan had it the first time with pagination though - without the pagination that view will not work but with pagination it just might...
  • The Helper The Helper:
    This drink recipe I have had more than a few times back in the day! Mind Eraser https://www.thehelper.net/threads/cocktail-mind-eraser.194720/

      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