[General] Command Group help

Status
Not open for further replies.
Level 6
Joined
May 13, 2023
Messages
72
Hi, So basically I have a Unit Group that's used for Commands only.
  • Host Select
    • Events
      • Player - Player 1 (Red) Selects a unit
    • Conditions
      • (Triggering player) Equal to Host
    • Actions
      • Unit Group - Add (Triggering unit) to HostControlUnit
If host(Player1) types .c every units selected by Player1 will have it's cooldown removed see below. Which works fine, but the main problem is whenever I select new unit then use the command, the previous Unit still benefit from it and have it's cooldown removed.
  • Host Unit CD Removal
    • Events
      • Player - Player 1 (Red) types a chat message containing .c as An exact match
    • Conditions
    • Actions
      • Unit Group - Pick every unit in HostControlUnit and do (Actions)
        • Loop - Actions
          • Unit - Reset ability cooldowns for (Picked unit)
My solution 1 Ofcourse I tried removing the unit from the Unit Group after using the command like below. But this solution makes it so that I have to keep selecting the unit after each command
  • Host Unit CD Removal
    • Events
      • Player - Player 1 (Red) types a chat message containing .c as An exact match
    • Conditions
    • Actions
      • Unit Group - Pick every unit in HostControlUnit and do (Actions)
        • Loop - Actions
          • Unit - Reset ability cooldowns for (Picked unit)
      • Unit Group - Pick every unit in HostControlUnit and do (Actions)
        • Loop - Actions
          • Unit Group - Remove (Picked unit) from HostControlUnit
My solution 2 I tried removing the unit everytime new units selected, this solution does work meaning I don't have to keep selecting the same unit, but this only works with 1 unit at a time which i also don't want.
  • Host Select
    • Events
      • Player - Player 1 (Red) Selects a unit
    • Conditions
      • (Triggering player) Equal to Host
    • Actions
      • Unit Group - Pick every unit in HostControlUnit and do (Actions)
        • Loop - Actions
          • Unit Group - Remove (Picked unit) from HostControlUnit
      • Unit Group - Add (Triggering unit) to HostControlUnit
So basically is there a way to have the Unit benefit from the commands as long as I don't select a new unit and If I do select a new the previous one cannot benefit from the command.
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,866
You're never removing deselected units from the Unit Group.
  • Host Deselect
    • Events
      • Player - Player 1 (Red) Deselects a unit
    • Conditions
      • (Triggering player) Equal to Host
    • Actions
      • Unit Group - Remove (Triggering unit) from HostControlUnit
There's two types of Selections, Select and Deselect.

Note that this Event can be a bit slow when playing online.

Also, is this necessary?
  • (Triggering player) Equal to Host
The trigger only runs for Player 1 (Red).
 
Level 6
Joined
May 13, 2023
Messages
72
Also, is this necessary?
  • if.gif
    (Triggering player) Equal to Host
The trigger only runs for Player 1 (Red).
Yeah I only did it to systemize the triggers
There's two types of Selections, Select and Deselect.
How does the Deselect event even work I understand that selection happens everytime unit is selected but there isn't any way to directly deselect a unit so does it occur when player selects a new unit?
 
Level 6
Joined
May 13, 2023
Messages
72
You're never removing deselected units from the Unit Group.
  • base.gif
    Host Deselect
    • joinminus.gif
      events.gif
      Events
      • line.gif
        joinbottom.gif
        player.gif
        Player - Player 1 (Red) Deselects a unit
    • joinminus.gif
      cond.gif
      Conditions
      • line.gif
        joinbottom.gif
        if.gif
        (Triggering player) Equal to Host
    • joinbottomminus.gif
      actions.gif
      Actions
      • empty.gif
        joinbottom.gif
        unitgroup.gif
        Unit Group - Remove (Triggering unit) from HostControlUnit
Tnx it works fine now, I did have this event but the problem was I was removing every unit from the group.
 
Status
Not open for further replies.
Top