# Pick Each Unit In Unit Group

Grammar — Pick each unit in group and do (Actions)
FlagsSubFunctions | Action

Runs the contained actions once for each unit in the unit group. Use the “Picked Unit” function to refer to the unit for which the actions are being run.

# Arguments

  • unitgroup — Unit Group

Returns — void

#AUTOVAR(g, unitgroup) = #PARAM(group);
#AUTOVAR(u) = UnitGroupCount(#AUTOVAR(g), c_unitCountAll);
for (;; #AUTOVAR(u) -= 1) {
    #AUTOVAR(var, unit) = UnitGroupUnitFromEnd(#AUTOVAR(g), #AUTOVAR(u));
    if (#AUTOVAR(var) == null) { break; }
    #SUBFUNCS(actions)
}

Category: Unit Group / Loops

# Examples

— None found —