• Check out the results of the Techtree Contest #19!
  • 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.
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!

Making CPU player units aggro as groups

Level 1
Joined
Dec 26, 2025
Messages
2
Hi to all you helpful players of Hive!

This question is regarding a campaign I'm making, and I don't have the knowledge to write my own AI. So I'm limited to AI editor, and don't use the melee AI.

When I attack a unit controlled by a cpu player all units nearby will respond and aggro. I'm assuming this is controlled by "guard distance". However, if I'm just moving in I can easily pull one or a few units away from the group. Is there an easy way of making all enemies that's close to each other attack together if I move within aquisition range of one?

I tried this in one of Turnro's campaigns and it seems he has nailed it. But it may ofc be AI scripts involved.
 
Here's a lazy way of doing it.

This trigger will alert nearby "idle" Computer-owned units whenever a friendly unit is attacked:
  • Custom Aggro
    • Events
      • Unit - A unit Is attacked
    • Conditions
    • Actions
      • Set VariableSet Aggro_Source = (Attacking unit)
      • Set VariableSet Aggro_Target = (Attacked unit)
      • Set VariableSet Aggro_Source_Owner = (Owner of Aggro_Source)
      • Set VariableSet Aggro_Target_Owner = (Owner of Aggro_Target)
      • -------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Aggro_Target_Owner controller) Equal to Computer
          • (Aggro_Source_Owner is an enemy of Aggro_Target_Owner.) Equal to True
        • Then - Actions
          • -------- Define the initial "call for help" radius. This is used to attract nearby friends of the attacked unit: --------
          • Set VariableSet Aggro_Range = 2000.00
          • -------- --------
          • Set VariableSet Aggro_Point[0] = (Position of Aggro_Target)
          • Set VariableSet Aggro_Group = (Units within Aggro_Range of Aggro_Point[0].)
          • -------- --------
          • -------- Define the secondary "call for help" radius. This is used to help attract "friends of friends", creating a sort of ripple effect: --------
          • Set VariableSet Aggro_Range = 800.00
          • -------- --------
          • Unit Group - Remove Aggro_Target from Aggro_Group.
          • Unit Group - Pick every unit in Aggro_Group and do (Actions)
            • Loop - Actions
              • Set VariableSet Aggro_Friend = (Picked unit)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Aggro_Friend belongs to an ally of Aggro_Target_Owner.) Equal to True
                  • (Current order of Aggro_Friend) Equal to (Order(stand down))
                  • (Aggro_Friend is A structure) Equal to False
                • Then - Actions
                  • Unit - Order Aggro_Friend to Attack-Move To Aggro_Point[0]
                • Else - Actions
                  • Unit Group - Remove Aggro_Friend from Aggro_Group.
          • -------- --------
          • Unit Group - Pick every unit in Aggro_Group and do (Actions)
            • Loop - Actions
              • Set VariableSet Aggro_Friend = (Picked unit)
              • Set VariableSet Aggro_Point[1] = (Position of Aggro_Friend)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Current order of Aggro_Friend) Equal to (Order(stand down))
                • Then - Actions
                  • Unit - Order Aggro_Friend to Attack-Move To Aggro_Point[0]
                • Else - Actions
              • Custom script: call RemoveLocation( udg_Aggro_Point[1] )
          • -------- --------
          • Custom script: call RemoveLocation( udg_Aggro_Point[0] )
          • Custom script: call DestroyGroup( udg_Aggro_Group )
          • -------- --------
          • -------- To help improve map performance, let's limit how often this trigger can run: --------
          • Trigger - Turn off Custom Aggro <gen>
          • Wait 0.20 game-time seconds
          • Trigger - Turn on Custom Aggro <gen>
        • Else - Actions
 

Attachments

Thank you so much for taking the time to write a trigger for it! Unfortunately I wasn't clear enough in my OP.

Everything works as I want it to by default when I'm attacking a cpu unit.

What I want to happen is that when I just move within a certain range of any cpu-player enemy unit, all their units within a certain range of the closest unit should attack. To avoid being able to "pull" cpu units by walking into aquisition range.
Neutral Hostile creeps behave like this. But not cpu units.

In contrast to what I wrote in my OP I believe the constant that makes groups of units attack when one unit is attacked is the "call for help distance". The "creeps - guard distance" I think makes creeps attack as a group when a unit comes close. So if I could in some way apply "creeps - guard distance" to cpu-player units that would be great.
 
Back
Top