Selecting a single unit from a group may not count as a selection event (strangely.) You can try having a running loop check the number of units selected. If the number of units selected = 1, check which squad the selected unit belongs to and add all of those units in that squad to the player's selection.
Here's a basic rundown of setting up a loop:
By the way, these are all off of the top of my head so the phrasing might be a bit different in the editor.
For checking a squad array and then adding a unit group to that variable:
You should make any running loops operate in their own thread, which means either put it in an action definition and check the Create Thread option or create a separate trigger for it.
Make the variable Squad an array. Set the size of the array to the maximum number of squads that would exist on the map at any given time. So if each player can have a maximum of 5 squads and there are 10 players, set it to 50. Then when a squad is created, create a loop that checks every Squad unit group from 1 to 50 and when it finds one that is empty (number of units in Squad[x] = 0) assign the squad to that Squad variable and break the loop.
For the selection, try completely clearing the player's selection before selecting all of the units in the group. There's an action called "Clear Selected Units" or something similar that will do this.
You will probably need to add the units to a unique Unit Group variable to keep track of them. Do this when they are created.
I believe there is a Unit Is Selected event that you could use to start things off. If a unit from your unit group (we'll call it Squad for now) triggers the event, select all units in unit group Squad.
Under conditions, use a check to see if (Selected Unit) is in Squad == true.
Under actions, pick each unit in Squad and add them to the triggering player's selection.
Try that and see how it goes.
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
@TGCID281: Go
Selecting a single unit from a group may not count as a selection event (strangely.) You can try having a running loop check the number of units selected. If the number of units selected = 1, check which squad the selected unit belongs to and add all of those units in that squad to the player's selection.
Here's a basic rundown of setting up a loop: By the way, these are all off of the top of my head so the phrasing might be a bit different in the editor. For checking a squad array and then adding a unit group to that variable:
Creating a running loop (for checking the unit selection):
You should make any running loops operate in their own thread, which means either put it in an action definition and check the Create Thread option or create a separate trigger for it.
Make the variable Squad an array. Set the size of the array to the maximum number of squads that would exist on the map at any given time. So if each player can have a maximum of 5 squads and there are 10 players, set it to 50. Then when a squad is created, create a loop that checks every Squad unit group from 1 to 50 and when it finds one that is empty (number of units in Squad[x] = 0) assign the squad to that Squad variable and break the loop.
For the selection, try completely clearing the player's selection before selecting all of the units in the group. There's an action called "Clear Selected Units" or something similar that will do this.
You will probably need to add the units to a unique Unit Group variable to keep track of them. Do this when they are created.
I believe there is a Unit Is Selected event that you could use to start things off. If a unit from your unit group (we'll call it Squad for now) triggers the event, select all units in unit group Squad.
Under conditions, use a check to see if (Selected Unit) is in Squad == true.
Under actions, pick each unit in Squad and add them to the triggering player's selection.
Try that and see how it goes.