Units shooting in a straight line

Korika2

New Member
Reaction score
0
I have a quick question for a project I am working on. Is it possible to make it so a unit can only shoot in one direction?

I have added a picture to make it more clear with what I am trying to do.

Directions.png
 
hmm, i think you can't because all unit attack 360 degree. unless you narrow your terrain so only 1 unit can walk in at 1 time.
 
If you wanted to make a system for it you could.
Find X unit's degree from Y unit.

But without extensive triggering, not really.
 
If you wanted to make a system for it you could.
Find X unit's degree from Y unit.

But without extensive triggering, not really.

That wouldnt help, Since warcraft counts like:

357 Degrees, 358 Degrees, 359 Degrees, 360 Degrees, 1 Degree, 2 Degrees...

It will be very hard to calculate wether its a straight line (Since you cant just check if its 90.00 Degrees, because, what unit faces another at EXACTLY 90.00?).
 
Well, the idea I have uses lanes, would it be possible to make it so they only attack units in the lane that they occupy?
 
You could just make it so that a dummy unit fires a shockwave kind of thing in the facing o 0 90 180 n' 270 whenever it sees a unit and from whichever way is closer (enemy unit at 44 degree with tower as base, tower dummy shoots at 0)
This is just brainstorming though.
 
You could just make it so that a dummy unit fires a shockwave kind of thing in the facing o 0 90 180 n' 270 whenever it sees a unit and from whichever way is closer (enemy unit at 44 degree with tower as base, tower dummy shoots at 0)
This is just brainstorming though.

Still hard to do, back to what I said, blizzard doesnt think "359 + 15 (374)" as 14 degrees.
 
Actually, they do. I've used degrees at +500 and still got it to work as it's supposed to.

Really?
Oh ok fair enough.
Trigger:
  • Trigger
    • Events
      • Unit - A unit is Attacked
    • Conditions
      • Or - Any Conditions are true
        • Any - Conditions
          • Unit - Type of (Attacking Unit) is equal to Cannon Tower
    • Actions
      • Set Temp_Restriction = (THE ONLY ANGLE WHICH THE UNIT CAN SHOOT)
      • Set Temp_Point = (Position of (Triggering Unit))
      • Set Temp_Point_2 = (Position of (Attacking Unit))
      • Set Temp_Real = Angle between Temp_Point and Temp_Point_2
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Temp Real Is Greater than (>) Temp_Restriction - 15.00
          • Temp Real Is Less than (<) Temp_Restriction + 15.00
        • Then - Actions
          • -----Nothing I guess-----
        • Else - Actions
          • Unit - Order (Attacking Unit) to stop
      • Custom Script: call RemoveLocation (udg_Temp_Point)
      • Custom Script: call RemoveLocation (udg_Temp_Point_2)



Replace (THE ONLY ANGLE WHICH THE UNIT CAN SHOOT) with obviously, the restricted angle, (90 degrees is east (Assuming North is ^/Up) 180 degrees is South 270 West is 360/0 is North.)
 
Really?
Oh ok fair enough.
Trigger:
  • Trigger
    • Events
      • Unit - A unit is Attacked
    • Conditions
      • Or - Any Conditions are true
        • Any - Conditions
          • Unit - Type of (Attacking Unit) is equal to Cannon Tower
    • Actions
      • Set Temp_Restriction = (THE ONLY ANGLE WHICH THE UNIT CAN SHOOT)
      • Set Temp_Point = (Position of (Triggering Unit))
      • Set Temp_Point_2 = (Position of (Attacking Unit))
      • Set Temp_Real = Angle between Temp_Point and Temp_Point_2
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Temp Real Is Greater than (>) Temp_Restriction - 15.00
          • Temp Real Is Less than (<) Temp_Restriction + 15.00
        • Then - Actions
          • -----Nothing I guess-----
        • Else - Actions
          • Unit - Order (Attacking Unit) to stop
      • Custom Script: call RemoveLocation (udg_Temp_Point)
      • Custom Script: call RemoveLocation (udg_Temp_Point_2)

That'd lag bad. Real bad.
 
You're ordering the unit to stop. Whats the unit going to do? Stop. What's it going to do then? Attack the nearest thing, as its meant to in WC3.
Do this with 6 units and some may begin to feel it. Do this with more units and it's going to lag a lot more. I don't know what WC3's Ordering system's refresh rate is though.
 
You're ordering the unit to stop. Whats the unit going to do? Stop. What's it going to do then? Attack the nearest thing, as its meant to in WC3.
Do this with 6 units and some may begin to feel it. Do this with more units and it's going to lag a lot more. I don't know what WC3's Ordering system's refresh rate is though.

And your solution is?...
 
Not that one. It may be easier just to order the buildings via Pick every enemy within X range of building and have that building attack that unit (building having Worker classification so not to auto-attack, that is if buildings can have that classification and still follow it).
Or have an ability that does the damage for the building if that doesn't work. Or trigger the damage. The first idea I said in this post would be the best though.
 
Not that one. It may be easier just to order the buildings via Pick every enemy within X range of building and have that building attack that unit (building having Worker classification so not to auto-attack, that is if buildings can have that classification and still follow it).
Or have an ability that does the damage for the building if that doesn't work. Or trigger the damage. The first idea I said in this post would be the best though.

Yeah... The later solutions dont work too well either...The last one comphremises animation.



Using Worker classification works fine I guess, but better remind him to add it via trigger (Be more specific! ;)) or else he'll get the idle worker sign.

Oh, and you forgot to mention that he should, before ordering the unit to attack a unit within x range of the building, make sure the angles are correct, (And skip remaining actions!) otherwise there may be issues which lag bad. Real Bad.
 
"(Be more specific!)" Lol

Let me lazy it out.
Is the Original Poster willing to do this much work or go for the laggierway of HydraRancher's?
 
Like I said before, is it possible to make the tower only attack a unit that is in its respective lane? I suppose I wasn't specific enough in my first post.
 
You could create region that covers the entire lane, then check wether the targeted unit is inside there.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • 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 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