- 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.
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
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
Arad:does it work for "newly created units"?
Arad, is it possible to avoid the wait? I don't have the time check, but I recommend to avoid it altogether if possible.
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)
