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

Squads moves throught lanes

Status
Not open for further replies.
Level 12
Joined
Oct 28, 2019
Messages
481
I am trying to make a map with massive units battle. To this, the enemy train units that goes to a specific place.

When the wave has for ex 12 footman and 12 riffleman it goes trought a lane.

I´ve got this but they go in idian Indian row one by one. How do move the squads throught specifc points in map in formation?
 
Level 12
Joined
Oct 28, 2019
Messages
481
  • AtaqueProntoNorte
    • Events
      • Unit - A unit enters AtaqueNorte <gen>
    • Conditions
      • (Owner of (Triggering unit)) Equal to Player 1 (Red)
      • (Number of units in (Units in AtaqueNorte <gen> owned by Player 1 (Red))) Greater than or equal to 24
    • Actions
      • Set VariableSet Bellagente = (Random integer number between 1 and 1)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Bellagente Equal to 1
        • Then - Actions
          • Unit Group - Pick every unit in (Units in AtaqueNorte <gen> owned by Player 1 (Red)) and do (Unit Group - Add (Picked unit) to MilitiaAttackers1)
          • Wait 2.00 seconds
          • AI - Ignore (Triggering unit)'s guard position
          • Unit Group - Order MilitiaAttackers1 to Attack-Move To (Center of AtaquePeloNorte <gen>)
          • Wait 5.00 seconds
          • Unit Group - Pick every unit in (Units in AtaqueNorte <gen> owned by Player 1 (Red)) and do (Unit Group - Add (Picked unit) to MilitiaAttackers2)
          • Unit Group - Order MilitiaAttackers2 to Attack-Move To (Center of AtaquePeloNorte <gen>)
          • Game - Display to (All players) the text: Um exército está ...
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Bellagente Equal to 2
            • Then - Actions
              • AI - Ignore (Triggering unit)'s guard position
              • Wait 2.00 seconds
              • Unit Group - Pick every unit in (Units in AtaqueNorte <gen> owned by Player 1 (Red)) and do (Unit - Order (Picked unit) to Attack-Move To (Center of AtaquePeloSul <gen>))
              • Unit Group - Order (Units in ataqueNnecro <gen> owned by Player 5 (Yellow)) to Attack-Move To (Center of AtaquePeloSul <gen>)
              • Wait 5.00 seconds
              • Unit Group - Pick every unit in (Units in AtaqueNorte <gen> owned by Player 1 (Red)) and do (Unit - Order (Picked unit) to Attack-Move To (Center of AtaquePeloSul <gen>))
              • Unit Group - Order (Units in ataqueNnecro <gen> owned by Player 5 (Yellow)) to Attack-Move To (Center of AtaquePeloSul <gen>)
              • Game - Display to (All players) the text: Um exército está ...
            • Else - Actions
Its goin one lane only, to test, the unit group walks trought points in map
 
Level 24
Joined
Jun 26, 2020
Messages
1,853
If you wanna order to undefined number of units just use
  • Unit Group - Pick every unit in (Units in AtaqueNorte <gen> owned by Player 1 (Red)) and do(Unit - Order (Picked unit) to Attack-Move To (Center of AtaquePeloSul <gen>))
And don't use "Issue order group".

And what is this?
  • Set VariableSet Bellagente = (Random integer number between 1 and 1)
  • Bellagente Equal to 2
That variable only can be 1.
And one more thing, when you use unit group functions like "Units in ataqueNnecro <gen> owned by Player 5 (Yellow)" you are creating a group that will never be erased (this is called "memory leak"), same with points "Center of AtaquePeloSul <gen>" to solve it just do:
  • Set VariableSet Temp_Group = (Units in ataqueNnecro <gen> owned by Player 5 (Yellow))
  • Set VariableSet Temp_Loc = (Center of AtaquePeloSul <gen>)
  • Unit Group - Pick every unit in Temp_Group and do (Order (Picked Unit) to Attack-Move To Temp_Loc)
  • Custom script call DestroyGroup(udg_Temp_Group)
  • Custom script call RemoveLocation(udg_Temp_Loc)
 
And don't use "Issue order group".
This will cause the issue described in OP though, where they move in single file. Issuing a group order will make them move in formation, like when you manually issue an order to your selected units.

But this:
  • Unit Group - Pick every unit in (Units in AtaqueNorte <gen> owned by Player 1 (Red)) and do (Unit Group - Add (Picked unit) to MilitiaAttackers1)
Should be replaced by
  • Set MilitiaAttackers1 = (Units in AtaqueNorte <gen> owned by Player 1 (Red))
or
  • Unit Group - Add (Units in AtaqueNorte <gen> owned by Player 1 (Red)) to MilitiaAttackers1
(and preferably fix the memory leak like described in previous post)
 
Level 24
Joined
Jun 26, 2020
Messages
1,853
This will cause the issue described in OP though, where they move in single file. Issuing a group order will make them move in formation, like when you manually issue an order to your selected units.
Oh, I see, so he can try this:
  • Set Temp_Group = Units in "Your Region"
  • Set Temp_Loc = "Your attack point"
  • Custom script: loop
  • Custom script: exitwhen IsUnitGroupEmptyBJ(udg_Temp_Group) == true
  • Set Temp_Group2 = (Random 12 units in Temp_Group)
  • Unit Group - Order Temp_Group2 attack-move to Temp_Loc
  • Unit Group - Remove Temp_Group2 from Temp_Group
  • Custom script: DestroyGroup(udg_Temp_Group2)
  • Custom script: endloop
  • Custom script: RemoveLocation(udg_Temp_Loc)
  • Custom script: DestroyGroup(udg_Temp_Group)
 
Last edited:
Level 12
Joined
Oct 28, 2019
Messages
481
I´ve done one simple to understand.
  • AtaqueProntoTEAL
    • Events
      • Unit - A unit enters MilitiaTEAL <gen>
    • Conditions
      • (Owner of (Triggering unit)) Equal to Player 3 (Teal)
      • (Unit-type of (Triggering unit)) Equal to Milicia
      • (Number of units in (Units in MilitiaTEAL <gen> owned by Player 3 (Teal))) Greater than or equal to 11
    • Actions
      • Unit Group - Pick every unit in (Units in MilitiaTEAL <gen> owned by Player 3 (Teal)) and do (Unit Group - Add (Picked unit) to MILITIATEAL)
      • Wait 2.00 seconds
      • AI - Ignore (Triggering unit)'s guard position
      • Unit Group - Order MILITIATEAL to Attack-Move To (Center of attackzone1 <gen>)
ITS working. When the group has 12 units it will move throught destination. But how do this with larger groups ex 2 groups of 12 ? IF put to pick every units in area and make 2 groups, wont have same units in both groups?

  • RemoveGroup
    • Events
      • Unit - A unit owned by Player 3 (Teal) Dies
    • Conditions
      • ((Dying unit) is in MILITIATEAL.) Equal to True
    • Actions
      • Unit Group - Remove all units from MILITIATEAL.
And i´ve done this to "clear" the unit group, theres a way better. Cause if dont do this "the unit group will "full slot"

Explain this trigger... A barracks spawn militia every x time and the militia goes to 1 or 2 random places. There when the group has 12 it Will move like a squad throught specifc points in map

I think need use unit group trigger and variable cause when the group reaches the second point it Will move to the third etc until reach enemy base. But I want they goes in formation not in indian row
 
Last edited:
Level 12
Joined
Oct 28, 2019
Messages
481
This will cause the issue described in OP though, where they move in single file. Issuing a group order will make them move in formation, like when you manually issue an order to your selected units.

But this:
  • Unit Group - Pick every unit in (Units in AtaqueNorte <gen> owned by Player 1 (Red)) and do (Unit Group - Add (Picked unit) to MilitiaAttackers1)
Should be replaced by
  • Set MilitiaAttackers1 = (Units in AtaqueNorte <gen> owned by Player 1 (Red))
or
  • Unit Group - Add (Units in AtaqueNorte <gen> owned by Player 1 (Red)) to MilitiaAttackers1
(and preferably fix the memory leak like described in previous post)
I Will try this ty
Oh, I see, so he can try this:
  • Set Temp_Group = Units in "Your Region"
  • Set Temp_Loc = "Your attack point"
  • Custom script: loop
  • Custom script: exitwhen IsUnitGroupEmptyBJ(udg_Temp_Group) == true
  • Set Temp_Group2 = (Random 12 units in Temp_Group)
  • Unit Group - Order Temp_Group2 attack-move to Temp_Loc
  • Unit Group - Remove Temp_Group2 from Temp_Group
  • Custom script: DestroyGroup(udg_Temp_Group2)
  • Custom script: endloop
  • Custom script: RemoveLocation(udg_Temp_Loc)
  • Custom script: DestroyGroup(udg_Temp_Group)

I even know how to start write this but will try
 
Status
Not open for further replies.
Top