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?
 
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.
 
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.
 
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 :)
 
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.
 
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.
 
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?
 
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.
 
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.
 
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.
 
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.
  • Ghan Ghan:
    I just disabled that test site. Let's see if that helps the load.
  • Ghan Ghan:
    Looks much better already.
  • The Helper The Helper:
    I had actually forgot about the Silkroad site. I had asked
  • The Helper The Helper:
    SD Ryoko about it and he said the couple of people left on there really like it, that was a few years ago, maybe I should check back
  • jonas jonas:
    I guess when you're getting old, and the last day of soup season draws near, you start wondering
  • jonas jonas:
    will I make it to the start of the next season? or was this the last time I'll ever have my favorite dish?
  • The Helper The Helper:
    I am doing my first Vibe Coding project. In installed the environment and tools according to instructions but it is all chat doing this for me at my direction. It is fun really and holy shit I might finish in 2 hours what it would have taken a day to in my Access and this would be an electron app complete new
  • Ghan Ghan:
    Good stuff.
  • Ghan Ghan:
    Just make sure it is secure. :)
    +1
  • The Helper The Helper:
    It will only be on internal network
  • jonas jonas:
    Man the AI is good about gaslighting about security though. I've had several times where I pointed out security problems and it tried to convince me that with a tiny tweak it suddenly becomes secure
  • jonas jonas:
    Like using a distrobox as a "secure" container, and when I point out that's not secure at all, it claimed that specifying home will make it secure
  • The Helper The Helper:
    Yeah I finished the app today and it is bad ass. Like ChatGPT codes way better and faster than me that is for sure. The app is unsecure AF though and I would never put it anywhere it was obvious. I did not even show it today, the boss never made it in, but I showed the office and they liked it and frankly, I do software for a living and I am qualified to judge this kind of stuff and... Holy Shit this is a game changer. It took me around 4 hours to finish the app from design to end and that is much faster than I could have done it in the outdated MS Access the thing it replaced was in. Good Stuff! Had tons of fun doing it too! Work has not been fun in a while - today was fun!
    +1
  • The Helper The Helper:
    And really, I did not do it, chat wrote all the code I just pasted it in, tested it, acted like Chats eyes on it and just learned. I learned VS Code, how to use the Terminal and a bunch of Powershell and Command stuff, I used Git for the first time and learned how to save, search, start my server, stop it, run the tests, do some debugging - all the freaking fun stuff - chat wrote all the code
    +1
  • The Helper The Helper:
    I think the key was the 40 minutes of that 4 hours that went into the design of it. The thing was fully specced out before we started and the only reason it took so long was I had never done any of it and had to get used to the navigation and workflow.
    +1
  • The Helper The Helper:
    React, JS and AG Grid are the tools that I know i used along with git. I learned alot but it will be a minute before I fully understand everything I am doing in these environments because I am really just following instructions.
    +1
  • jonas jonas:
    I think people who aren't logged in can't even see this chat, so your message letting them know they won't be able to register is also hidden xP
  • jonas jonas:
    but yeah on LLM they're pretty capable now, I used opencode to build a custom agent for some tasks I face, and the custom agent ended up doing better than either opencode or specialized tools that have been developed for 20 years by humans
  • jonas jonas:
    at the same time it is so stupid and making insanely dumb mistakes, I had to stop it several times from doing really dumb things that would work for just a few cases but would be totally broken for more serious workloads, or sometimes were always broken (like just drop some responses from the LLM, then continue with some fake message) but would not trigger immediate problems
  • jonas jonas:
    I had to babysit it a lot, I'm not sure if in the near future better models will come around at a similar price point. If the price increases by more than 10x, it will be cheaper for me to do it myself again
  • The Helper The Helper:
    I use it a little different due to my programming background. I dont let it just do it. I am behind it watching what it does and learning. However, Chat has not been making many mistakes. Mostly it is me pasting wrong or something.
  • The Helper The Helper:
    Wow, I have left windows behind on my home pc. I am not using Linux Mint babies
  • Ghan Ghan:
    Nice
  • Ghan Ghan:
    Fewer and fewer reasons to use Windows these days.
  • The Helper The Helper:
    Had to type my password like 50 times already though

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials
      Top