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

[GUI][MUI] Squad System v0.92

This bundle is marked as useful / simple. Simplicity is bliss, low effort and/or may contain minor bugs.

Squad System


I've always liked squad-based games, and being unable to find a system on the Hive that was both MUI and GUI, I went and made one.

Features

-Multiple follow distances (melee stay close, ranged medium, casters far)
-Units won't stray too far from the leader
-Control of squad members can be set to a computer player, so they'll cast spells
-Squad members will not remain idle if the leader is attacked
-Squad members call for help if attacked
-Easily set follow distances, squad size, and who gets control of squad units
-Each trigger contains implementation notes




  • Setup
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- This hashtable stores every squad. Yay, hashtables! --------
      • Hashtable - Create a hashtable
      • Set Squads_Hashtable = (Last created hashtable)
      • -------- This sets the number of units you can have in any given squad. Set it to 0 for none, or to -1 for unlimited. --------
      • Set Squads_Data_MaxMembers = 6
      • -------- Whether or not you are using friendly computer players to control squads. --------
      • -------- Unless you really need them to cast non-autocast spells, I recommend setting this to False. --------
      • Set Squads_Data_UsingComps = True
      • -------- The following distances for melee, ranged, and casters, respectively --------
      • Set Squads_Data_DistanceMelee = 125.00
      • Set Squads_Data_DistanceRanged = 250.00
      • Set Squads_Data_DistanceCaster = 300.00
      • -------- The distance at which squad members will break combat, and return to the squad leader --------
      • Set Squads_Data_MaxDistance = 750.00
      • -------- The player to which control of squad units are given. Each index represents the corresponding player (1 = Player One). --------
      • -------- Give them to an allied computer player if you want them to cast spells automatically (recommended) --------
      • -------- Give them to the same player if you just want them to follow and autocast (not as cool). --------
      • Set Squads_Data_SquadPlayer[1] = Player 7 (Green)
      • Set Squads_Data_SquadPlayer[2] = Player 8 (Pink)
      • Set Squads_Data_SquadPlayer[3] = Player 9 (Gray)
      • Set Squads_Data_SquadPlayer[4] = Player 10 (Light Blue)
      • Set Squads_Data_SquadPlayer[5] = Player 11 (Dark Green)
      • Set Squads_Data_SquadPlayer[6] = Player 12 (Brown)
      • Set Squads_Data_SquadPlayer[7] = Player 7 (Green)
      • Set Squads_Data_SquadPlayer[8] = Player 8 (Pink)
      • Set Squads_Data_SquadPlayer[9] = Player 9 (Gray)
      • Set Squads_Data_SquadPlayer[10] = Player 10 (Light Blue)
      • Set Squads_Data_SquadPlayer[11] = Player 11 (Dark Green)
      • Set Squads_Data_SquadPlayer[12] = Player 12 (Brown)
      • -------- Sets each player to an index of an array, for more slender triggers. --------
      • Set Players[1] = Player 1 (Red)
      • Set Players[2] = Player 2 (Blue)
      • Set Players[3] = Player 3 (Teal)
      • Set Players[4] = Player 4 (Purple)
      • Set Players[5] = Player 5 (Yellow)
      • Set Players[6] = Player 6 (Orange)
      • Set Players[7] = Player 7 (Green)
      • Set Players[8] = Player 8 (Pink)
      • Set Players[9] = Player 9 (Gray)
      • Set Players[10] = Player 10 (Light Blue)
      • Set Players[11] = Player 11 (Dark Green)
      • Set Players[12] = Player 12 (Brown)



  • Recruit
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Recruit
      • (Owner of (Casting unit)) Equal to (Owner of (Target unit of ability being cast))
    • Actions
      • -------- If the targeted unit is a leader unit, politely decline. --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Recruit for (Target unit of ability being cast)) Equal to 0
        • Then - Actions
          • Set Temp_Int = (Load 0 of (Key (Casting unit)) from Squads_Hashtable)
          • -------- If the squad isn't full, ask the unit to join. --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Temp_Int Less than Squads_Data_MaxMembers
            • Then - Actions
              • -------- If the targeted unit is not already in a squad, join up. --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Target unit of ability being cast) is in Squads_Vars_Members) Equal to False
                • Then - Actions
                  • -------- This group signifies a unit as belonging to a squad. --------
                  • Unit Group - Add (Target unit of ability being cast) to Squads_Vars_Members
                  • -------- Change the unit`s owner, if necessary. --------
                  • Set Squads_Vars_Member = (Target unit of ability being cast)
                  • Trigger - Run Determine New Owner <gen> (checking conditions)
                  • -------- If the recruiter isn't already a leader, make him one and assign him a hash. Otherwise, just add the new unit to his existing hash. --------
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • ((Casting unit) is in Squads_Vars_Leaders) Equal to False
                    • Then - Actions
                      • -------- This group signifies a unit as a squad leader. --------
                      • Unit Group - Add (Casting unit) to Squads_Vars_Leaders
                      • -------- 0 of (unit handle) represents the number of units in that leader's squad. --------
                      • Hashtable - Save 1 as 0 of (Key (Casting unit)) in Squads_Hashtable
                      • Hashtable - Save Handle Of(Target unit of ability being cast) as 1 of (Key (Casting unit)) in Squads_Hashtable
                    • Else - Actions
                      • Set Temp_Int = (Load 0 of (Key (Casting unit)) from Squads_Hashtable)
                      • Set Temp_Int = (Temp_Int + 1)
                      • Hashtable - Save Handle Of(Target unit of ability being cast) as Temp_Int of (Key (Casting unit)) in Squads_Hashtable
                      • Hashtable - Save Temp_Int as 0 of (Key (Casting unit)) in Squads_Hashtable
                • Else - Actions
                  • Set Temp_Point = (Position of (Target unit of ability being cast))
                  • Set Temp_String = "Sorry! I'm already in a squad."
                  • Trigger - Run Notification <gen> (ignoring conditions)
            • Else - Actions
              • Set Temp_Point = (Position of (Casting unit))
              • Set Temp_String = "My squad's full, sir!"
              • Trigger - Run Notification <gen> (ignoring conditions)
        • Else - Actions
          • Set Temp_Point = (Position of (Target unit of ability being cast))
          • Set Temp_String = "I'm a leader, not a follower."
          • Trigger - Run Notification <gen> (ignoring conditions)



  • Dismiss
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Dismiss
      • (Unit-type of (Target unit of ability being cast)) Not equal to Sergeant
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Target unit of ability being cast) is in Squads_Vars_Members) Equal to True
        • Then - Actions
          • Set Squads_Vars_Casualty = (Target unit of ability being cast)
          • Trigger - Run Remove <gen> (checking conditions)
        • Else - Actions
          • Set Temp_Point = (Position of (Target unit of ability being cast))
          • Set Temp_String = "I'm not in a squad!"
          • Trigger - Run Notification <gen> (ignoring conditions)



  • Periodic
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
      • (Number of units in Squads_Vars_Leaders) Not equal to 0
    • Actions
      • -------- - --------
      • -------- Runs "Squad AI" for each squad member. --------
      • -------- - --------
      • Unit Group - Pick every unit in Squads_Vars_Leaders and do (Actions)
        • Loop - Actions
          • Set Squads_Vars_Leader = (Picked unit)
          • Set Temp_Point = (Position of (Picked unit))
          • Set Temp_Int = (Load 0 of (Key (Picked unit)) from Squads_Hashtable)
          • For each (Integer Temp_Int_2) from 0 to Temp_Int, do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Temp_Int_2 Not equal to 0
                • Then - Actions
                  • Set Squads_Vars_Member = (Load Temp_Int_2 of (Key (Picked unit)) in Squads_Hashtable)
                  • Trigger - Run Squad AI <gen> (checking conditions)
                • Else - Actions
      • Custom script: call RemoveLocation( udg_Temp_Point )
      • Custom script: call RemoveLocation( udg_Temp_Point_2 )
      • Custom script: call DestroyGroup( udg_Temp_UnitGroup )



  • Death
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Dying unit) is in Squads_Vars_Members) Equal to True
        • Then - Actions
          • Set Squads_Vars_Casualty = (Dying unit)
          • Trigger - Run Remove <gen> (checking conditions)
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Dying unit) is in Squads_Vars_Leaders) Equal to True
            • Then - Actions
              • Set Temp_Int = (Load 0 of (Key (Dying unit)) from Squads_Hashtable)
              • For each (Integer Temp_Int_2) from 0 to Temp_Int, do (Actions)
                • Loop - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Temp_Int_2 Not equal to 0
                    • Then - Actions
                      • Set Squads_Vars_Member = (Load Temp_Int_2 of (Key (Dying unit)) in Squads_Hashtable)
                      • Unit Group - Remove Squads_Vars_Member from Squads_Vars_Members
                      • Unit - Change ownership of Squads_Vars_Member to (Owner of (Dying unit)) and Change color
                    • Else - Actions
              • Hashtable - Clear all child hashtables of child (Key (Dying unit)) in Squads_Hashtable
              • Set Temp_Point = (Position of (Dying unit))
              • Set Temp_String = Squad leader killed!
              • Trigger - Run Notification <gen> (ignoring conditions)
            • Else - Actions



  • Attacked
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • ((Attacking unit) belongs to an ally of (Owner of (Attacked unit))) Equal to False
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Recruit for (Target unit of ability being cast)) Not equal to 0
          • ((Attacked unit) is in Squads_Vars_Leaders) Equal to True
        • Then - Actions
          • Set Temp_Int = (Load 0 of (Key (Attacked unit)) from Squads_Hashtable)
          • For each (Integer Temp_Int_2) from 0 to Temp_Int, do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Temp_Int_2 Not equal to 0
                • Then - Actions
                  • Set Squads_Vars_Member = (Load Temp_Int_2 of (Key (Attacked unit)) in Squads_Hashtable)
                  • Game - Display to (All players) the text: (((Name of Squads_Vars_Member) + : ") + ((String((Current order of Squads_Vars_Member))) + "))
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Or - Any (Conditions) are true
                        • Conditions
                      • (Current order of Squads_Vars_Member) Equal to (Order(stop))
                      • (Current order of Squads_Vars_Member) Equal to (Order(<Empty String>))
                    • Then - Actions
                      • Set Temp_Point = (Position of (Attacking unit))
                      • Unit - Order Squads_Vars_Member to Attack-Move To Temp_Point
                    • Else - Actions
                • Else - Actions
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Attacked unit) is in Squads_Vars_Members) Equal to True
            • Then - Actions
              • Set Temp_Point = (Position of (Attacked unit))
              • Set Temp_UnitGroup = (Units within 600.00 of Temp_Point matching ((Owner of (Matching unit)) Equal to (Owner of (Attacked unit))))
              • Unit Group - Pick every unit in Temp_UnitGroup and do (Actions)
                • Loop - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Or - Any (Conditions) are true
                        • Conditions
                          • (Current order of (Picked unit)) Equal to (Order(stop))
                          • (Current order of (Picked unit)) Equal to (Order(<Empty String>))
                    • Then - Actions
                      • Unit - Order (Picked unit) to Attack (Attacking unit)
                    • Else - Actions
              • Custom script: call RemoveLocation( udg_Temp_Point )
              • Custom script: call DestroyGroup( udg_Temp_UnitGroup )
            • Else - Actions



  • Give Summon to Player
    • Events
      • Time - Every 5.00 seconds of game time
    • Conditions
    • Actions
      • For each (Integer Temp_Int) from 1 to 12, do (Actions)
        • Loop - Actions
          • Set Temp_Int_2 = Temp_Int
          • Trigger - Run SummonGive <gen> (checking conditions)



  • Notification
    • Events
    • Conditions
    • Actions
      • Floating Text - Create floating text that reads Temp_String at Temp_Point with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
      • Floating Text - Set the velocity of (Last created floating text) to 32.00 towards 90.00 degrees
      • Floating Text - Change (Last created floating text): Disable permanence
      • Floating Text - Change the lifespan of (Last created floating text) to 3.00 seconds
      • Floating Text - Change the fading age of (Last created floating text) to 2.50 seconds
      • Custom script: call RemoveLocation( udg_Temp_Point )



  • Squad AI
    • Events
    • Conditions
    • Actions
      • -------- The location of the unit currently being ordered --------
      • Set Temp_Point_2 = (Position of Squads_Vars_Member)
      • -------- Sets the follow distance, based on the unit's type. --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • (Unit-type of Squads_Vars_Member) Equal to Footman
              • (Unit-type of Squads_Vars_Member) Equal to Knight
              • (Unit-type of Squads_Vars_Member) Equal to Spell Breaker
              • (Unit-type of Squads_Vars_Member) Equal to Doom Guard
              • (Unit-type of Squads_Vars_Member) Equal to Queen of Suffering
        • Then - Actions
          • Set Squads_Vars_Distance = Squads_Data_DistanceMelee
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • (Unit-type of Squads_Vars_Member) Equal to Rifleman
            • Then - Actions
              • Set Squads_Vars_Distance = Squads_Data_DistanceRanged
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Or - Any (Conditions) are true
                    • Conditions
                      • (Unit-type of Squads_Vars_Member) Equal to Priest
                      • (Unit-type of Squads_Vars_Member) Equal to Sorceress
                • Then - Actions
                  • Set Squads_Vars_Distance = Squads_Data_DistanceCaster
                • Else - Actions
                  • -------- What to do if they`re not on the list. --------
                  • Set Squads_Vars_Distance = Squads_Data_DistanceCaster
      • -------- If the distance between the unit and its leader is greater than the maximum, issue a move order. If it is greater than the following distance, issue an attack-move order. --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Distance between Temp_Point and Temp_Point_2) Greater than or equal to Squads_Data_MaxDistance
        • Then - Actions
          • Set Temp_Point_2 = (Temp_Point offset by Squads_Vars_Distance towards (((Facing of Squads_Vars_Leader) + 180.00) + (Random real number between -75.00 and 75.00)) degrees)
          • Unit - Order Squads_Vars_Member to Move To Temp_Point_2
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Distance between Temp_Point and Temp_Point_2) Greater than or equal to (Squads_Vars_Distance + 25.00)
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • And - All (Conditions) are true
                    • Conditions
                      • (Current order of Squads_Vars_Member) Not equal to (Order(attack))
                • Then - Actions
                  • Set Temp_Point_2 = (Temp_Point offset by Squads_Vars_Distance towards (((Facing of Squads_Vars_Leader) + 180.00) + (Random real number between -70.00 and 70.00)) degrees)
                  • Unit - Order Squads_Vars_Member to Attack-Move To Temp_Point_2
                • Else - Actions
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Squads_Data_UsingComps Equal to True
                • Then - Actions
                  • Set Temp_Point_2 = (Position of Squads_Vars_Member)
                  • Set Temp_UnitGroup = (Units within 400.00 of Temp_Point_2 matching (((Matching unit) belongs to an enemy of (Owner of Squads_Vars_Member)) Equal to True))
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Temp_UnitGroup is empty) Equal to True
                    • Then - Actions
                      • Unit - Order Squads_Vars_Member to Hold Position
                    • Else - Actions
                      • Unit - Order Squads_Vars_Member to Attack-Move To Temp_Point
                • Else - Actions



  • Remove
    • Events
    • Conditions
    • Actions
      • -------- - --------
      • -------- Cleans up a hash by moving values down, and removes the hash if there is no longer a need for it. --------
      • -------- - --------
      • Unit Group - Pick every unit in Squads_Vars_Leaders and do (Actions)
        • Loop - Actions
          • Set Temp_Int = (Load 0 of (Key (Picked unit)) from Squads_Hashtable)
          • For each (Integer Temp_Int_2) from 0 to Temp_Int, do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Temp_Int_2 Not equal to 0
                • Then - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Load Temp_Int_2 of (Key (Picked unit)) in Squads_Hashtable) Equal to Squads_Vars_Casualty
                    • Then - Actions
                      • Unit Group - Remove (Load Temp_Int_2 of (Key (Picked unit)) in Squads_Hashtable) from Squads_Vars_Members
                      • Unit - Change ownership of Squads_Vars_Casualty to (Owner of (Picked unit)) and Change color
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • Temp_Int Equal to 1
                        • Then - Actions
                          • Hashtable - Clear all child hashtables of child (Key (Picked unit)) in Squads_Hashtable
                          • Unit Group - Remove (Picked unit) from Squads_Vars_Leaders
                          • Set Temp_Point = (Position of (Picked unit))
                          • Set Temp_String = Squad lost!
                          • Trigger - Run Notification <gen> (ignoring conditions)
                        • Else - Actions
                          • For each (Integer Temp_Int_3) from (Temp_Int_2 + 1) to Temp_Int, do (Actions)
                            • Loop - Actions
                              • Hashtable - Save Handle Of(Load Temp_Int_3 of (Key (Picked unit)) in Squads_Hashtable) as (Temp_Int_3 - 1) of (Key (Picked unit)) in Squads_Hashtable
                          • Hashtable - Save (Temp_Int - 1) as 0 of (Key (Picked unit)) in Squads_Hashtable
                    • Else - Actions
                • Else - Actions



  • Determine New Owner
    • Events
    • Conditions
    • Actions
      • Set Temp_Player = (Owner of Squads_Vars_Member)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Temp_Player Equal to Player 1 (Red)
        • Then - Actions
          • Set Temp_Player = Squads_Data_SquadPlayer[1]
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Temp_Player Equal to Player 2 (Blue)
            • Then - Actions
              • Set Temp_Player = Squads_Data_SquadPlayer[2]
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Temp_Player Equal to Player 3 (Teal)
                • Then - Actions
                  • Set Temp_Player = Squads_Data_SquadPlayer[3]
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Temp_Player Equal to Player 4 (Purple)
                    • Then - Actions
                      • Set Temp_Player = Squads_Data_SquadPlayer[4]
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • Temp_Player Equal to Player 5 (Yellow)
                        • Then - Actions
                          • Set Temp_Player = Squads_Data_SquadPlayer[5]
                        • Else - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • Temp_Player Equal to Player 6 (Orange)
                            • Then - Actions
                              • Set Temp_Player = Squads_Data_SquadPlayer[6]
                            • Else - Actions
                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • Temp_Player Equal to Player 7 (Green)
                                • Then - Actions
                                  • Set Temp_Player = Squads_Data_SquadPlayer[7]
                                • Else - Actions
                                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    • If - Conditions
                                      • Temp_Player Equal to Player 8 (Pink)
                                    • Then - Actions
                                      • Set Temp_Player = Squads_Data_SquadPlayer[8]
                                    • Else - Actions
                                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                        • If - Conditions
                                          • Temp_Player Equal to Player 9 (Gray)
                                        • Then - Actions
                                          • Set Temp_Player = Squads_Data_SquadPlayer[9]
                                        • Else - Actions
                                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                            • If - Conditions
                                              • Temp_Player Equal to Player 10 (Light Blue)
                                            • Then - Actions
                                              • Set Temp_Player = Squads_Data_SquadPlayer[10]
                                            • Else - Actions
                                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                                • If - Conditions
                                                  • Temp_Player Equal to Player 11 (Dark Green)
                                                • Then - Actions
                                                  • Set Temp_Player = Squads_Data_SquadPlayer[11]
                                                • Else - Actions
                                                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                                    • If - Conditions
                                                      • Temp_Player Equal to Player 12 (Brown)
                                                    • Then - Actions
                                                      • Set Temp_Player = Squads_Data_SquadPlayer[12]
                                                    • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Temp_Player Not equal to (Owner of Squads_Vars_Member)
        • Then - Actions
          • Unit - Change ownership of Squads_Vars_Member to Temp_Player and Change color
        • Else - Actions



  • SummonGive
    • Events
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Players[Temp_Int_2] Not equal to Squads_Data_SquadPlayer[Temp_Int_2]
        • Then - Actions
          • Set Temp_UnitGroup = (Units owned by Squads_Data_SquadPlayer[Temp_Int_2] matching (((Matching unit) is in Squads_Vars_Members) Equal to False))
          • Unit Group - Pick every unit in Temp_UnitGroup and do (Actions)
            • Loop - Actions
              • Unit - Change ownership of (Picked unit) to Players[Temp_Int_2] and Change color
          • Custom script: call DestroyGroup( udg_Temp_UnitGroup )
        • Else - Actions





v0.91:
-added "Squads_Data_MaxMembers", which allows you to set the maximum sqaud members.
-improved AI during combat.

v0.92:
-Condensed triggers with the same event into single triggers
-Added RemoveLocation()'s, etc.


Keywords:
group, party, squad, system, gui, mui, mpi, leader, follow, guard
Contents

Squad Mechanics (Map)

Reviews
12th Dec 2015 IcemanBo: Too long time as NeedsFix. Rejected. 10:41, 29th Jul 2010 The_Reborn_Devil: It's getting better, but I noticed that you, in the trigger "Periodic" put this: Custom script: call RemoveLocation( udg_Temp_Point )...

Moderator

M

Moderator

12th Dec 2015
IcemanBo: Too long time as NeedsFix. Rejected.

10:41, 29th Jul 2010
The_Reborn_Devil:

It's getting better, but I noticed that you, in the trigger "Periodic" put this:
  • Custom script: call RemoveLocation( udg_Temp_Point )
Outside the unit group loop. For every unit the "Unit Group - Pick every unit in Squads_Vars_Leaders and do (Actions)" finds you create a new location and it's important that you remove all and not only the last one ^^

Also, you can remove the
  • Custom script: call RemoveLocation( udg_Temp_Point_2 )
You're not using it in that trigger.

Also, you might wanna use "Triggering Unit" whenever a unit dies, starts the effect of an ability, etc instead of "Dying Unit" and "Casting Unit".

The rest looks good to me.


Status: Rejected until updated
Rating: N/A

PM me or another mod once you've updated this to get it reviewed again. Have a nice day!
 
Level 7
Joined
Dec 26, 2006
Messages
303
I liked the idea, the trigger is easy to edit for one's preferred use :grin:

I don't see any bug, leak or glitches, however it need improvement... a lot..
  • when you move in straight the unit following just right but when you change where you're heading they're moving in a mess, even worse if you change your facing point twice lot of them will rounding you all around and won't stop even if you leave them for minutes
  • you need to limit how much units to recruit, just by having 6 melee units makes them grouping up like some mob not a squad :/
  • when one of your units summon a water elemental or charming enemy units, they're not following you
  • the units can't keep up their formation if the commander have superior movespeed, this might be a real problem if we're using heroes as commander and equipping a movespeed bonus item

I still haven't take a peek at your trigger, sorry I can't help you to improve it :/

sorry if my choose of words kinda harsh, but personally I really expect this system to be done and put it in my map :xxd:
 
Level 7
Joined
Mar 2, 2008
Messages
180
I liked the idea, the trigger is easy to edit for one's preferred use :grin:

I don't see any bug, leak or glitches, however it need improvement... a lot..
  • when you move in straight the unit following just right but when you change where you're heading they're moving in a mess, even worse if you change your facing point twice lot of them will rounding you all around and won't stop even if you leave them for minutes
  • you need to limit how much units to recruit, just by having 6 melee units makes them grouping up like some mob not a squad :/
  • when one of your units summon a water elemental or charming enemy units, they're not following you
  • the units can't keep up their formation if the commander have superior movespeed, this might be a real problem if we're using heroes as commander and equipping a movespeed bonus item

I still haven't take a peek at your trigger, sorry I can't help you to improve it :/

sorry if my choose of words kinda harsh, but personally I really expect this system to be done and put it in my map :xxd:

The pathing system works much better when you disable computer-controlled squads (they'll form in an arc behind you). They get all bunched up because with computer players, they always want to move their units back to their start location, so I had to tell them to hold position if within a certain range, when computers are enabled.

I think I'll add a way of limiting sqaud members right now...
EDIT: done

when one of your units summon a water elemental or charming enemy units, they're not following you

Summoned/charmed units are periodically given to the owner of the squad member responsible for them. Otherwise, your squad could exceed maximum size, with masses of Skeleton Warriors, etc. If you wish for them to continue following you, just recruit them.
 
Last edited:
Level 13
Joined
Mar 4, 2009
Messages
1,156
im not sure if the code is even good,sorry i didnt read it all,it was enough for me to see
"Determine New Owner" trigger
change it ans use
for each integer X from 1 to 12 do actions
loop
-if your player exual to player X
...
 
Level 7
Joined
Mar 2, 2008
Messages
180
im not sure if the code is even good,sorry i didnt read it all,it was enough for me to see
"Determine New Owner" trigger
change it ans use
for each integer X from 1 to 12 do actions
loop
-if your player exual to player X
...

Yeah, I've been meaning to change that trigger. I'll get on it in a bit.

EDIT: Actually, I've been looking more at that, but although what you suggested is certainly more elegant, what I originally put in there seems more efficient, since there's no way to break a loop in GUI. But, with nested if-statements, it will stop checking as soon as it finds the right player.
 
Last edited:
Top