Units aren't being added to unit groups.

TechGeek001

New Member
Reaction score
3
OK, I've been working on this map for almost a year, and this is by far the single most confusing thing I've ever seen. Ever.
It goes something like this:
- The map is played like Footmen vs Grunts, where players can use a text-based system of commands to move units about the battlefield. "-send" orders military units to attack-move to the enemy base, "-back" orders them to retreat, and so on. I never really had a problem with them until I looked into trying to conserve as much energy as possible during high intensity combat situations. Before, the trigger looked something like this:
Code:
Example of a "send" trigger
Events:
player 1 types "-send" as a chat message (etc)
Conditions:
Actions:
Pick every unit belonging to triggering player and order attack-move to enemy base
I realized I could save a lot of resources (prior to learning about memory leaks) by only having units that hadn't already received the order obey the trigger (units that had already been ordered to attack wouldn't stop to process the new (exact same) command). The trigger evolved into what it is now:
Code:
Send West
    Events
        Player - Player 1 (Red) types a chat message containing -send as An exact match
        Player - Player 2 (Blue) types a chat message containing -send as An exact match
        Player - Player 3 (Teal) types a chat message containing -send as An exact match
        Player - Player 4 (Purple) types a chat message containing -send as An exact match
        Player - Player 5 (Yellow) types a chat message containing -send as An exact match
    Conditions
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                ((Triggering player) is in AFK) Equal to False
            Then - Actions
                Unit Group - Pick every unit in (Units owned by (Triggering player)) and do (Actions)
                    Loop - Actions
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                And - All (Conditions) are true
                                    Conditions
                                        ((Picked unit) is in CommandSend) Equal to False
                                        ((Picked unit) is in CommandImmune) Equal to False
                                        ((Picked unit) is A structure) Equal to False
                                        (WestNoSend <gen> contains (Picked unit)) Equal to False
                                        (EastNoSend <gen> contains (Picked unit)) Equal to False
                                        (Unit-type of (Picked unit)) Not equal to Engineer
                                        (Unit-type of (Picked unit)) Not equal to Laborer
                                        (Unit-type of (Picked unit)) Not equal to Heretic
                                        (Unit-type of (Picked unit)) Not equal to Heretical Spirit
                                        (Unit-type of (Picked unit)) Not equal to Elf Spirit
                                        (Unit-type of (Picked unit)) Not equal to Goblin Zeppelin
                                        (Unit-type of (Picked unit)) Not equal to Locust
                                        (EastNorthWall <gen> contains (Picked unit)) Equal to False
                                        (EastSouthWall <gen> contains (Picked unit)) Equal to False
                                        (EastWallMidNorth <gen> contains (Picked unit)) Equal to False
                                        (EastWallMidSouth <gen> contains (Picked unit)) Equal to False
                                        (WestNorthWall <gen> contains (Picked unit)) Equal to False
                                        (WestSouthWall <gen> contains (Picked unit)) Equal to False
                                        (WestWallMidNorth <gen> contains (Picked unit)) Equal to False
                                        (WestWallMidSouth <gen> contains (Picked unit)) Equal to False
                            Then - Actions
                                Unit Group - Add (Picked unit) to CommandSend
                                Unit Group - Remove (Picked unit) from CommandBack
                                Unit Group - Remove (Picked unit) from CommandDefend
                                Unit Group - Remove (Picked unit) from CommandDefendBot
                                Unit Group - Remove (Picked unit) from CommandDefendTop
                                Unit Group - Remove (Picked unit) from CommandGuard
                                Unit Group - Remove (Picked unit) from CommandMid
                                Unit Group - Remove (Picked unit) from CommandRegroup
                                Unit Group - Remove (Picked unit) from CommandSendBot_East
                                Unit Group - Remove (Picked unit) from CommandSendBot_West
                                Unit Group - Remove (Picked unit) from CommandSendTop_East
                                Unit Group - Remove (Picked unit) from CommandSendTop_West
                                Unit Group - Remove (Picked unit) from CommandVillageNE
                                Unit Group - Remove (Picked unit) from CommandVillageNW
                                Unit Group - Remove (Picked unit) from CommandVillageSE
                                Unit Group - Remove (Picked unit) from CommandVillageSW
                                Unit - Order (Picked unit) to Attack-Move To (Random point in SendWest <gen>)
                            Else - Actions
                                Do nothing
            Else - Actions
                Game - Display to (Player group((Triggering player))) for 10.00 seconds the text: You're AFK; there's...
In a nutshell, every unit that was issued a command was added to a unit group. In the event that the same command was issued again, the units in the unit group corresponding to the command would ignore the new event, as displayed in the Conditions of the If/Then/Else.

This answer seemed to function, except that the system apparently didn't work. Units were not added to the unit group, but for some reason obey the command. In other words, the unit picked is not responding to "add picked unit to group" but does follow the "order picked unit to attack". I tested this by simply adding
Code:
Unit Group - Pick every unit in CommandSend and do (Unit - Change color of (Picked unit) to Yellow)
Unit Group - Pick every unit in CommandSend and do (Selection - Select (Picked unit) for Player 1 (Red))
Needless to say, all my units are still red and nothing gets selected. I'm curious as to what I'm doing wrong here.
 

TechGeek001

New Member
Reaction score
3
OK - an interesting solution has worked - and I still have no idea why. Apparently by creating a new unit group and assigning units to be added to it, the whole thing works. Why, I have no idea. All that matters is that, for now, I have a solution. :thup:
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top