Mirroring unit movements

Status
Not open for further replies.
Level 6
Joined
Mar 17, 2012
Messages
105
Hello! I'm trying to make a trigger where a player controls one unit, and whenever the player moves his unit, another unit mirrors that movement.

The mirrored unit isn't just going to the point of the issued move order, it is moving correspondingly to how the controllable unit moves. Here's a gif to show what I'm trying to say, where the red blob is the controllable unit and the blue is the mirrored unit:

0912632001436734048.gif


Does anyone know how I could make this trigger? Thanks!
 
Level 24
Joined
Aug 1, 2013
Messages
4,658
When targeting objects, this is pretty much undoable.
However, if you only need the movement...

Create a trigger.
Use the event "A unit is issued an order targeting a point"
Condition can be "Issued order is equal to Order("move")"
Actions:
store both distance to that new point and angle towards that new point in global variables (care about location leaks).
Then make the other unit walk to the point "distance" units pointing "angle" direction.
 
Level 12
Joined
May 22, 2015
Messages
1,051
I think you could mirror the orders themselves.

  • Untitled Trigger 001
    • Events
      • Unit - A unit Is issued an order targeting a point
    • Conditions
    • Actions
      • Unit - Order MirrorUnit to Move To ((Target point of issued order) offset by (0.00, 600.00))
This would make MirrorUnit move to the same point except 600 above the controlled unit.

You would have to account for other things like if you tell them to stop, then the other units also has to stop. I don't know exactly what you can do for orders that target things. You may be able to handle those things better using JASS.

If you are only controlling movement, you could also have a trigger that periodically checks the controller unit and figures out the matching position for the mirror unit and then just orders them to move there. That way it would always move to the same spot.
 
Level 24
Joined
Aug 1, 2013
Messages
4,658
1. You save both position of triggering unit and targeted position into global variables.
2. You store the distance between those two points in another global variable.
3. You store the angle between those two points in another global variable.
4. You create a new location starting from the location of your other unit using a polar offset with the angle and distance.
5. Remove all location leaks.
 
Status
Not open for further replies.
Top