• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.
  • Vote for the theme of Hive's HD Modeling Contest #7! Click here to vote! - Please only vote if you plan on participating❗️

[General] loading multiple units in a trigger

Status
Not open for further replies.
Level 4
Joined
May 21, 2015
Messages
70
can anyone tell me how to load multiple units via trigger i tried using group variable but it will load only one unit.
 
Level 17
Joined
Dec 11, 2014
Messages
2,004
On it...

EDIT:
  • Example
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Unit Group - Add Footman 0000 <gen> to Unit_Group
      • Unit Group - Add Footman 0001 <gen> to Unit_Group
      • Unit Group - Add Footman 0002 <gen> to Unit_Group
      • Unit Group - Add Footman 0003 <gen> to Unit_Group
      • Unit Group - Add Footman 0004 <gen> to Unit_Group
      • -------- Important --------
      • Set Amount_of_Footman = (Number of units in Unit_Group)
      • -------- Not Important, I Used them to load and check if it is right. --------
      • Unit - Order Human Transport Ship 0006 <gen> to Load Footman 0000 <gen>
      • Wait 2.00 seconds
      • Unit - Order Human Transport Ship 0006 <gen> to Load Footman 0001 <gen>
      • Wait 2.00 seconds
      • Unit - Order Human Transport Ship 0006 <gen> to Load Footman 0002 <gen>
      • Wait 2.00 seconds
      • Unit - Order Human Transport Ship 0006 <gen> to Load Footman 0003 <gen>
      • Wait 2.00 seconds
      • Unit - Order Human Transport Ship 0006 <gen> to Load Footman 0004 <gen>
      • Wait 5.00 seconds
      • -------- This is What you want --------
        • Do Multiple ActionsFor each (Integer Integer_General) from 1 to Amount_of_Footman, do (Actions)
          • Loop - Actions
            • Set u = (First unit of group Unit_Group)
            • Unit - Order Human Transport Ship 0006 <gen> to Unload u
            • Unit Group - Remove u from Unit_Group
            • Custom script: set udg_u = null
      • Custom script: call DestroyGroup(udg_Unit_Group)
 
yup i want that daffa

the question is when my unit is order to load the units it will load 1 unit only

Refrain double posting.

Order the unit group to board/load to the transport, not the transport to pick them up.
If this still becomes an issue, I recommend to add a timer between and see if that do something.
 
Level 17
Joined
Dec 11, 2014
Messages
2,004
Arad:does it work for "newly created units"?

Yes, If you create/train a Unit, Then Add it to your unit group. Then, Again use The Amount_Of_Footman Variable OR Any name you would like.

Arad, is it possible to avoid the wait? I don't have the time check, but I recommend to avoid it altogether if possible.

Not really. That is Possible However by using timers. Now I'm gonna Try it without wait. That's gonna take a while.
EDIT: I Failed. Now i'm gonna try in JASS And Make a simple one in GUI By Custom Scripts...
EDIT 2: Inspired by JASS, I am Creating a Similar one in simple GUI!
 
Level 17
Joined
Dec 11, 2014
Messages
2,004
Done.

  • Init
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Unit Group - Add Footman 0000 <gen> to Unit_Group_Load
      • Unit Group - Add Footman 0001 <gen> to Unit_Group_Load
      • Unit Group - Add Footman 0002 <gen> to Unit_Group_Load
      • Unit Group - Add Footman 0003 <gen> to Unit_Group_Load
      • Unit Group - Add Footman 0004 <gen> to Unit_Group_Load
      • Unit Group - Add all units of Unit_Group_Load to Unit_Group_Unload
      • Set Amount_of_Footman_Load = (Number of units in Unit_Group_Load)
      • Set Amount_of_Footman_Unload = (Number of units in Unit_Group_Unload)
      • Set Integer_Load = 1
      • Trigger - Run Load <gen> (checking conditions)
  • Load
    • Events
    • Conditions
    • Actions
      • Set Loader = (First unit of group Unit_Group_Load)
      • Unit - Order Human Transport Ship 0006 <gen> to Load Loader
      • Unit Group - Remove Loader from Unit_Group_Load
      • Countdown Timer - Start Load_Timer as a One-shot timer that will expire in 2.00 seconds
      • Custom script: set udg_Loader = null
  • Timer
    • Events
      • Time - Load_Timer expires
    • Conditions
    • Actions
      • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Integer_Load Less than or equal to (<=) Amount_of_Footman_Load
        • Then - Actions
          • Trigger - Run Load <gen> (ignoring conditions)
          • Set Integer_Load = (Integer_Load + 1)
        • Else - Actions
          • Countdown Timer - Start Unload_Timer as a One-shot timer that will expire in 5.00 seconds
  • Unload
    • Events
      • Time - Unload_Timer expires
    • Conditions
    • Actions
      • Do Multiple ActionsFor each (Integer Integer_General) from 1 to Amount_of_Footman_Unload, do (Actions)
        • Loop - Actions
          • Set Unloader = (First unit of group Unit_Group_Unload)
          • Unit - Order Human Transport Ship 0006 <gen> to Unload Unloader
          • Unit Group - Remove Unloader from Unit_Group_Unload
          • Custom script: set udg_Unloader = null
      • Custom script: call DestroyGroup(udg_Unit_Group_Load)
      • Custom script: call DestroyGroup(udg_Unit_Group_Unload)
 
Status
Not open for further replies.
Top