# Copy Of Unit Group

Grammar — Copy of group
FlagsNative | Function

Copies the specified unit group.

# Arguments

  • unitgroup — Unit Group

Returns — unitgroup

native unitgroup UnitGroupCopy(unitgroup inGroup);

Category: Unit Group / Groups

# Examples

campaigns/liberty.sc2campaignbase.sc2maps/maps/campaign/thorner04.sc2map/MapScript.galaxy:434

    // Automatic Variable Declarations
    // Variable Initialization
    lv_attackers = UnitGroupCopy(gv_killTeamAttackers);
    lv_medivacs = UnitGroupCopy(gv_killTeamMedivacs);

campaigns/liberty.sc2campaignbase.sc2maps/maps/campaign/thorner04.sc2map/MapScript.galaxy:435

    // Variable Initialization
    lv_attackers = UnitGroupCopy(gv_killTeamAttackers);
    lv_medivacs = UnitGroupCopy(gv_killTeamMedivacs);

    // Implementation

campaigns/liberty.sc2campaign/base.sc2maps/maps/campaign/thorner04.sc2mapMapScript.galaxy:434

    // Automatic Variable Declarations
    // Variable Initialization
    lv_attackers = UnitGroupCopy(gv_killTeamAttackers);
    lv_medivacs = UnitGroupCopy(gv_killTeamMedivacs);

campaigns/liberty.sc2campaign/base.sc2maps/maps/campaign/thorner04.sc2mapMapScript.galaxy:435

    // Variable Initialization
    lv_attackers = UnitGroupCopy(gv_killTeamAttackers);
    lv_medivacs = UnitGroupCopy(gv_killTeamMedivacs);

    // Implementation

campaigns/libertystory.sc2campaignbase.sc2data/TriggerLibs/CampaignLib.galaxy:564

    // Implementation
    lv_dropLocation = Point(PointGetX(lp_location), PointGetY(lp_location));
    lv_dropUnits = UnitGroupCopy(lp_units);
    auto64417E0D_val = lp_race;
    if (auto64417E0D_val == libCamp_ge_DropPodRace_Terran) {

campaigns/swarm.sc2campaignbase.sc2maps/maps/campaign/swarm/zchar03.sc2map/MapScript.galaxy:635


    lv_center = UnitGroupCenterOfGroup(lp_army);
    lv_armyLeftGroup = UnitGroupCopy(lp_army);
    while ((libNtve_gf_UnitGroupIsDead(lv_armyLeftGroup) == false)) {
        lv_startingUnit = UnitGroupUnit(lv_armyLeftGroup, 1);

campaigns/swarm.sc2campaignbase.sc2maps/maps/campaign/swarm/zchar03.sc2map/MapScript.galaxy:673

    UnitGroupAdd(lv_clusterGroup, lp_originUnit);
    UnitGroupAdd(lv_newGroup, lp_originUnit);
    lv_armyLeftGroup = UnitGroupCopy(lp_army);
    UnitGroupRemove(lv_armyLeftGroup, lp_originUnit);
    while ((libNtve_gf_UnitGroupIsDead(lv_newGroup) == false)) {

campaigns/swarm.sc2campaignbase.sc2maps/maps/campaign/swarm/zspace01.sc2map/MapScript.galaxy:2480

    TriggerEnable(TriggerGetCurrent(), false);
    gv_mineralClusterMines = UnitGroup("SJCloakedMine", c_playerAny, RegionFromId(31), UnitFilter(0, 0, (1 << c_targetFilterMissile), (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32))), 0);
    lv_mines = UnitGroupCopy(gv_mineralClusterMines);
    auto1278E0C0_ae = UnitGroupCount(lv_mines, c_unitCountAlive);
    lv_index = 1;

campaigns/swarm.sc2campaignbase.sc2maps/maps/campaign/swarm/zzerus01.sc2map/MapScript.galaxy:1793

                            }
                            else {
                                lv_tempGroup = UnitGroupCopy(gv_aIHarvestGroups[lp_harvestIndex]);
                                autoA62CBCFC_g = lv_tempGroup;
                                autoA62CBCFC_u = UnitGroupCount(autoA62CBCFC_g, c_unitCountAll);

campaigns/swarm.sc2campaign/base.sc2maps/maps/campaign/swarm/zchar03.sc2mapMapScript.galaxy:635


    lv_center = UnitGroupCenterOfGroup(lp_army);
    lv_armyLeftGroup = UnitGroupCopy(lp_army);
    while ((libNtve_gf_UnitGroupIsDead(lv_armyLeftGroup) == false)) {
        lv_startingUnit = UnitGroupUnit(lv_armyLeftGroup, 1);

campaigns/swarm.sc2campaign/base.sc2maps/maps/campaign/swarm/zchar03.sc2mapMapScript.galaxy:673

    UnitGroupAdd(lv_clusterGroup, lp_originUnit);
    UnitGroupAdd(lv_newGroup, lp_originUnit);
    lv_armyLeftGroup = UnitGroupCopy(lp_army);
    UnitGroupRemove(lv_armyLeftGroup, lp_originUnit);
    while ((libNtve_gf_UnitGroupIsDead(lv_newGroup) == false)) {

campaigns/swarm.sc2campaign/base.sc2maps/maps/campaign/swarm/zspace01.sc2mapMapScript.galaxy:2480

    TriggerEnable(TriggerGetCurrent(), false);
    gv_mineralClusterMines = UnitGroup("SJCloakedMine", c_playerAny, RegionFromId(31), UnitFilter(0, 0, (1 << c_targetFilterMissile), (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32))), 0);
    lv_mines = UnitGroupCopy(gv_mineralClusterMines);
    auto1278E0C0_ae = UnitGroupCount(lv_mines, c_unitCountAlive);
    lv_index = 1;

campaigns/swarm.sc2campaign/base.sc2maps/maps/campaign/swarm/zzerus01.sc2mapMapScript.galaxy:1793

                            }
                            else {
                                lv_tempGroup = UnitGroupCopy(gv_aIHarvestGroups[lp_harvestIndex]);
                                autoA62CBCFC_g = lv_tempGroup;
                                autoA62CBCFC_u = UnitGroupCount(autoA62CBCFC_g, c_unitCountAll);

campaigns/swarmstory.sc2campaignbase.sc2data/TriggerLibs/SwarmCampaignLib.galaxy:1195

    lv_dropLocation = Point(PointGetX(lp_location), PointGetY(lp_location));
    PointSetFacing(lv_dropLocation, PointGetFacing(lp_location));
    lv_dropUnits = UnitGroupCopy(lp_units);
    DataTableSetUnitGroup(false, libSwaC_gf__LastDroppedUnitsDataTableName(), lv_dropUnits);
    autoAA5D5DC6_val = lp_race;

campaigns/voidstory.sc2campaignbase.sc2data/TriggerLibs/VoidCampaignMissionLib.galaxy:3221

    lv_dropLocation = Point(PointGetX(lp_location), PointGetY(lp_location));
    PointSetFacing(lv_dropLocation, PointGetFacing(lp_location));
    lv_dropUnits = UnitGroupCopy(lp_units);
    DataTableSetUnitGroup(false, libVCMI_gf_PM_DropPod_LastDroppedUnitsDataTableName(), lv_dropUnits);
    auto30FEF00B_val = lp_race;

mods/heroesbrawlmods/arenamodemods/punisherarena.stormmodbase.stormdata/LibAMPU.galaxy:859

    lv_secondCloestHero = null;
    if ((lv_closestHero == libAMPU_gv_aRMPunisherPunishedHero)) {
        lv_secondCloestHeroGroup = UnitGroupCopy(lv_heroGroup);
        UnitGroupRemove(lv_secondCloestHeroGroup, lv_closestHero);
        lv_secondCloestHero = UnitGroupClosestToPoint(lv_secondCloestHeroGroup, UnitGetPosition(lv_punisher));

mods/heroesdata.stormmodbase.stormdata/TriggerLibs/GameLib.galaxy:12319


    // Variable Initialization
    lv_selectedUnits = UnitGroupCopy(UnitGroupSelected(lp_player));

    // Implementation

mods/heroesdata.stormmodbase.stormdata/TriggerLibs/GameLib.galaxy:21008

            }
        }
        libGame_gv_players[lv_player].lv_cameraPlayerUnitGroupToFocusOn = UnitGroupCopy(libGame_gv_players[lv_player].lv_heroUnitGroup);
        libGame_gf_CameraUpdateCameraForPlayer(lv_player);
    }

mods/heroesmapmods/battlegroundmapmods/braxisholdout.stormmodbase.stormdata/LibSCHO.galaxy:829

    // Implementation
    if ((lp_team == libGame_gv_teamOrderIndex_C)) {
        lv_unitGroup = UnitGroupCopy(libSCHO_gv_mMHO_OrderUltralisks);
        if ((libSCHO_gv_mMHO_AttackLane == 1)) {
            lv_holdingCage = libSCHO_gv_mMHO_HiveCages[1].lv_south;

mods/heroesmapmods/battlegroundmapmods/braxisholdout.stormmodbase.stormdata/LibSCHO.galaxy:838

    }
    else {
        lv_unitGroup = UnitGroupCopy(libSCHO_gv_mMHO_ChaosUltralisks);
        if ((libSCHO_gv_mMHO_AttackLane == 2)) {
            lv_holdingCage = libSCHO_gv_mMHO_HiveCages[2].lv_south;

mods/heroesmapmods/battlegroundmapmods/braxisholdout.stormmodbase.stormdata/LibSCHO.galaxy:1370


    // Implementation
    lv_waveGroup = UnitGroupCopy(lp_waveUnits);
    auto23860D9C_g = lv_waveGroup;
    auto23860D9C_u = UnitGroupCount(auto23860D9C_g, c_unitCountAll);

mods/heroesmapmods/battlegroundmapmods/skytemple.stormmodbase.stormdata/LibMLCP.galaxy:1255

    lv_resultCount = lp_count;
    if ((lv_resultCount > UnitGroupCount(lp_group, c_unitCountAlive))) {
        return UnitGroupCopy(lp_group);
    }

mods/heroesmapmods/battlegroundmapmods/skytemple.stormmodbase.stormdata/LibMLCP.galaxy:1258

    }

    lv_sourceGroup = UnitGroupCopy(lp_group);
    while (true) {
        if ((lv_resultCount <= 0)) {

mods/missionpacks/novacampaign.sc2modbase.sc2data/LibNCMI.galaxy:3394

    lv_dropLocation = Point(PointGetX(lp_location), PointGetY(lp_location));
    PointSetFacing(lv_dropLocation, PointGetFacing(lp_location));
    lv_dropUnits = UnitGroupCopy(lp_units);
    DataTableSetUnitGroup(false, libNCMI_gf_NM_DropPod_LastDroppedUnitsDataTableName(), lv_dropUnits);
    auto30FEF00B_val = lp_race;

mods/starcoop/starcoop.sc2modbase.sc2data/LibCOMI.galaxy:11201

    lv_dropLocation = Point(PointGetX(lp_location), PointGetY(lp_location));
    PointSetFacing(lv_dropLocation, PointGetFacing(lp_location));
    lv_dropUnits = UnitGroupCopy(lp_units);
    DataTableSetUnitGroup(false, libCOMI_gf_CM_DropPod_LastDroppedUnitsDataTableName(), lv_dropUnits);
    auto30FEF00B_val = lp_race;

mods/starcoop/starcoop.sc2modbase.sc2data/LibCOMI.galaxy:22162

    }
    if ((lv_veterancount == 0)) {
        lv_veteranunits = UnitGroupCopy(libCOMI_gv_cM_Mengsk_XPHungryUnits);
        lv_veterancount = UnitGroupCount(lv_veteranunits, c_unitCountAlive);
        if ((lv_veterancount == 0)) {

mods/voidprologue.sc2modbase.sc2data/LibA3DDD02B.galaxy:883

    lv_dropLocation = Point(PointGetX(lp_location), PointGetY(lp_location));
    PointSetFacing(lv_dropLocation, PointGetFacing(lp_location));
    lv_dropUnits = UnitGroupCopy(lp_units);
    DataTableSetUnitGroup(false, libA3DDD02B_gf__LastDroppedUnitsDataTableName(), lv_dropUnits);
    autoAA5D5DC6_val = lp_race;