HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

ordering a surround

06-23-2004, 04:37 PM#1
Kaluo
Working on an ability that orders all nearby allied units to surround an enemy unit. The first thing i tried was this.
Code:
Surround
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
        (Ability being cast) Equal to Surround 
    Actions
        Set Mind_Control_Units[1] = (Target unit of ability being cast)
        Set Mind_Control_Units[2] = (Triggering unit)
        Unit Group - Pick every unit in (Units within 500.00 of (Position of Mind_Control_Units[2]) matching (((Matching unit) belongs to an ally of (Owner of Mind_Control_Units[2])) Equal to True)) and do (Actions)
            Loop - Actions
                Unit Group - Add (Picked unit) to MindControlSpawnies
                Unit - Order (Picked unit) to Move To ((Position of Mind_Control_Units[1]) offset by 300.00 towards (Angle from (Position of Mind_Control_Units[2]) to (Position of Mind_Control_Units[1])) degrees)
                Wait (((Distance between (Position of (Picked unit)) and (Position of Mind_Control_Units[1])) / (Current movement speed of (Picked unit))) + 0.25) seconds
                Unit Group - Pick every unit in MindControlSpawnies and do (Unit - Order (Picked unit) to Stop)
                Unit Group - Pick every unit in MindControlSpawnies and do (Unit - Order (Picked unit) to Follow Mind_Control_Units[1])
                Wait 0.20 seconds
                Unit Group - Pick every unit in MindControlSpawnies and do (Unit - Order (Picked unit) to Stop)
                Unit Group - Pick every unit in MindControlSpawnies and do (Unit - Order (Picked unit) to Follow Mind_Control_Units[1])
                Wait 0.20 seconds
                Unit Group - Pick every unit in MindControlSpawnies and do (Unit - Order (Picked unit) to Stop)
                Unit Group - Pick every unit in MindControlSpawnies and do (Unit - Order (Picked unit) to Follow Mind_Control_Units[1])
                Wait 0.20 seconds
                Unit Group - Pick every unit in MindControlSpawnies and do (Unit - Order (Picked unit) to Stop)
                Unit Group - Pick every unit in MindControlSpawnies and do (Unit - Order (Picked unit) to Attack Mind_Control_Units[1])


The stop's seem unnecessary but the whole problem is that the units won't forget their orders like they do if you just bash 'm' in melee. The mind controlled units continue to move to that point 300 away from their target even when a stop/move order should interrupt them. Also this wouldn't even work on a semi intelligent player who ran when they saw this happening. Can anyone give me a trigger that would work on a moving unit and efficiently surround it?
06-23-2004, 09:36 PM#2
LunaSeer
First problem is that if there isn't enough units around the caster, the target can't be surrounded.

Second, the units that's doing the surrounding but be faster than the moving target. I suggest temporary speed increase and speed decrase for target. Temporarily removing collision (or deacrease to 1) may help too.

Third, follow won't work because when the moving target stops, all unit following it will stop like 200 away from the target. Move to point also won't work because like you said, they keep on moving to that point even when the target moves away.

Fourth, I didn't know you can units units within range for user defined variables. It actually works? Didn't work for me.

Fifth, may I suggest you pause the target until it is surrounded?

Sixth, I suggest you replace the follow with move to point and take out the stops. The unit should stop after being issued another order (depends on the nature of the order) unless it didn't recieve the order.

Seventh, instead of copying the same actions over n over again why not do a repeating trigger that will stop when the target is surrounded? Do that by running another trigger with a condition that checks the amount of units within 100 of the target and runs itself checking the condition.

Eighth, I'm all out of ideas.

Ninth, Sorry but I'm too tired to test a trigger for you because it takes so damn long and I just finished playing around with it.