# For Each Behavior On Unit

Grammar — For each behavior var on unit do (Actions)
FlagsSubFunctions | Action

Runs the contained actions once for each unit in the unit group.

# Arguments

  • anyvariable — Behavior
  • unit — Unit

Returns — void

#AUTOVAR(u, unit) = #PARAM(unit);
#AUTOVAR(i) = 1;
for ( ; #AUTOVAR(i) <= UnitBehaviorCountAll(#AUTOVAR(u)) ; #AUTOVAR(i) += BoolToInt(#PARAM(var) == UnitBehaviorGet(#AUTOVAR(u), #AUTOVAR(i))) ) {
    #PARAM(var) = UnitBehaviorGet(#AUTOVAR(u), #AUTOVAR(i));
    #SUBFUNCS(actions)
}

Category: Behavior / Basic

# Examples

— None found —