• 🏆 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!

Pick every unit type in region and

Status
Not open for further replies.
Level 2
Joined
Jul 29, 2011
Messages
9
Does such Action Trigger exist? I have been trying to figure this out for like an hour. There is a region, in that region there are 5 grunts and 5 footmen. Now, I am trying to find an Action to kill all the footmen in that region.

-I don't want to assign unitgroups
-I don't want to assign each footman into individual Actions

Thank you in advance.
 
Level 25
Joined
Jul 10, 2006
Messages
3,315
You need to assign a unit group to prevent getting a memory leak (which can lead to lag).

It's simple:
  • Set group1 = (Units in (Playable map area))
  • Unit Group - Pick every unit in group1 and do (Actions)
    • Loop - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Picked unit)) Equal to Footman
        • Then - Actions
          • Unit - Kill (Picked unit)
        • Else - Actions
  • Custom script: call DestroyGroup(udg_group1)
 
Level 21
Joined
Nov 4, 2013
Messages
2,017
Simple. Use Units In Region Matching Condition. The condition will be Unit-type comparison where you'll do this: Unit-type of (Matching unit) Equal to Footman. You should get this:

  • Unit Group - Pick every unit in (Units in (Your region) matching ((Unit-type of (Matching unit)) Equal to Footman)) and do (Unit - Kill (Picked unit))
That's all but this will leak so you will need to assign these units to a unit group so that you can destroy it eventually.

  • Set UnitGroup = Units in (Your region) matching (Unit-type of ((Matching unit)) Equal to Footman))
  • Unit Group - Pick every unit in UnitGroup and do (Unit - Kill (Picked unit))
  • Custom script: call DestroyGroup(udg_UnitGroup)
 
Level 2
Joined
Jul 29, 2011
Messages
9
Simple. Use Units In Region Matching Condition. The condition will be Unit-type comparison where you'll do this: Unit-type of (Matching unit) Equal to Footman. You should get this:

  • Unit Group - Pick every unit in (Units in (Your region) matching ((Unit-type of (Matching unit)) Equal to Footman)) and do (Unit - Kill (Picked unit))
That's all but this will leak so you will need to assign these units to a unit group so that you can destroy it eventually.

  • Set UnitGroup = Units in (Your region) matching (Unit-type of ((Matching unit)) Equal to Footman))
  • Unit Group - Pick every unit in UnitGroup and do (Unit - Kill (Picked unit))
  • Custom script: call DestroyGroup(udg_UnitGroup)

Oh, okay.

Thank you, guys.

TIL about memory leaks, and had to go through countless of cinematic triggers to remove them. Thanks!
 
Status
Not open for further replies.
Top