• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Trigger] Small problem with Selection

Status
Not open for further replies.
Level 20
Joined
Jan 6, 2008
Messages
2,627
I got this trigger:
  • Leakless
    • Events
      • Player - Player 1 (Red) Selects a unit
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Dummy Inventory Slot
    • Actions
      • Unit - Remove Unit from the game
      • Unit Group - Pick every unit in (Units in Region 008 <gen>) and do (Actions)
        • Loop - Actions
          • Unit - Remove (Picked unit) from the game
The problem is that the units wont be deleted if you select 2 of the same unit. Your supposed to hit 2 buttons, and the 1 button shows up a cat, the seconds button shows up an human, but if you choose both. Both will show up, and only one of them gets deleted.
 
Last edited:
Then, you can make a unit group that has units under current selection of Player 1 (Red):
  • Leakless
  • Events
    • Player - Player 1 (Red) Selects a unit
  • Conditions
    • (Unit-type of (Triggering unit)) Equal to Dummy Inventory Slot
  • Actions
    • Unit - Remove Unit from the game
    • Set Temp_Group = (Units currently selected by Player 1 (Red))
    • If/ Then/ Else
      • If (Conditions)
        • (Number of units in (Temp_Group) Greater than 1
      • Then (Actions)
        • Set Temp_Group2 = (Units in Region 008 <gen>)
        • Unit Group - Pick every unit in (Units in Region 008 <gen>) and do (Actions)
          • Loop - Actions
            • Unit - Remove (Picked unit) from the game
        • Custom script: call DestroyGroup (udg_Temp_Group2)
    • Custom script: call DestroyGroup (udg_Temp_Group)
 
Level 14
Joined
Mar 4, 2009
Messages
1,156
Then, you can make a unit group that has units under current selection of Player 1 (Red):
  • Leakless
  • Events
    • Player - Player 1 (Red) Selects a unit
  • Conditions
    • (Unit-type of (Triggering unit)) Equal to Dummy Inventory Slot
  • Actions
    • Unit - Remove Unit from the game
    • Set Temp_Group = (Units currently selected by Player 1 (Red))
    • If/ Then/ Else
      • If (Conditions)
        • (Number of units in (Temp_Group) Greater than 1
      • Then (Actions)
        • Set Temp_Group2 = (Units in Region 008 <gen>)
        • Unit Group - Pick every unit in (Units in Region 008 <gen>) and do (Actions)
          • Loop - Actions
            • Unit - Remove (Picked unit) from the game
        • Custom script: call DestroyGroup (udg_Temp_Group2)
    • Custom script: call DestroyGroup (udg_Temp_Group)
it needs to be like this
Unit Group - Pick every unit in (Temp_Group2) and do (Actions)
....
 
Status
Not open for further replies.
Top