• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[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 13
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