Attack-move

Level 9
Joined
Aug 26, 2016
Messages
204
Hi=), I encountered a problem when units of about 70 receive an order to attack me, they start to freeze in place, and I did it without a timer.
  • dont stop moving
    • Events
      • Unit - A unit Is issued an order with no target
    • Conditions
      • (Issued order) Equal to (Order(stop))
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Owner of (Ordered unit)) Equal to Player 11 (Dark Green)
        • Then - Actions
          • Unit - Order (Ordered unit) to Attack-Move To (Position of MainHero_2[1])
        • Else - Actions
  • OrderStart
    • Events
      • Unit - A unit enters Region 059 <gen>
    • Conditions
      • (Owner of (Entering unit)) Equal to Player 11 (Dark Green)
    • Actions
      • Unit Group - Pick every unit in (Random 1 units from (Units in Region 059 <gen>)) and do (Actions)
        • Loop - Actions
          • Unit - Order (Picked unit) to Attack-Move To (Position of MainHero_2[1])
 
I think the position of MainHero_2 is temporary, therefore leaks.
Same with temporary unitgroups.
Check: Things That Leak

What are you trying to achieve with the OrderStart trigger?
a) make it so that the entering unit owned by player X attacks MainHero_2, or
b) all units in the region (owned by the triggering player) go over to attack
c) do you actually want a singular random unit to attack-move (seems like a weird concept)

I think you want b) which should look like this:
  • dont stop moving
    • Events
      • Unit - A unit Is issued an order with no target
    • Conditions
      • (Issued order) Equal to (Order(stop))
      • (Owner of (Triggering unit)) Equal to Player 1 (Red)
    • Actions
      • Set VariableSet temp_point = (Position of Paladin 0010 <gen>)
      • Unit - Order (Triggering unit) to Attack-Move To temp_point
      • Custom script: call RemoveLocation(udg_temp_point)
  • order start
    • Events
      • Unit - A unit enters TestRect <gen>
    • Conditions
      • (Owner of (Triggering unit)) Equal to Player 1 (Red)
    • Actions
      • Set VariableSet temp_point = (Position of Paladin 0010 <gen>)
      • Set VariableSet temp_unitgroup = (Units in TestRect <gen> owned by Player 1 (Red))
      • Unit - Order (Triggering unit) to Attack-Move To temp_point
      • Unit Group - Pick every unit in temp_unitgroup and do (Actions)
        • Loop - Actions
          • Unit - Order (Picked unit) to Attack-Move To temp_point
      • Custom script: call DestroyGroup(udg_temp_unitgroup)
      • Custom script: call RemoveLocation(udg_temp_point)
Then again, a freeze is to be expected with a number that large of units ordered per player (wc3 path finding).
(i.e. 50 units per player for 10 players (500 in total) wouldn't lag as much as 500 units on one player)
1. You can try to reduce their collision size to 16, or even 8 which helps a bit.
2. Try to get around ordering a large number of units at once. Split them into several squads and avoid clumping them up.
3. Use more player slots as described and 50-80 units max per slot.
 
I think the position of MainHero_2 is temporary, therefore leaks.
Same with temporary unitgroups.
Check: Things That Leak

What are you trying to achieve with the OrderStart trigger?
a) make it so that the entering unit owned by player X attacks MainHero_2, or
b) all units in the region (owned by the triggering player) go over to attack
c) do you actually want a singular random unit to attack-move (seems like a weird concept)

I think you want b) which should look like this:
  • dont stop moving
    • Events
      • Unit - A unit Is issued an order with no target
    • Conditions
      • (Issued order) Equal to (Order(stop))
      • (Owner of (Triggering unit)) Equal to Player 1 (Red)
    • Actions
      • Set VariableSet temp_point = (Position of Paladin 0010 <gen>)
      • Unit - Order (Triggering unit) to Attack-Move To temp_point
      • Custom script: call RemoveLocation(udg_temp_point)
  • order start
    • Events
      • Unit - A unit enters TestRect <gen>
    • Conditions
      • (Owner of (Triggering unit)) Equal to Player 1 (Red)
    • Actions
      • Set VariableSet temp_point = (Position of Paladin 0010 <gen>)
      • Set VariableSet temp_unitgroup = (Units in TestRect <gen> owned by Player 1 (Red))
      • Unit - Order (Triggering unit) to Attack-Move To temp_point
      • Unit Group - Pick every unit in temp_unitgroup and do (Actions)
        • Loop - Actions
          • Unit - Order (Picked unit) to Attack-Move To temp_point
      • Custom script: call DestroyGroup(udg_temp_unitgroup)
      • Custom script: call RemoveLocation(udg_temp_point)
Then again, a freeze is to be expected with a number that large of units ordered per player (wc3 path finding).
(i.e. 50 units per player for 10 players (500 in total) wouldn't lag as much as 500 units on one player)
1. You can try to reduce their collision size to 16, or even 8 which helps a bit.
2. Try to get around ordering a large number of units at once. Split them into several squads and avoid clumping them up.
3. Use more player slots as described and 50-80 units max per slot.
ZA BESTO PATRON!
 
  • OrderStartGreen
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Set VariableSet TempPoint1 = (Position of MainHero_2[1])
      • Set VariableSet CreepGroup = (Units in Region 020 <gen> owned by Player 11 (Dark Green))
      • Unit Group - Pick every unit in CreepGroup and do (Actions)
        • Loop - Actions
          • Unit - Order (Picked unit) to Attack-Move To TempPoint1
          • AI - Ignore the guard positions of all Player 11 (Dark Green) units
      • Custom script: call DestroyGroup(udg_CreepGroup)
      • Custom script: call RemoveLocation(udg_TempPoint1)
  • Dead
    • Events
      • Unit - A unit owned by Player 11 (Dark Green) Dies
    • Conditions
    • Actions
      • Unit Group - Remove (Dying unit) from CreepGroup.
      • Unit Group - Pick every unit in (Units in Region 059 <gen> owned by Neutral Hostile) 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 MobPoint (2)
            • Then - Actions
              • Unit - Create 1 MobType[(Random integer number between 1 and 7)] for Player 11 (Dark Green) at (Position of (Picked unit)) facing Default building facing degrees
            • Else - Actions
  • dont stop moving
    • Events
      • Unit - A unit enters Region 020 <gen>
    • Conditions
      • (Owner of (Triggering unit)) Equal to Player 11 (Dark Green)
    • Actions
      • Set VariableSet TempPoint1 = (Position of MainHero_2[1])
      • AI - Ignore (Triggering unit)'s guard position
      • Unit - Order (Triggering unit) to Attack-Move To TempPoint1
      • Custom script: call RemoveLocation(udg_TempPoint1)
I tried distributing the load between the colors of the computers and did something similar, but as soon as I move, the mobs freeze in place...
 
Last edited:
You are ordering all the units in Creepgroup every second, that's asking for trouble.
At least put a condition, like "(Current order of Picked unit Equal to (Order(stand))" so already moving units do not fire again.

Second trigger leaks group and location and it seems you want to spawn a new mob when one dies.
If so, you don't have to pick all units whatsoever.
Simply do:
  • Mob Death
    • Events
      • Unit - A unit owned by Player 11 (Dark Green) Dies
    • Conditions
    • Actions
      • Unit Group - Remove (Triggering unit) from (CreepGroup).
      • Unit - Create 1 MobType for Player 11 (Dark Green) at Center of(Region 59)) facing Default building facing degrees
      • Unit Group - Add (Last created unit) to (CreepGroup).
(does not leak a location if you keep using center of Region 59)

How did you go about distributing the load?
How many units are there?
 
3 computers with 20 mobs.

Here's another option, I've already tried a lot of things, but it doesn't really work out yet.
  • OrderStartGreen
    • Events
      • Time - Every 10.00 seconds of game time
    • Conditions
    • Actions
      • Set VariableSet TempPoint1 = (Position of MainHero_2[1])
      • Unit Group - Pick every unit in (Units in Region 059 <gen> owned by Player X) and do (Actions)
        • Loop - Actions
          • AI - Ignore the guard positions of all Player X) units
          • Unit - Order (Picked unit) to Attack-Move To TempPoint1
      • Custom script: call RemoveLocation(udg_TempPoint1)
  • dont stop moving
    • Events
      • Time - Every 10.00 seconds of game time
    • Conditions
    • Actions
      • Set VariableSet TempPoint1 = (Position of MainHero_2[1])
      • Unit Group - Pick every unit in (Random 1 units from (Units in Region 059 <gen> owned by Player X)) and do (Actions)
        • Loop - Actions
          • AI - Ignore (Picked unit)'s guard position
          • Unit - Order (Picked unit) to Attack-Move To TempPoint1
      • Custom script: call RemoveLocation(udg_TempPoint1)
 
With 60 something mobs it shouldn't lag much, if at all.
I suspect more going on, probably more faulty/inefficient triggers.

At this point you can share the map, or research deeper (lots of decade old, but still relevant threads out there).
 
With 60 something mobs it shouldn't lag much, if at all.
I suspect more going on, probably more faulty/inefficient triggers.

At this point you can share the map, or research deeper (lots of decade old, but still relevant threads out there).
The map weighs over 150 megabytes.

I tried it like this.
  • OrderStartGreen
    • Events
      • Time - Every 15.00 seconds of game time
    • Conditions
    • Actions
      • Set VariableSet TempPoint1 = (Position of MainHero_2[1])
      • Set VariableSet CreepGroup = (Units in Region 020 <gen> owned by Player 11 (Dark Green))
      • Set VariableSet CreepGroup2 = (Units in Region 020 <gen> owned by Player 13 (Maroon))
      • Set VariableSet CreepGroup3 = (Units in Region 020 <gen> owned by Player 14 (Navy))
      • Unit Group - Pick every unit in CreepGroup and do (Actions)
        • Loop - Actions
          • AI - Ignore the guard positions of all Player 11 (Dark Green) units
          • Unit - Order (Picked unit) to Attack-Move To TempPoint1
      • Unit Group - Pick every unit in CreepGroup2 and do (Actions)
        • Loop - Actions
          • AI - Ignore the guard positions of all Player 13 (Maroon) units
          • Unit - Order (Picked unit) to Attack-Move To TempPoint1
      • Unit Group - Pick every unit in CreepGroup3 and do (Actions)
        • Loop - Actions
          • AI - Ignore the guard positions of all Player 14 (Navy) units
          • Unit - Order (Picked unit) to Attack-Move To TempPoint1
      • Custom script: call RemoveLocation(udg_TempPoint1)
      • Custom script: call DestroyGroup(udg_CreepGroup)
      • Custom script: call DestroyGroup(udg_CreepGroup2)
      • Custom script: call DestroyGroup(udg_CreepGroup3)
I tried different options, but in the end nothing works.
 
  • RandomSpawnSystem
    • Events
      • Time - Mob expires
    • Conditions
    • Actions
      • Set VariableSet TempPoint1 = (Position of MainHero_2[1])
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in (Units in Region 020 <gen> owned by Player 6 (Orange))) Not equal to 99
        • Then - Actions
          • Game - Display to (All players) the text: (String(((Number of units in (Units in Region 020 <gen> owned by Player 6 (Orange))) + ((Number of units in (Units in Region 020 <gen> owned by Player 7 (Green))) + (Number of units in (Units in Region 020 <gen> owned by Player 8 (Pink)))))))
          • Unit - Create 1 MobType[(Random integer number between 1 and 7)] for Player 6 (Orange) at (Random point in Region 059 <gen>) facing Default building facing degrees
          • Unit - Order (Last created unit) to Attack-Move To TempPoint1
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in (Units in Region 020 <gen> owned by Player 7 (Green))) Not equal to 99
        • Then - Actions
          • Unit - Create 1 MobType[(Random integer number between 1 and 7)] for Player 7 (Green) at (Random point in Region 059 <gen>) facing Default building facing degrees
          • Unit - Order (Last created unit) to Attack-Move To TempPoint2
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in (Units in Region 020 <gen> owned by Player 8 (Pink))) Not equal to 99
        • Then - Actions
          • Unit - Create 1 MobType[(Random integer number between 1 and 7)] for Player 8 (Pink) at (Random point in Region 059 <gen>) facing Default building facing degrees
          • Unit - Order (Last created unit) to Attack-Move To TempPoint3
        • Else - Actions
          • Countdown Timer - Pause Mob
      • Custom script: call RemoveLocation(udg_TempPoint1)
  • Orders
    • Events
      • Time - Every 3.00 seconds of game time
    • Conditions
    • Actions
      • Set VariableSet TempPoint1 = (Position of MainHero_2[1])
      • Set VariableSet CreepGroup = (Random 12 units from (Units in Region 059 <gen> owned by Player 6 (Orange)))
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in CreepGroup and do (Actions)
        • Loop - Actions
          • Unit - Order (Picked unit) to Attack-Move To TempPoint1
      • Set VariableSet CreepGroup2 = (Random 12 units from (Units in Region 059 <gen> owned by Player 7 (Green)))
      • Unit Group - Pick every unit in CreepGroup2 and do (Actions)
        • Loop - Actions
          • Unit - Order (Picked unit) to Attack-Move To TempPoint1
      • Set VariableSet CreepGroup3 = (Random 12 units from (Units in Region 059 <gen> owned by Player 8 (Pink)))
      • Unit Group - Pick every unit in CreepGroup3 and do (Actions)
        • Loop - Actions
          • Unit - Order (Picked unit) to Attack-Move To TempPoint1
      • Custom script: call DestroyGroup(udg_CreepGroup)
      • Custom script: call DestroyGroup(udg_CreepGroup2)
      • Custom script: call DestroyGroup(udg_CreepGroup3)
      • Custom script: call RemoveLocation(udg_TempPoint1)
I managed to do something, but unfortunately, after the last point the hero left, they run back after the order trigger is triggered, they turn around and run towards the hero, from the side, like ants, they run all over the map, but to no avail...
 
Skimmed through the thread so this might not apply anymore, but often times you cannot Issue an Order in response to an Order (Event).

This works as a fix:
  • Unit - Pause (Your unit)
  • Unit - Order (Your unit) to ...
  • Unit - Unpause (Your unit)
Beware of side effects. For example, I believe this will issue the new Order multiple times in a row.
 
Last edited:
@Nichilus
Well that's good to know!

@Nikita17
It's still a strange setup, because you might accidentally order the same/some of the same 1-12 random units.
And why are you using Custom script: set bj_wantDestroyGroup = true + ustom script: call DestroyGroup(udg_CreepGroup)?
 
  • RandomSpawnSystem
    • Events
      • Time - Mob expires
    • Conditions
    • Actions
      • Set VariableSet TempPoint1 = (Position of MainHero_2[1])
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in (Units in Region 020 <gen> owned by Player 6 (Orange))) Not equal to 77
        • Then - Actions
          • Game - Display to (All players) the text: (String(((Number of units in (Units in Region 020 <gen> owned by Player 6 (Orange))) + ((Number of units in (Units in Region 020 <gen> owned by Player 7 (Green))) + (Number of units in (Units in Region 020 <gen> owned by Player 8 (Pink)))))))
          • Unit - Create 1 MobType[(Random integer number between 1 and 7)] for Player 6 (Orange) at (Random point in Region 059 <gen>) facing Default building facing degrees
          • AI - Ignore the guard positions of all Player 7 (Green) units
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in (Units in Region 020 <gen> owned by Player 7 (Green))) Not equal to 77
        • Then - Actions
          • Unit - Create 1 MobType[(Random integer number between 1 and 7)] for Player 7 (Green) at (Random point in Region 059 <gen>) facing Default building facing degrees
          • AI - Ignore the guard positions of all Player 6 (Orange) units
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in (Units in Region 020 <gen> owned by Player 8 (Pink))) Not equal to 77
        • Then - Actions
          • Unit - Create 1 MobType[(Random integer number between 1 and 7)] for Player 8 (Pink) at (Random point in Region 059 <gen>) facing Default building facing degrees
          • AI - Ignore the guard positions of all Player 8 (Pink) units
        • Else - Actions
          • Countdown Timer - Pause Mob
      • Custom script: call RemoveLocation(udg_TempPoint1)
  • Orders
    • Events
      • Time - Every 5.00 seconds of game time
    • Conditions
    • Actions
      • Set VariableSet TempPoint1 = (Position of MainHero_2[1])
      • Set VariableSet CreepGroup = (Units in Region 059 <gen> owned by Player 6 (Orange))
      • Unit Group - Pick every unit in CreepGroup and do (Actions)
        • Loop - Actions
          • Unit - Order (Picked unit) to Attack-Move To TempPoint1
          • AI - Ignore the guard positions of all Player 7 (Green) units
      • Set VariableSet CreepGroup2 = (Units in Region 059 <gen> owned by Player 7 (Green))
      • Unit Group - Pick every unit in CreepGroup2 and do (Actions)
        • Loop - Actions
          • Unit - Order (Picked unit) to Attack-Move To TempPoint1
          • AI - Ignore the guard positions of all Player 6 (Orange) units
      • Set VariableSet CreepGroup3 = (Units in Region 059 <gen> owned by Player 8 (Pink))
      • Unit Group - Pick every unit in CreepGroup3 and do (Actions)
        • Loop - Actions
          • Unit - Order (Picked unit) to Attack-Move To TempPoint1
          • AI - Ignore the guard positions of all Player 8 (Pink) units
      • Custom script: call DestroyGroup(udg_CreepGroup)
      • Custom script: call DestroyGroup(udg_CreepGroup2)
      • Custom script: call DestroyGroup(udg_CreepGroup3)
      • Custom script: call RemoveLocation(udg_TempPoint1)
 

Attachments

  • 44.mp4
    51.9 MB
Back
Top