• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Make unit move with a specific angle to a direction without stopping

Status
Not open for further replies.
Level 4
Joined
Sep 6, 2010
Messages
100
How do I point a unit to move to a direction without stopping and with a specific angle? E.g:
Unit - move to point of angle of "unit"...
 
Level 21
Joined
Mar 27, 2012
Messages
3,232
ah, I see what he wants now.
Afaik, all knockback systems move unit a little bit (like 5 range) every 0,03 second in "angle from caster to target".
0,03 second and small range are used because it gives our eyes the impression of fluent movement

However, note that the GUI function for moving units also orders them to stop.
If you use SetUnitX/SetUnitY, then you can move them without cancelling orders.
 
Level 4
Joined
Sep 6, 2010
Messages
100
I don't want them to move to a specific place, I want them to move in the direction of whatever angle a specific unit is looking at.
 
Level 28
Joined
Sep 26, 2009
Messages
2,520
that is the very same thing
"Issue order targeting a point" orders unit to move *somewhere*, same for "Unit - Move unit instantly"
You have to define where *somewhere* is - in your case, it is a "point" in front of that unit ("in front" as in where the unit is facing)

something like this:
  • Actions
    • Set p1 = (Position of YOUR_UNIT)
    • Set p2 = (p1 offset by 256.00 towards (Facing of YOUR_UNIT) degrees)
    • Unit - Order YOUR_UNIT to Move To p2
p1 and p2 are "point" variables.
That trigger will order unit to move forward by 256 range

If you want your unit to be moved forward (as in it is teleported forward), then instead of "Unit - Order unit to move to ..." use this aciton
  • Unit - Move YOUR_UNIT instantly to p2
This will "teleport" the unit 256 range forward.
If you want to move your unit like that but fluently, you will need to move them only 5 range instead and make that trigger fire every 0,03 seconds via event "Time - Periodic event"

So something like this
  • Untitled Trigger 001
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Set p1 = (Position of YOUR_UNIT)
      • Set p2 = (p1 offset by 5.00 towards (Facing of YOUR_UNIT) degrees)
      • Unit - Move YOUR_UNIT instantly to p2
 
Level 4
Joined
Sep 6, 2010
Messages
100
that is the very same thing
"Issue order targeting a point" orders unit to move *somewhere*
You have to define where *somewhere* is - in your case, it is a "point" in front of that unit ("in front" as in where the unit is facing)
So I have to define *somewhere* as the angle of the unit in question?

that is the very same thing
"Issue order targeting a point" orders unit to move *somewhere*
You have to define where *somewhere* is - in your case, it is a "point" in front of that unit ("in front" as in where the unit is facing)

something like this:
  • Actions
    • Set p1 = (Position of YOUR_UNIT)
    • Set p2 = (p1 offset by 256.00 towards (Facing of YOUR_UNIT) degrees)
    • Unit - Order YOUR_UNIT to Move To p2
p1 and p2 are "point" variables.
That trigger will order unit to move forward by 256 range
Oh... Now I get it, thanks.
 
Level 4
Joined
Sep 6, 2010
Messages
100
  • Angles
  • Events
    • Time - Every 0.03 seconds of game time
  • Conditions
  • Actions
    • Set p1 = Position of YourUnit
    • Set p2 = Position of YourUnit offset by p1 + YourOffset towards YourAngle (0.00 ~ 360.00)
    • Unit - Move YourUnit instantly to p2
I want him to walk at whatever direction a specific unit is looking at, forever.
 
Level 4
Joined
Sep 6, 2010
Messages
100
If u want to play an animation while moving a unit u need to move unit periodically using the custom script SetUnitX/Y
Nah, nothing to do with animations; I just want him to walk in the direction of whatever unit I choose is looking at, and he just keeps walking and walking, without stopping.
 
Level 4
Joined
Sep 6, 2010
Messages
100
Oh you want him to walk without stopping?
  • Angles
  • Events
  • Time - Every 0.03 seconds of game time
  • Conditions
  • Actions
  • Set p1 = Position of YourUnit
  • Set p2 = Position of YourUnit offset by p1 + YourOffset towards YourAngle (0.00 ~ 360.00)
  • Unit - Order YourUnit to Walk to p2
Thanks
 
Status
Not open for further replies.
Top