How to make a unit walk in circles (from point 1 to 2, to 3, to 4 and so on) most efficiently?

X-maul

AKA: Demtrod
Reaction score
201
I need to have 4 units (starting from different locations, move in circles like this;
EjTzB8K.png

The units are supposed to move from point 1, to 2 and from 2 to 3, and so on. And then end at point 1 again where it starts over.
I got a unit starting at 1, 3, 5 and 7, and they are ofcourse meant to move to next point in line.

Currently I got a trigger that will trigger when a unit enters a region, and send it on to the next region, but that fires like 10 times a second, which I am worried might cause some lag.
Here's the trigger for reference;
Code:
Inner Moving 1
    Events
        Unit - Any Unit Enters within 2.0 of Point 001
    Local Variables
    Conditions
        (Owner of (Triggering unit)) == 15
    Actions
        Unit - Order (Triggering unit) to ( Move targeting Point 002) (After Existing Orders)
Is there a more efficient way of doing this? Maybe with actors or another trigger method?
 

hopy

Active Member
Reaction score
64
Well, adding all the move commands to a queue when entering point 1 would devide the number of triggering triggers by 8 I guess.
Code:
Untitled Trigger 001
    Events
        Unit - Any Unit Enters within 2.0 of Point 001
    Local Variables
    Conditions
    Actions
        Unit - Order (Triggering unit) to ( Move targeting Point 002) (After Existing Orders)
        Unit - Order (Triggering unit) to ( Move targeting Point 003) (After Existing Orders)
        Unit - Order (Triggering unit) to ( Move targeting Point 004) (After Existing Orders)

You could maybe do this with patrole commands, but I'm not sure if it'll go in a circle, or go back and forth (as in going around the circle, and then going around the circle again backwards). If patrole commands are possible it would only require a single trigger fire, so worth a try.
 

Siretu

Starcraft 2 Editor Moderator
Reaction score
293
I don't know why it would fire 10 times a second but I would suggest putting them in a point array and having all events in the same trigger, loop through and get which one you're close to and go to the next one in the array(if you're not at the end, in which case you start at 0 again).

Tell me if you'd like me to elaborate.
 

X-maul

AKA: Demtrod
Reaction score
201
I don't know why it would fire 10 times a second but I would suggest putting them in a point array and having all events in the same trigger, loop through and get which one you're close to and go to the next one in the array(if you're not at the end, in which case you start at 0 again).

Tell me if you'd like me to elaborate.
Oh, now I know what you meant last night, I did not understand what you refered to when you refered to this post -_-

Well the reason why it fires so many times, is that I got 8 units running around at the same time. So it will be fired at a fast pace.

Having 1 trigger which will fire 100 times instead of 10 trigger firing 10 times. It's more efiicient, that's for sure, but wouldnt that still cause lag issues?

If that's not what you mean, you might need to elaborate :)
 

Dave312

Censored for your safe viewing
Reaction score
269
I don't think Siretu's method will solve any lag issues. I would be using Hopy's method of queued orders. You would just need to create one region and then queue move orders for each location to move to.
 

Siretu

Starcraft 2 Editor Moderator
Reaction score
293
Implementing my version wouldn't take long. I don't think it will have any noticable performance issues, so I think it could've been worth trying out.

I think patrol will work fine and it's probably the best solution. Using shift and patrol, you can get a unit to patrol in a circle, so it should be possible with triggers.
 

X-maul

AKA: Demtrod
Reaction score
201
Ok, well I used the patrol method, but for some reason, the unit only want to take up to 6 orders, and then just ignores the following orders - is there any way to increase the amount of oders a unit can queue up? I need a unit with 26 orders, so it's pretty limitting :S

This is the trigger actions, I'm running now;
Code:
        Unit - Order CurrentUnit to ( Move targeting Outer 8) (After Existing Orders)
        Unit - Order CurrentUnit to ( Patrol targeting Outer 1) (After Existing Orders)
        Unit - Order CurrentUnit to ( Patrol targeting Outer 2) (After Existing Orders)
        Unit - Order CurrentUnit to ( Patrol targeting Outer 3) (After Existing Orders)
        Unit - Order CurrentUnit to ( Patrol targeting Outer 4) (After Existing Orders)
        Unit - Order CurrentUnit to ( Patrol targeting Outer 5) (After Existing Orders)
        Unit - Order CurrentUnit to ( Patrol targeting Outer 6) (After Existing Orders)
        Unit - Order CurrentUnit to ( Patrol targeting Outer 7) (After Existing Orders)
        Unit - Order CurrentUnit to ( Patrol targeting Outer 8) (After Existing Orders)
If I remove this line;
Code:
        Unit - Order CurrentUnit to ( Patrol targeting Outer 7) (After Existing Orders)
It moves in circles, but I need it to move in the right paths:confused:

EDIT: Apearently, it's named the Waypoint List (that which contains the patrol orders). Any ideas, on how to increase the capacity of that?
 

Dave312

Censored for your safe viewing
Reaction score
269
The problem is actually just because you are using the patrol command. By queuing Patrol commands, you set a waypoint along the units patrol path. However a unit can't patrol to the same point twice. So your unit will start at 8, then patrol from points 1 to 7. But then it can't patrol back to 8 because the unit already has that point in its patrol.

I tried creating this with 9 points and the unit will patrol along all of them except for the last one (as describe above). As for it apparently working with 6 points, I wouldn't have a clue.

What you need to do is use the Move command. Create a region at your starting point, then for any unit that enters this region, give them queued Move Commands to move around the circle and back to the start position. When they approach this start position, they will enter the region again and the unit will be ordered to move around the circle again.
 

X-maul

AKA: Demtrod
Reaction score
201
I tested it in a normal map, and if I try to give a unit more than 7 patroll commands in a queue, it gave me an error Waypoint List is full.

But I guess, I'll just use the method where I only use 1 region for sending them off.
 

Dave312

Censored for your safe viewing
Reaction score
269
When I did my testing, I was using an older version of the editor (I didn't have the latest patch installed). After updating the editor, I ran the test again and as you say, the unit can only queue 7 patrol commands. So it must be something they changed in one of the recent patches (nothing mentioned in the patch notes though).

Fortunately this problem doesn't exist with move commands, so you should be able to get this working with a region for sending them off without any issues.
 

X-maul

AKA: Demtrod
Reaction score
201
I did get it to work, with just 1 region sending it along a path leading back to the start.

So problem is solved :)
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top