• 🏆 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] My Squad System Attempt isn't working o.O

Status
Not open for further replies.
Level 6
Joined
Jun 1, 2006
Messages
108
Before anyone says, yes I do know there is a Squad System about. I would use it but for some reason my World Editor let me save my map with those squad triggers enabled.

Anyway, for some reason my Squad System attempt works for the first unit squad created, but doesn't work on the next lot, although it does deselect the units that aren't Squad Leader.

  • Unit Created
    • Events
      • Unit - A unit Finishes training a unit
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Unit-type of (Trained unit)) Equal to Conscript
    • Actions
      • Set TempPoint = (Position of (Triggering unit))
      • Unit - Create 1 (Unit-type of (Trained unit)) for (Owner of (Trained unit)) at TempPoint facing Default building facing degrees
      • Unit Group - Add (Last created unit) to TempGroup
      • Unit - Create 1 (Unit-type of (Trained unit)) for (Owner of (Trained unit)) at TempPoint facing Default building facing degrees
      • Unit Group - Add (Last created unit) to TempGroup
      • Unit - Create 1 (Unit-type of (Trained unit)) for (Owner of (Trained unit)) at TempPoint facing Default building facing degrees
      • Unit Group - Add (Last created unit) to TempGroup
      • Unit - Create 1 (Unit-type of (Trained unit)) for (Owner of (Trained unit)) at TempPoint facing Default building facing degrees
      • Unit Group - Add (Last created unit) to TempGroup
      • Unit - Create 1 (Unit-type of (Trained unit)) for (Owner of (Trained unit)) at TempPoint facing Default building facing degrees
      • Unit Group - Add (Last created unit) to TempGroup
      • Unit - Create 1 (Unit-type of (Trained unit)) for (Owner of (Trained unit)) at TempPoint facing Default building facing degrees
      • Unit Group - Add (Last created unit) to TempGroup
      • Unit - Create 1 (Unit-type of (Trained unit)) for (Owner of (Trained unit)) at TempPoint facing Default building facing degrees
      • Unit Group - Add (Last created unit) to TempGroup
      • Unit - Create 1 (Unit-type of (Trained unit)) for (Owner of (Trained unit)) at TempPoint facing Default building facing degrees
      • Unit Group - Add (Last created unit) to TempGroup
      • Unit - Create 1 (Unit-type of (Trained unit)) for (Owner of (Trained unit)) at TempPoint facing Default building facing degrees
      • Unit Group - Add (Last created unit) to TempGroup
      • Unit - Create 1 (Unit-type of (Trained unit)) for (Owner of (Trained unit)) at TempPoint facing Default building facing degrees
      • Unit Group - Add (Last created unit) to TempGroup
      • Unit - Create 1 (Unit-type of (Trained unit)) for (Owner of (Trained unit)) at TempPoint facing Default building facing degrees
      • Unit Group - Add (Last created unit) to TempGroup
      • Unit Group - Order TempGroup to Attack-Move To (Rally-Point of (Triggering unit) as a point)
      • Unit Group - Pick every unit in TempGroup and do (Unit - Add classification of Summoned to (Picked unit))
      • Unit Group - Add (Trained unit) to Squad[Num]
      • Unit Group - Add all units of TempGroup to Squad[Num]
      • Unit Group - Pick every unit in Squad[Num] and do (Unit - Set the custom value of (Picked unit) to Num)
      • Set Num = (Num + 1)
      • Unit Group - Remove all units from TempGroup
  • Selected
    • Events
      • Player - Player 1 (Red) Selects a unit
      • Player - Player 2 (Blue) Selects a unit
      • Player - Player 3 (Teal) Selects a unit
      • Player - Player 4 (Purple) Selects a unit
      • Player - Player 5 (Yellow) Selects a unit
      • Player - Player 6 (Orange) Selects a unit
      • Player - Player 7 (Green) Selects a unit
      • Player - Player 8 (Pink) Selects a unit
      • Player - Player 9 (Gray) Selects a unit
      • Player - Player 10 (Light Blue) Selects a unit
      • Player - Player 11 (Dark Green) Selects a unit
      • Player - Player 12 (Brown) Selects a unit
    • Conditions
      • ((Triggering unit) is Summoned) Equal to True
    • Actions
      • Selection - Remove (Triggering unit) from selection for (Triggering player)
      • Unit Group - Pick every unit in Squad[(Custom value of (Triggering unit))] and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) is Summoned) Equal to False
            • Then - Actions
              • Selection - Add (Picked unit) to selection for (Triggering player)
            • Else - Actions
  • Move Squad
    • Events
      • Unit - A unit Is issued an order targeting an object
      • Unit - A unit Is issued an order targeting a point
      • Unit - A unit Is issued an order with no target
    • Conditions
      • (Custom value of (Ordered unit)) Greater than 0
      • ((Ordered unit) is Summoned) Equal to False
    • Actions
      • Unit Group - Pick every unit in Squad[(Custom value of (Ordered unit))] and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) is Summoned) Equal to True
            • Then - Actions
              • Unit - Order (Picked unit) to Follow (Ordered unit)
            • Else - Actions
3 Variables being used, Num (Integer, default value of 1), Squad (Unit Group Array) and TempGroup (Unit Group).

I've figured that the problem is caused by the custom value of the Squad Leaders past the 1 Squad not being set. I'd like to know why this is so and how I can fix it. +rep to anyone that can help.
 
Well, i am not 100% sure, but there are some bits i find odd.
1) (Unit-type of (Trained unit) Equal to Conscript). Why do you add this within an "Or/Any" condition? Single condition will be fine.

2) I really can't find a reason why all those units creation should work without adding waits between the actions; because think: You repeat the same action 11 times with no waits. How then system is supposed to understand that you want 11 units created, when you create all of them at the same time (but not using "Unit - Create 11 (Unit-type of (Trained unit)" instead?)

3) Try adding "Trigger - Turn on X <gen>" between the triggers, it might work.
 
Level 6
Joined
Jun 1, 2006
Messages
108
Well, i am not 100% sure, but there are some bits i find odd.
1) (Unit-type of (Trained unit) Equal to Conscript). Why do you add this within an "Or/Any" condition? Single condition will be fine.

So I can add other unit types in later on.

2) I really can't find a reason why all those units creation should work without adding waits between the actions; because think: You repeat the same action 11 times with no waits. How then system is supposed to understand that you want 11 units created, when you create all of them at the same time (but not using "Unit - Create 11 (Unit-type of (Trained unit)" instead?)

How would I put them all in a group if I was to make them all at once? o_O

3) Try adding "Trigger - Turn on X <gen>" between the triggers, it might work.

Just tested, no effect. :/
 
Level 7
Joined
Oct 14, 2005
Messages
70
Think there are ways to save coding here-makes it much easier to understand.

Anyway:

Unit Group - Pick every unit in Squad[Num] and do (Unit - Set the custom value of (Picked unit) to Num)
Set Num = (Num + 1)

Is that meant to be like that? You're setting the custom value of every unit in that squad to the same number?
 
Status
Not open for further replies.
Top