It's actually pretty simple once you understand how it's done, but basically you just have to create a trigger with an Issue Order targeting a Unit, just like this (important parts are in bold):
Unit - Order (Triggering unit) to ( Move targeting (Closest unit to (Position of (Triggering unit)) in (Zergling units in (Playable map area) owned by player Any Player matching Excluded: Missile, Dead, Hidden, with at most Any Amount))) (Replace Existing Orders)
This trigger works, but it sends the triggering unit to the point that the zergling was standing at when the issue was ordered, and when it gets there it stands still. How can I make the triggering unit follow it indefinitely?
If you include this action and a Wait in a Repeat Forever loop, the action will repeat itself permanently every X seconds. Be careful though, the action will keep repeating even when the triggering unit is dead, it may cause errors or worse depending on how many times the event happens (too many iterations of the loop will cause lags and/or crashes). You'll have to include a condition inside the loop to check if the triggering unit is alive. If it's not, Break the loop. If it is, order the unit to move.
To sum up:
Repeat Forever:
If (triggering unit) is alive == FALSE
Then Break
Else Issue Order
This method will only work 100% if the unit has vision of its target. When the target enters the fog of war for a certain amount of time, the order is replaced by some kinf of a "move to last known location of target" order. You can easily prevent this by giving entire vision of the map to the player owning the unit which is ordered to move, it doesn't really matter when the owner is Hostile (or controlled by AI) but it can be a problem if it's a human player. And besides, the map you're sharing does exactly what I said in my first response.
EDIT: I just remembered it's actually much better to use a "While (triggering unit is alive)" for such a script, rather than a Repeat Forever loop + Break.
How would I set up this action? I want it to look something like: Order triggering unit to move to closest zergling
<Click Here> To See My Epic Single Player Campaign (LifeForceCampaign.com)
It's actually pretty simple once you understand how it's done, but basically you just have to create a trigger with an Issue Order targeting a Unit, just like this (important parts are in bold):
Unit - Order (Triggering unit) to ( Move targeting (Closest unit to (Position of (Triggering unit)) in (Zergling units in (Playable map area) owned by player Any Player matching Excluded: Missile, Dead, Hidden, with at most Any Amount))) (Replace Existing Orders)
@ZealNaga: Go
This trigger works, but it sends the triggering unit to the point that the zergling was standing at when the issue was ordered, and when it gets there it stands still. How can I make the triggering unit follow it indefinitely?
<Click Here> To See My Epic Single Player Campaign (LifeForceCampaign.com)
If you include this action and a Wait in a Repeat Forever loop, the action will repeat itself permanently every X seconds. Be careful though, the action will keep repeating even when the triggering unit is dead, it may cause errors or worse depending on how many times the event happens (too many iterations of the loop will cause lags and/or crashes). You'll have to include a condition inside the loop to check if the triggering unit is alive. If it's not, Break the loop. If it is, order the unit to move.
To sum up:
Repeat Forever:
Then Break
Else Issue Order
A better method is to probably just use the Move command on the unit, hence following it. Test map attached.
@xKenneth: Go
This method will only work 100% if the unit has vision of its target. When the target enters the fog of war for a certain amount of time, the order is replaced by some kinf of a "move to last known location of target" order. You can easily prevent this by giving entire vision of the map to the player owning the unit which is ordered to move, it doesn't really matter when the owner is Hostile (or controlled by AI) but it can be a problem if it's a human player. And besides, the map you're sharing does exactly what I said in my first response.
EDIT: I just remembered it's actually much better to use a "While (triggering unit is alive)" for such a script, rather than a Repeat Forever loop + Break.
Thank you very much for the in-depth and informative responses guys. I really appreciate them.
<Click Here> To See My Epic Single Player Campaign (LifeForceCampaign.com)