# Idle Units For Player

Grammar — Idle workersOnly|Workers/Units for player player
FlagsNative | Function

Returns a unit group that contains all of a player’s idle units.

# Arguments

Returns — unitgroup

native unitgroup UnitGroupIdle(
	int player,
	bool workerOnly,
);

Category: Unit Group / Useful Unit Groups

# Examples

campaigns/void.sc2campaignbase.sc2maps/maps/campaign/sc2tutorial.sc2map/MapScript.galaxy:7404

        }
        UnitGroupLoopEnd();
        gf_SetOffscreenPoint(UnitGroupCenterOfGroup(UnitGroupIdle(gv_p01_USER, true)));
    }
    return true;

campaigns/void.sc2campaignbase.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.sc2campaignbase.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.sc2campaignbase.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.sc2mapMapScript.galaxy:7404

        }
        UnitGroupLoopEnd();
        gf_SetOffscreenPoint(UnitGroupCenterOfGroup(UnitGroupIdle(gv_p01_USER, true)));
    }
    return true;

campaigns/void.sc2campaign/base.sc2maps/maps/campaign/void/paiur03.sc2mapMapScript.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.sc2mapMapScript.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.sc2mapMapScript.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.stormmodbase.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.stormmodbase.stormdata/LibPEB1.galaxy:7129

    }

    lv_idleUnits = UnitGroupIdle(libCore_gv_cOMPUTER_TeamChaos, false);
    auto4066ED68_ae = libPEB1_gv_hatcheryCount;
    lv_hatcheryIndex = 1;

mods/novastoryassets.sc2modbase2.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.sc2modbase2.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.sc2modbase2.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.sc2mapMapScript.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.sc2mapMapScript.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.sc2mapMapScript.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);
    }