Pick every unit doesn't pick every unit

Level 12
Joined
Jul 5, 2014
Messages
551
I finally reach a point on my map I kept stalling because I can't even comprehend the problem. There's a point where unit group commands just don't seem to work properly. What's happening:

1. During issued move order, some units keep standing around. In one case I went as far as to make a 0.5 seconds periodic pick and move trigger. That got nearly everyone move although they kept stopping after every step.

2. Patrols (aka units periodically move between given points) aren't completely responding to being stopped and their patrol trigger turned off. Instead of the said new location, they go the location of the turned off patrol trigger.

3. During a pick every unit and explode, some remained unexploded.

I can't even grasp the problem. It occurs even with smaller 4-6 unit groups, not just bigger ones.
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,866
This is a pretty common problem and there's many threads on it already.

The only solutions I know of:
1) Reduced collision sizes apparently helps.
2) Divide units amongst different players (100% working solution). I've found that things start to break around 60 units per player.
3) Issue less Orders.

I use #2 and #3 in my maps.

An example of how to fix it using #2:

Step 1: In Player Properties, setup 3 Computer players. Give them the same Name like "Orcs" and make them Allies with one another in the Forces tab.

Step 2: Create a trigger that will divide ownership of any pre-placed Units owned by these Players:
  • Events
    • Time - Elapsed game time is 0.00 seconds
  • Conditions
  • Actions
    • Set Orc_Computer_Total = 3
    • Set Orc_Computer[1] = Player 10 (Light Blue)
    • Set Orc_Computer[2] = Player 11 (Dark Green)
    • Set Orc_Computer[3] = Player 12 (Brown)
    • Player - Set color of Orc_Computer[1] to Brown
    • Player - Set color of Orc_Computer[2] to Brown
    • Player - Set color of Orc_Computer[3] to Brown
    • Unit Group - Pick every unit in (Playable map area) and do (Actions)
      • Loop - Actions
        • If all conditions are true then do actions
          • If - Conditions
            • (Race of (Picked unit)) Equal to Orc
          • Then - Actions
            • Set Orc_Computer_Index = (Orc_Computer_Index + 1)
            • Unit - Change ownership of (Picked unit) to Orc_Computer[Orc_Computer_Index] and Change color
            • If Orc_Computer_Index Equal to Orc_Computer_Total Then Set Orc_Computer_Index = 0
          • Else - Actions
Step 3: Create a trigger that will divide ownership of any newly created Units owned by these Players:
  • Events
    • Unit - A unit Enters playable map area
  • Conditions
    • (Race of (Triggering unit)) Equal to Orc
  • Actions
    • Set Orc_Computer_Index = (Orc_Computer_Index + 1)
    • Unit - Change ownership of (Triggering unit) to Orc_Computer[Orc_Computer_Index] and Change color
    • If Orc_Computer_Index Equal to Orc_Computer_Total Then Set Orc_Computer_Index = 0
Of course you can modify the Conditions to check for something other than a Race:
  • Or - Multiple conditions
    • (Owner of (Triggering unit)) Equal to Orc_Computer[1]
    • (Owner of (Triggering unit)) Equal to Orc_Computer[2]
    • (Owner of (Triggering unit)) Equal to Orc_Computer[3]
This should allow you to have 180 units in total, 60 per computer, and will give the illusion that they're all owned by the same exact player. Add more Computer players to increase the limit.
 
Last edited:

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,866
When I have 4 units and order them to move to a point, shouldn't that be few enough units and orders? Or when I give a single order to 6 units and only 4 affected? I can't divide them down to 2 units/group.
The game starts to break when there's too many Orders going on at once for the same Player. It's likely due to the pathfinding system having trouble managing all of them, although it's odd that User's "manual orders" don't seem to suffer from this issue.

If you look it up you'll see many threads over the years discussing this problem. There's likely not much you can do besides what I suggested.

See what DrSuperGood said at the bottom of this one:
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,866
But you are saying too many orders at once. When I order that 4 units, there's no other order going on. Unless you meant "at once" in a different manner.
Orders are an ongoing thing. A unit that was ordered to "move to a Point" is constantly recalculating the path it should take to get there and holds a reference to this "order". This movement is called pathfinding, and pathfinding is a pretty complicated process, hence why we encounter issues like the one you're experiencing. More modern games have better pathfinding algorithms but part of Warcraft 3's charm is how "clunky" the units behave.

Anyway, I gave you the known solutions and pointed you to a great explanation so there's not much else to say I'm afraid.
 
Level 12
Joined
Jul 5, 2014
Messages
551
Orders are an ongoing thing. A unit that was ordered to "move to a Point" is constantly recalculating the path it should take to get there and holds a reference to this "order". This movement is called pathfinding, and pathfinding is a pretty complicated process, hence why we encounter issues like the one you're experiencing. More modern games have better pathfinding algorithms but part of Warcraft 3's charm is how "clunky" the units behave.

Anyway, I gave you the known solutions and pointed you to a great explanation so there's not much else to say I'm afraid.
I've tried the different team solution with the 4 unit group where one kept disobeying the order. Despite putting them in a brand new team, the result was the same.
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,866
I've tried the different team solution with the 4 unit group where one kept disobeying the order.
What does disobeying the order mean exactly?

Because when you said this before:
although they kept stopping after every step.
^ That made me think it was the stuttering problem that occurs with too many triggered Orders. The units will constantly try to move to their destination but have to basically wait for their "turn to move". If you're experiencing something else then maybe you have conflicting triggers or an AI problem. I would look into the AI - Ignore Guard position action along with Computer slots/Unused slots in the Player Properties. There can be cases where the AI issues it's own orders which overwrite the ones you've manually given to their units.

Despite putting them in a brand new team, the result was the same.
I'm sure you meant a new Player, because Teams are the Forces that you setup in the Player Properties menu. Alliance vs Scourge is Team 1 vs Team 2.
 
Last edited:
Level 12
Joined
Jul 5, 2014
Messages
551
1. During issued move order, some units keep standing around. In one case I went as far as to make a 0.5 seconds periodic pick and move trigger. That got nearly everyone move although they kept stopping after every step.

2. Patrols (aka units periodically move between given points) aren't completely responding to being stopped and their patrol trigger turned off. Instead of the said new location, they go the location of the turned off patrol trigger.

3. During a pick every unit and explode, some remained unexploded.
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,866
Eh, I can't really help you if you don't want to clarify things. I still don't know if it's the stuttering problem or not. I'm not even certain you did what I suggested correctly.

Anyway you can upload the map, pictures, videos, etc.

The map would be the best solution since that tells me everything I need to know.
 
Level 12
Joined
Jul 5, 2014
Messages
551
Eh, I can't really help you if you don't want to clarify things. I still don't know if it's the stuttering problem or not. I'm not even certain you did what I suggested correctly.

Anyway you can upload the map, pictures, videos, etc.

The map would be the best solution since that tells me everything I need to know.
What do you mean? I listed concrete examples at the very beginning, stating specific given orders that were only partially executed. And the fact that they were executed by some of the picked units but not by others means that it wasn't my fault, otherwise none of the group's units would have obeyed.

Stuttering was one of the problem. Apparently, it worsened by more frequent periodic group order. When I set the periodic "pick every unit and move" order to 3 seconds from 0.5, they didn't seem so stuttering anymore.

I wouldn't want to upload my partially finish campaign map in a thread. However, every issue I've experienced are tied to the "pick units in region" type of orders. When I manually added units to an empty, temporary group and ordered members to explode, rather than "pick every units in region", they all exploded.
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,866
I meant no offense.

The issue is that comments like these are a bit too vague for me to work with:
I've tried the different team solution with the 4 unit group where one kept disobeying the order. Despite putting them in a brand new team, the result was the same.
Not to discredit your ability, but it's easy to make a minor mistake that throws everything off. For starters, Teams are NOT Players, so there's a clarification that would be helpful. "Yes, I meant Players, here's my trigger". Posting the triggers you're using helps a ton.

Anyway, maybe you can transfer the problems to a separate test map and upload that instead. Not too sure how that works with Campaigns, I've never actually bothered trying to make one. It'd be nice if someone more familiar with Campaigns could chime in, because it sounds like it might be a Campaign + AI related problem.
 
Level 12
Joined
Jul 5, 2014
Messages
551
I meant no offense.

The issue is that comments like these are a bit too vague for me to work with:

Not to discredit your ability, but it's easy to make a minor mistake that throws everything off. For starters, Teams are NOT Players, so there's a clarification that would be helpful. "Yes, I meant Players, here's my trigger". Posting the triggers you're using helps a ton.

Anyway, maybe you can transfer the problems to a separate test map and upload that instead. Not too sure how that works with Campaigns, I've never actually bothered trying to make one. It'd be nice if someone more familiar with Campaigns could chime in, because it sounds like it might be a Campaign + AI related problem.
But what I'm saying is that I don't know how I made a mistake. I'll show you a trigger for example, it's really not any more than what I've said.

  • Unit Group - Pick every unit in (Units in Footman Wondering <gen>) and do (Actions)
    • Loop - Actions
      • Unit - Explode (Picked unit)
There are 6 footmen in this region. Only 4-5 gets exploded by that order, even though they're standing within the region.


In this next trigger, I use TempGroup, which is initially empty, and I manually added the footmen earlier.

  • Unit Group - Add Reanimated Footman 0107 <gen> to TempGroup
  • Unit Group - Add Reanimated Footman 0106 <gen> to TempGroup
  • Unit Group - Add Reanimated Footman 0004 <gen> to TempGroup
  • Unit Group - Add Reanimated Footman 0008 <gen> to TempGroup
  • Unit Group - Add Reanimated Footman 0621 <gen> to TempGroup
  • Unit Group - Add Reanimated Footman 0018 <gen> to TempGroup
Then I do the explosion like this:

  • Unit Group - Pick every unit in TempGroup and do (Actions)
    • Loop - Actions
      • Unit - Explode (Picked unit)
That latter version properly exploded the footmen. But for some reason when the editor created a group via "pick every units in region", not all of them obeyed the action and I don't know why. All I know is that by manually adding units to the group worked.
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,866
Hmm, if you're using this:
  • Custom script: set bj_wantDestroyGroup = true
I would disable it for now. I vaguely remember it causing problems when dealing with certain "unit group functions".

Also, Exploding/Killing/Removing is not an Order, but that's not important.

Have you tried making the Region larger? Or is it already large enough to definitely contain the Footman. Because I remember that Regions in GUI can be a little buggy and are slightly offset. This issue comes up when using the Enters/Leaves region events.
 
Level 12
Joined
Jul 5, 2014
Messages
551
Yes, I'm using the group destroy script because I'm picking up a number of one time groups. You're saying I should leave it leaking?

The footman wondering region is like a 400x300 area. They're ordered to the random parts of it, and I'm fairly sure it's big enough for them.
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,866
Yes, I'm using the group destroy script because I'm picking up a number of one time groups. You're saying I should leave it leaking?
Yes, test to see if it's causing the problem.
The footman wondering region is like a 400x300 area. They're ordered to the random parts of it, and I'm fairly sure it's big enough for them.
That sounds pretty small, unless you're using the map size ratio which I believe is 128.00 units per 1 "size". Anyway, test it in a way that you're positive will work, remove all chances of randomness like Footman being "near the edge" for example. Worst case you can just add them to a constant Unit Group, that would be more efficient anyway.
 
Level 12
Joined
Jul 5, 2014
Messages
551
Yes, test to see if it's causing the problem.

That sounds pretty small, unless you're using the map size ratio which I believe is 128.00 units per 1 "size". Anyway, test it in a way that you're positive will work, remove all chances of randomness like Footman being "near the edge" for example. Worst case you can just add them to a constant Unit Group, that would be more efficient anyway.
I'll keep that in mind for the future but my manual adding group members and periodic order to move out bigger groups seems to solve the problem and after replaying this 5 minute scenario for over 100 times, I'm kinda tired of experimenting with it. I'm not sure if it has any logic because, for example, riflemen refused to move althogether when I issued a group order to the entire unit type of riflemen to go to a region.
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,866
I'll keep that in mind for the future but my manual adding group members and periodic order to move out bigger groups seems to solve the problem and after replaying this 5 minute scenario for over 100 times, I'm kinda tired of experimenting with it. I'm not sure if it has any logic because, for example, riflemen refused to move althogether when I issued a group order to the entire unit type of riflemen to go to a region.
If you use the Unit Group Order action it'll be limited to 12 Units, the tooltip mentions this. You should use this:
  • Set MyPoint = ...
  • Set MyUnitGroup = ....
  • Unit Group - Pick every unit in MyUnitGroup
    • Loop - Actions
      • Unit - Order (Picked unit) to Attack Move to MyPoint
Perhaps that's part of what has been causing the issue?
 
Level 12
Joined
Jul 5, 2014
Messages
551
If you use the Unit Group Order action it'll be limited to 12 Units, the tooltip mentions this. You should use this:
  • Set MyPoint = ...
  • Set MyUnitGroup = ....
  • Unit Group - Pick every unit in MyUnitGroup
    • Loop - Actions
      • Unit - Order (Picked unit) to Attack Move to MyPoint
Perhaps that's part of what has been causing the issue?
I used pick every unit and do action. I didn't mean the literal group order trigger. Also, there were only 4 riflemen, so unit-type group shouldn't have been an issue. The only time I order bigger number of units was the stuttering run case but the periodic order solved that one.
 
Top