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
 

canons200

New Member
Reaction score
50
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.
 

TheCrystal

New Member
Reaction score
36
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.
 

HydraRancher

Truth begins in lies
Reaction score
197
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?).
 

Korika2

New Member
Reaction score
0
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?
 

TheCrystal

New Member
Reaction score
36
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.
 

HydraRancher

Truth begins in lies
Reaction score
197
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.
 

HydraRancher

Truth begins in lies
Reaction score
197
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.)
 

TheCrystal

New Member
Reaction score
36
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.
 

TheCrystal

New Member
Reaction score
36
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.
 

HydraRancher

Truth begins in lies
Reaction score
197
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?...
 

TheCrystal

New Member
Reaction score
36
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.
 

HydraRancher

Truth begins in lies
Reaction score
197
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.
 

TheCrystal

New Member
Reaction score
36
"(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?
 

Korika2

New Member
Reaction score
0
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.
 

HydraRancher

Truth begins in lies
Reaction score
197
You could create region that covers the entire lane, then check wether the targeted unit is inside there.
 
General chit-chat
Help Users

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top