• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[General] Select ALL Units

Status
Not open for further replies.
Level 1
Joined
Oct 30, 2018
Messages
6
Hello, guys!

Planning to make a little event for Halloween with cinematics showing two teams attack each other wall-by-wall.

Compiled a test map and spent a day to find out how to make Red Player Units to be selected all (seems there's some limitation to 12).

Is there any method to select all Units at once or some workaround?

Thanks a lot.
 

Attachments

  • Test1.w3x
    22.4 KB · Views: 43
Level 11
Joined
May 29, 2008
Messages
133
A good tool for giving the player the ability to order all units is to provide some sort of "Control Tower". Create a unit, give it some no-effect point targeted ability with global range. Give each player one of these Control Towers. Whenever a control tower casts the spell, select all units owned by the owner of the casting unit and order them to attack move to the location.
 
Level 1
Joined
Oct 30, 2018
Messages
6
Hello. Thanks for Advices.


So, I cannod do ONE big group. And this doesn't work:
upload_2018-11-1_11-18-32.png



Instead I should do:
upload_2018-11-1_11-20-33.png


upload_2018-11-1_11-17-52.png

"


Halithor, Kind of too difficult for me yet))


And.. I temporary solved the issue w/o any group variables, preventin more than 12 units in a region issue:
upload_2018-11-1_11-25-29.png


BUT, one more problem.. after battle is finished I need the survivors to go to certain point and if I do use Pick Units in Region command it doesn't pick all of alive units (probably it picks the dead ones as well randomly). So, though it's less than 12 units remaining alive after the battle, sometimes it doesn't pick them all... (sorry for russian lang in editor)
upload_2018-11-1_11-26-42.png


I believe can fix it with Group Variables as explained by Pyrogasm
 

Wrda

Spell Reviewer
Level 26
Joined
Nov 18, 2012
Messages
1,898
I don't understand why you use Group - Order group1 to attack...
You should only use it in the cases you want the group to form a formation while moving/attacking.
You shouldn't also "Pick every unit in (Units owned by...) and do" "Group - Order (Units owned by...) to..."
That's redundant, you're repeating the same thing, after picking every unit you should just do "Unit - Order (Picked Unit) to..." this would order more than 12 units at same time.
 
Level 1
Joined
Oct 30, 2018
Messages
6
Yes, you're right, got it.

Solved as soon as I got how to use Variables for groups.

Picking by region wasn't a good idea, because dead units counts as well.

Issue closed with using vaiables for groups. THanks everybody.
 
Level 39
Joined
Feb 27, 2007
Messages
5,038
A unit group can have many more than 12 units at a time, and regions similarly have no limit on their number of units that can be picked from them. The limitation is only on players manually selecting units in-game by clicking (or drag-select) because the UI won't let you select more than 12.

To accomplish what you want I would make 1 region for all the red units and 1 region for all the blue units, then do this:

  • Set Center1 = Center of BLUE_REGION <gen>
  • Set Center2 = Center of RED_REGION <gen>
  • Set group1 = (Units in RED_REGION <gen>)
  • Set group2 = (Units in BLUE_REGION <gen>)
  • Unit Group - Order group1 to Attack-Move to Center1
  • Unit Group - Order group2 to Attack-Move to Center2
  • Custom script: call RemoveLocation(udg_Center1) //these clean point leaks, change the part inside () to match the name of your variable, but keep the udg_ prefix
  • Custom script: call RemoveLocation(udg_Center2) //same
Then you need a trigger that catches when units in these groups die and removes them from the group, thus leaving you with a 'winning' group at the end without any dead units:

  • Events
    • Unit - A unit dies
  • Conditions
    • Or - Any condition is true
      • ((Triggering Unit) is in group1) equal to true
      • ((Triggering Unit) is in group2) equal to true
  • Actions
    • Unit Group - Remove (Triggering Unit) from group1
    • Unit Group - Remove (Triggering Unit) from group2
    • If (All conditions are true) then do (Then actions) else do (Else actions)
      • If - Conditions
        • Or - Any condition is true
          • (Number of units in group1) equal to 0
          • (Number of units in group2) equal to 0
      • Then - Actions
        • Trigger - Turn off (This trigger)
        • Set MovePoint = (Center of VICTORY_REGION <gen>)
        • Unit Group - Order group1 to Move to MovePoint
        • Unit Group - Order group2 to Move to MovePoint
        • -------- do other victory stuff here --------
        • Custom script: call RemoveLocation(udg_MovePoint) //cleaning the point leak, make sure to change the variable name but keep the udg_
        • Custom script: call DestroyGroup(udg_group1) //you might or might not want to do this here, but this cleans the group 'leaks' if you're not going to use group1 or group2 again
        • Custom script: call DestroyGroup(udg_group2) //also change the names here to match but keep the udg_
      • Else - Actions
 
Level 11
Joined
May 29, 2008
Messages
133
If you want a simple way to just order all of Red's units to charge east and all of Blue's units to charge west, these actions will do that for you. If you want to send the order right at game start, use the Map Initialization event or Game Time Elapsed events.
  • Actions
    • Unit Group - Pick every unit in (Units owned by Player 1 (Red)) and do (Actions)
      • Loop - Actions
        • Unit - Order (Picked unit) to Attack-Move To ((Position of (Picked unit)) offset by 2000.00 towards 0.00 degrees)
    • Unit Group - Pick every unit in (Units owned by Player 2 (Blue)) and do (Actions)
      • Loop - Actions
        • Unit - Order (Picked unit) to Attack-Move To ((Position of (Picked unit)) offset by 2000.00 towards 180.00 degrees)
To check if all the units owned by either player are dead and order the other player's to move somewhere if they are units if they are, try this:
  • DeathCheck
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Units owned by Player 1 (Red) matching (((Matching unit) is alive) Equal to True)) is empty) Equal to True
        • Then - Actions
          • Unit Group - Pick every unit in (Units owned by Player 2 (Blue)) and do (Actions)
            • Loop - Actions
              • Unit - Order (Picked unit) to Attack-Move To (Center of (Playable map area))
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Units owned by Player 2 (Blue) matching (((Matching unit) is alive) Equal to True)) is empty) Equal to True
        • Then - Actions
          • Unit Group - Pick every unit in (Units owned by Player 1 (Red)) and do (Actions)
            • Loop - Actions
              • Unit - Order (Picked unit) to Attack-Move To (Center of (Playable map area))
        • Else - Actions
Yes these leak, but it really doesn't matter in the context of a cinematic or a simple, short game. The examples are less confusing without the overhead of leak cleanup.
 
Status
Not open for further replies.
Top