Very weird unit group problem

skyblader

You're living only because it's illegal killing.
Reaction score
159
Trigger:
  • Actions
    • Set UnitGroupCount2 = (Number of units in NegativeChargeGroup)
    • For each (Integer A) from 1 to UnitGroupCount2, do (Actions)
      • Loop - Actions
        • Set TempUnit = (Random unit from NegativeChargeGroup)
        • Game - Display to (All players) the text: ((Name of TempUnit) + has been loaded.)
        • Unit Group - Remove TempUnit from NegativeChargeGroup
        • Unit Group - Add TempUnit to NegativeChargeGroup2
        • Set UnitGroupCount2 = (Number of units in NegativeChargeGroup2)
        • Game - Display to (All players) the text: (String(UnitGroupCount2))


This trigger, is supposed to Remove a unit from unit group a and add it into unit group b. As you can see, the unit is TempUnit, and the 2 groups are NegativeChargeGroup and NegativeChargeGroup2. After this trigger runs, an expected answer would be

(Name of TempUnit) has been loaded.
Number(of units in NegativeChargeGroup2) (In this case, supposed to be 1)

Now the weird part was, the answer that came out was,

(Name of TempUnit) has been loaded.
0



Any explanation to this?
 

N(O.O)B

New Member
Reaction score
27
Perhaps you've destroyed "NegativeChargeGroup2" before and haven't recreated it through using "Set NegativeChargeGroup2 = ~~". After destroying a unit group you will first have to use the "Set Variable" action before performing things like adding units to them, else it won't work.
 

Azeroc

New Member
Reaction score
1
Swap Add and Remove. So Adding to unit group would be first and remove after adding, without that I can't see any problem.
 

skyblader

You're living only because it's illegal killing.
Reaction score
159
Thanks N(O.O)B. Set the group to something that didnt exist before putting in the unit worked. As for Azeroc, I already tried that before I posted this.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top