Why can't I set this unit group variable

Jackal

You can change this now in User CP... or Die Tryin
Reaction score
38
NOTE: Custom values of casting units predetermined

Trigger:
  • Pincer Movement
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to Pincer Movement
    • Actions
      • Set TempPoint = (Target point of ability being cast)
      • Set TempXValue = 0.00
      • Set TempYValue = 0.00
      • Unit Group - Pick every unit in ArmyGroups[(Custom value of (Triggering unit))] and do (Actions)
        • Loop - Actions
          • Set TempXValue = (TempXValue + (X of (Position of (Picked unit))))
          • Set TempYValue = (TempYValue + (Y of (Position of (Picked unit))))
          • Unit - Make (Picked unit) face TempPoint over 0.00 seconds
          • Set TempReal = (Angle from (Position of (Picked unit)) to TempPoint)
      • Set TempXValue = (TempXValue / (Real((Number of units in ArmyGroups[(Custom value of (Triggering unit))]))))
      • Set TempYValue = (TempYValue / (Real((Number of units in ArmyGroups[(Custom value of (Triggering unit))]))))
      • Wait 2.00 seconds
      • Set TempNumber = (((Number of units in ArmyGroups[(Custom value of (Triggering unit))]) / 2) + 0)
      • Unit Group - Pick every unit in (Random TempNumber units from ArmyGroups[(Custom value of (Triggering unit))]) and do (Actions)
        • Loop - Actions
          • Unit Group - Add (Picked unit) to TempArmyGroup[(Custom value of (Triggering unit))]
      • Set TempDistance = (Distance between (Point(TempXValue, TempYValue)) and TempPoint)
      • Unit Group - Pick every unit in TempArmyGroup[(Custom value of (Triggering unit))] and do (Actions)
        • Loop - Actions
          • Unit - Order (Picked unit) to Attack-Move To ((Point(TempXValue, TempYValue)) offset by TempDistance towards (TempReal + 45.00) degrees)
      • Wait 0.50 seconds
      • Unit Group - Pick every unit in ArmyGroups[(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 in TempArmyGroup[(Custom value of (Triggering unit))]) Equal to False
            • Then - Actions
              • Unit - Order (Picked unit) to Attack-Move To ((Point(TempXValue, TempYValue)) offset by TempDistance towards (TempReal - 45.00) degrees)
            • Else - Actions
      • Game - Display to (All players) the text: (String((Number of units in TempArmyGroup[(Custom value of (Triggering unit))])))
      • Game - Display to (All players) the text: (String((Number of units in ArmyGroups[(Custom value of (Triggering unit))])))


The text displays at the end display 0 and 14 respectively. Why does TempArmyGroup[(Custom value of (Triggering unit))] refuse to be set?
 

Weep

Godspeed to the sound of the pounding
Reaction score
400
Do you want me to say 'add units to' instead of 'set'?

Yes, those are two different operations with different reasons they might not work. Please be specific.

In this case, TempArmyGroup[n] has probably not been created, so there is no group object for that variable and thus you can't add units to it. You need to set the array size in the variable options to the highest number you're using as a custom value, unless that's more than around 100 in which case it would be better to create them on demand using custom script:
Trigger:
  • Actions
    • Custom script: if TempArmyGroup[GetUnitUserData(GetTriggerUnit())] == null then
    • Custom script: set TempArmyGroup[GetUnitUserData(GetTriggerUnit())] = CreateGroup()
    • Custom script: endif


That checks whether the group had already been created, and if not, creates one.
 

tmow

New Member
Reaction score
7
yeah your telling units from a diffrent group to switch over with out actually switching them. Also your not exactly specifing what to move over.
 
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