HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Is there a way to force units to follow another unit?

05-25-2008, 12:41 AM#1
dhobby
I want to make certain units always stay within a certain radius of another unit and if they stray too far send them back to the original. I also want them to be controllable. It's similar to Vexorian's independent summon system but I want to be able to have the units use spells and be ordered around as long as they stay within a radius.
05-25-2008, 12:52 AM#2
Vexorian
That one is as easy as a loop that checks if the units are in a certain range, if they aren't order the slave to get close to the unit. You can add extravagant things as blocking orders in case the unit is too far, but I don't think that's so necessary.
05-25-2008, 01:23 AM#3
dhobby
hm a loop? so.. If i was to make this in GUI would the event be periodic?
05-25-2008, 01:28 AM#4
Vexorian
yes something like that
05-25-2008, 01:50 AM#5
dhobby
I see. Thanks
05-25-2008, 03:59 AM#6
Strilanc
You can also use the default 'follow this unit' behaviour in wc3 by ordering a unit to patrol on another unit.
05-25-2008, 04:09 AM#7
dhobby
Hm so what your suggesting is that Every X seconds order "slave" patrol to master? Might work but wouldn't there a problem with keeping the unit in range?
For example if there were enemy units wouldn't the "slave" stop and fight the unit since it's on patrol?
05-25-2008, 04:21 AM#8
darkwulfv
It would follow the master and copy its actions. So if the master attacked, so would the slave. However, if the master stops and isn't necessarily attacking, if there is a unit in range, the slave will probably attack.

Oh, and to allow the slave to be able to follow much closer, give it "Tornado Wander" (I think that's the ability, correct me if I'm wrong anyone.)
05-25-2008, 04:44 AM#9
dhobby
really? I didn't know patrol copied the "master's" actions. Tornado wander would still allow me to command the unit to use spells?
05-25-2008, 04:53 AM#10
darkwulfv
Yes, I believe so.
05-25-2008, 07:31 AM#11
Strilanc
Quote:
Originally Posted by dhobby
Hm so what your suggesting is that Every X seconds order "slave" patrol to master? Might work but wouldn't there a problem with keeping the unit in range?
For example if there were enemy units wouldn't the "slave" stop and fight the unit since it's on patrol?

You only need to order it once.
05-25-2008, 07:33 AM#12
darkwulfv
If the slave breaks patrol and attacks, it would need to be re-ordered. So you should periodically re-order it, to be on the safe side.
05-25-2008, 04:29 PM#13
dhobby
wow... I found a really easy solution and it was right in front of my face. I tried most of the suggestions that was given to me and ended up with
Trigger:
Reinforce Group
Collapse Events
Unit - A unit Is issued an order targeting an object
Unit - A unit Is issued an order targeting a point
Unit - A unit Is issued an order with no target
Collapse Conditions
(Unit-type of (Triggering unit)) Equal to Gretchin
Collapse Actions
Set TempUnitGroup = (Units owned by (Owner of (Triggering unit)) matching ((Unit-type of (Matching unit)) Equal to Gretchin (Extra)))
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Unit-type of (Triggering unit)) Equal to Gretchin
Collapse Then - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Issued order) Equal to (Order(smart))
Collapse Then - Actions
Unit Group - Pick every unit in TempUnitGroup and do (Unit - Order (Picked unit) to Move To (Target point of issued order))
Collapse Else - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Issued order) Equal to (Order(hold position))
Collapse Then - Actions
Unit Group - Pick every unit in TempUnitGroup and do (Unit - Order (Picked unit) to Hold Position)
Collapse Else - Actions
Unit Group - Pick every unit in TempUnitGroup and do (Unit - Order (Picked unit) to Right-Click (Triggering unit))
Else - Actions

dark i tried tornado wander and it kind of worked the problem was that after a while the slave just dies for no reason. Must be the time limit on the tornado spell maybe?

The solution I decided to use was Vex's Independent summon system without the ward classification on the slave unit!!!! So simple and it took me so long to think of it. It lets me use spells but unable to control the unit =)
05-25-2008, 04:31 PM#14
Vexorian
Now try one that doesn't leak memory like hell.

I don't think it will work. There are ways to make the lead move without issuing orders.
05-25-2008, 04:44 PM#15
dhobby
the trigger code I pasted was a rough draft of what I wanted to do but I decided to use ur independent system without the ward classification. Your system doesn't leak right? =X