# Idle Units For Player
Grammar — Idle workersOnly|Workers/Units for player player
Flags —Native
|Function
Returns a unit group that contains all of a player’s idle units.
# Arguments
int
— Playerbool
<preset::IdleWorkerOption> — Workers Only
Returns — unitgroup
native unitgroup UnitGroupIdle(
int player,
bool workerOnly,
);
# Related
Category: Unit Group / Useful Unit Groups
- Empty Unit Group —
unitgroup
— UnitGroupEmpty - Idle Units For Player —
unitgroup
— UnitGroupIdle - Convert Unit To Unit Group —
unitgroup
— libNtve_gf_ConvertUnitToUnitGroup - Units In Region Matching Condition —
unitgroup
— UnitGroup - Unit Count In Region Matching Condition —
int
— UnitCount - Units Near Point Matching Condition —
unitgroup
— UnitGroupSearch - Units In Region With Alliance To Player —
unitgroup
— UnitGroupAlliance - Unit Count In Region With Alliance To Player —
int
— UnitCountAlliance - Units In Region With Alliance To Player Matching Condition —
unitgroup
— libNtve_gf_UnitsInRegionWithAllianceToPlayerMatchingCondition - Units In Unit Group For Player —
unitgroup
— UnitGroupFilterPlayer - Units In Unit Group Matching Condition —
unitgroup
— UnitGroupFilter - Units In Unit Group Targetable As —
unitgroup
— UnitGroupFilterPlane - Units In Unit Group With Alliance —
unitgroup
— UnitGroupFilterAlliance - Units In Unit Group With Custom Value —
unitgroup
— libNtve_gf_UnitsInUnitGroupWithCustomValue - Units In Unit Group Within Region —
unitgroup
— UnitGroupFilterRegion
# Examples
campaigns/void.sc2campaign — base.sc2maps/maps/campaign/sc2tutorial.sc2map/MapScript.galaxy:7404
}
UnitGroupLoopEnd();
gf_SetOffscreenPoint(UnitGroupCenterOfGroup(UnitGroupIdle(gv_p01_USER, true)));
}
return true;
campaigns/void.sc2campaign — base.sc2maps/maps/campaign/void/paiur03.sc2map/MapScript.galaxy:2730
lv_iterUnit = UnitGroupUnitFromEnd(autoCEEFF9AB_g, autoCEEFF9AB_u);
if (lv_iterUnit == null) { break; }
if (((UnitGroupHasUnit(UnitGroupIdle(gv_pLAYER_02_DOMINION2, false), lv_iterUnit) == false) || (UnitCanAttackTarget(lv_iterUnit, auto075978B0_var) == false))) {
UnitGroupRemove(lv_nearbyZergGroup, lv_iterUnit);
}
campaigns/void.sc2campaign — base.sc2maps/maps/campaign/void/ppurifier02.sc2map/MapScript.galaxy:4440
auto44AAC7FE_var = UnitGroupUnitFromEnd(auto44AAC7FE_g, auto44AAC7FE_u);
if (auto44AAC7FE_var == null) { break; }
if ((RandomInt(1, 8) == 1) && (UnitGetType(auto44AAC7FE_var) == "Zergling") && (UnitGroupHasUnit(UnitGroupIdle(UnitGetOwner(auto44AAC7FE_var), false), auto44AAC7FE_var) == true)) {
libNtve_gf_AICast(auto44AAC7FE_var, OrderTargetingPoint(AbilityCommand("attack", 0), RegionRandomPoint(lv_region)));
}
campaigns/void.sc2campaign — base.sc2maps/maps/campaign/void/sc2epilogue01.sc2map/MapScript.galaxy:7632
while ((libVCMI_gf_GameIsOver() == false)) {
if ((libVCMI_gf_PlayerInCinematicModeCampaign() == false)) {
auto2CB28472_g = UnitGroupIdle(gv_pLAYER_03_KERRIGAN, false);
auto2CB28472_u = UnitGroupCount(auto2CB28472_g, c_unitCountAll);
for (;; auto2CB28472_u -= 1) {
campaigns/void.sc2campaign/base.sc2maps/maps/campaign/sc2tutorial.sc2map — MapScript.galaxy:7404
}
UnitGroupLoopEnd();
gf_SetOffscreenPoint(UnitGroupCenterOfGroup(UnitGroupIdle(gv_p01_USER, true)));
}
return true;
campaigns/void.sc2campaign/base.sc2maps/maps/campaign/void/paiur03.sc2map — MapScript.galaxy:2730
lv_iterUnit = UnitGroupUnitFromEnd(autoCEEFF9AB_g, autoCEEFF9AB_u);
if (lv_iterUnit == null) { break; }
if (((UnitGroupHasUnit(UnitGroupIdle(gv_pLAYER_02_DOMINION2, false), lv_iterUnit) == false) || (UnitCanAttackTarget(lv_iterUnit, auto075978B0_var) == false))) {
UnitGroupRemove(lv_nearbyZergGroup, lv_iterUnit);
}
campaigns/void.sc2campaign/base.sc2maps/maps/campaign/void/ppurifier02.sc2map — MapScript.galaxy:4440
auto44AAC7FE_var = UnitGroupUnitFromEnd(auto44AAC7FE_g, auto44AAC7FE_u);
if (auto44AAC7FE_var == null) { break; }
if ((RandomInt(1, 8) == 1) && (UnitGetType(auto44AAC7FE_var) == "Zergling") && (UnitGroupHasUnit(UnitGroupIdle(UnitGetOwner(auto44AAC7FE_var), false), auto44AAC7FE_var) == true)) {
libNtve_gf_AICast(auto44AAC7FE_var, OrderTargetingPoint(AbilityCommand("attack", 0), RegionRandomPoint(lv_region)));
}
campaigns/void.sc2campaign/base.sc2maps/maps/campaign/void/sc2epilogue01.sc2map — MapScript.galaxy:7632
while ((libVCMI_gf_GameIsOver() == false)) {
if ((libVCMI_gf_PlayerInCinematicModeCampaign() == false)) {
auto2CB28472_g = UnitGroupIdle(gv_pLAYER_03_KERRIGAN, false);
auto2CB28472_u = UnitGroupCount(auto2CB28472_g, c_unitCountAll);
for (;; auto2CB28472_u -= 1) {
mods/heroesbrawlmods/brawlmapmods/coop/deadmansstand.stormmod — base.stormdata/LibPEB1.galaxy:1826
}
lv_idleUnits = UnitGroupIdle(libCore_gv_cOMPUTER_TeamChaos, false);
autoC9E420DC_g = lp_zergGroup;
autoC9E420DC_u = UnitGroupCount(autoC9E420DC_g, c_unitCountAll);
mods/heroesbrawlmods/brawlmapmods/coop/deadmansstand.stormmod — base.stormdata/LibPEB1.galaxy:7129
}
lv_idleUnits = UnitGroupIdle(libCore_gv_cOMPUTER_TeamChaos, false);
auto4066ED68_ae = libPEB1_gv_hatcheryCount;
lv_hatcheryIndex = 1;
mods/novastoryassets.sc2mod — base2.sc2maps/maps/campaign/nova/nova04.sc2map/MapScript.galaxy:2463
Wait(3.0, c_timeAI);
while ((UnitGroupCount(UnitGroup("SupplyDepot", gv_pLAYER_02_REIGEL, RegionFromId(37), UnitFilter(0, 0, (1 << c_targetFilterMissile), (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32))), 0), c_unitCountAlive) <= 0)) {
libNtve_gf_AICast(UnitGroupUnit(UnitGroupIdle(gv_pLAYER_02_REIGEL, true), 1), OrderTargetingPoint(AbilityCommand("TerranBuildDrop", 0), RegionGetCenter(RegionFromId(37))));
Wait(10.0, c_timeAI);
}
mods/novastoryassets.sc2mod — base2.sc2maps/maps/campaign/nova/nova04.sc2map/MapScript.galaxy:2468
Wait(15.0, c_timeAI);
while ((UnitGroupCount(UnitGroup("SupplyDepot", gv_pLAYER_02_REIGEL, RegionFromId(38), UnitFilter(0, 0, (1 << c_targetFilterMissile), (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32))), 0), c_unitCountAlive) <= 0)) {
libNtve_gf_AICast(UnitGroupUnit(UnitGroupIdle(gv_pLAYER_02_REIGEL, true), 1), OrderTargetingPoint(AbilityCommand("TerranBuildDrop", 0), RegionGetCenter(RegionFromId(38))));
Wait(10.0, c_timeAI);
}
mods/novastoryassets.sc2mod — base2.sc2maps/maps/campaign/nova/nova04.sc2map/MapScript.galaxy:2473
Wait(15.0, c_timeAI);
while ((UnitGroupCount(UnitGroup("SupplyDepot", gv_pLAYER_02_REIGEL, RegionFromId(39), UnitFilter(0, 0, (1 << c_targetFilterMissile), (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32))), 0), c_unitCountAlive) <= 0)) {
libNtve_gf_AICast(UnitGroupUnit(UnitGroupIdle(gv_pLAYER_02_REIGEL, true), 1), OrderTargetingPoint(AbilityCommand("TerranBuildDrop", 0), RegionGetCenter(RegionFromId(39))));
Wait(10.0, c_timeAI);
}
mods/novastoryassets.sc2mod/base2.sc2maps/maps/campaign/nova/nova04.sc2map — MapScript.galaxy:2463
Wait(3.0, c_timeAI);
while ((UnitGroupCount(UnitGroup("SupplyDepot", gv_pLAYER_02_REIGEL, RegionFromId(37), UnitFilter(0, 0, (1 << c_targetFilterMissile), (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32))), 0), c_unitCountAlive) <= 0)) {
libNtve_gf_AICast(UnitGroupUnit(UnitGroupIdle(gv_pLAYER_02_REIGEL, true), 1), OrderTargetingPoint(AbilityCommand("TerranBuildDrop", 0), RegionGetCenter(RegionFromId(37))));
Wait(10.0, c_timeAI);
}
mods/novastoryassets.sc2mod/base2.sc2maps/maps/campaign/nova/nova04.sc2map — MapScript.galaxy:2468
Wait(15.0, c_timeAI);
while ((UnitGroupCount(UnitGroup("SupplyDepot", gv_pLAYER_02_REIGEL, RegionFromId(38), UnitFilter(0, 0, (1 << c_targetFilterMissile), (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32))), 0), c_unitCountAlive) <= 0)) {
libNtve_gf_AICast(UnitGroupUnit(UnitGroupIdle(gv_pLAYER_02_REIGEL, true), 1), OrderTargetingPoint(AbilityCommand("TerranBuildDrop", 0), RegionGetCenter(RegionFromId(38))));
Wait(10.0, c_timeAI);
}
mods/novastoryassets.sc2mod/base2.sc2maps/maps/campaign/nova/nova04.sc2map — MapScript.galaxy:2473
Wait(15.0, c_timeAI);
while ((UnitGroupCount(UnitGroup("SupplyDepot", gv_pLAYER_02_REIGEL, RegionFromId(39), UnitFilter(0, 0, (1 << c_targetFilterMissile), (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32))), 0), c_unitCountAlive) <= 0)) {
libNtve_gf_AICast(UnitGroupUnit(UnitGroupIdle(gv_pLAYER_02_REIGEL, true), 1), OrderTargetingPoint(AbilityCommand("TerranBuildDrop", 0), RegionGetCenter(RegionFromId(39))));
Wait(10.0, c_timeAI);
}