# Remove Unit From All Waves And Set Home

Grammar — Remove unit from all waves and set home to home|Point.
FlagsNative | Action

Removes a unit from any waves it is in and sets its home point.

# Arguments

  • unit — Unit
  • point — Home

Returns — void

native void AIRemoveUnitFromAnyWavesAndSetHome(
	unit u,
	point home,
);

Category: AI / MiscCampaign / Actions

# Examples

campaigns/liberty.sc2campaignbase.sc2maps/maps/campaign/thanson01.sc2map/MapScript.galaxy:3940

        autoDC7CDD91_var = UnitGroupUnitFromEnd(autoDC7CDD91_g, autoDC7CDD91_u);
        if (autoDC7CDD91_var == null) { break; }
        AIRemoveUnitFromAnyWavesAndSetHome(autoDC7CDD91_var, PointFromId(281));
    }
    auto23B6BB2B_g = UnitGroup(null, gv_p3_ZERG_LIGHTBLUE_SE, RegionEntireMap(), UnitFilter(0, 0, (1 << c_targetFilterMissile), (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32))), 0);

campaigns/liberty.sc2campaignbase.sc2maps/maps/campaign/thanson01.sc2map/MapScript.galaxy:3947

        auto23B6BB2B_var = UnitGroupUnitFromEnd(auto23B6BB2B_g, auto23B6BB2B_u);
        if (auto23B6BB2B_var == null) { break; }
        AIRemoveUnitFromAnyWavesAndSetHome(auto23B6BB2B_var, PointFromId(283));
    }
    autoFBC7DD9D_g = UnitGroup("NydusCanal", c_playerAny, RegionEntireMap(), UnitFilter(0, 0, (1 << c_targetFilterMissile), (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32))), 0);

campaigns/liberty.sc2campaign/base.sc2maps/maps/campaign/thanson01.sc2mapMapScript.galaxy:3940

        autoDC7CDD91_var = UnitGroupUnitFromEnd(autoDC7CDD91_g, autoDC7CDD91_u);
        if (autoDC7CDD91_var == null) { break; }
        AIRemoveUnitFromAnyWavesAndSetHome(autoDC7CDD91_var, PointFromId(281));
    }
    auto23B6BB2B_g = UnitGroup(null, gv_p3_ZERG_LIGHTBLUE_SE, RegionEntireMap(), UnitFilter(0, 0, (1 << c_targetFilterMissile), (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32))), 0);

campaigns/liberty.sc2campaign/base.sc2maps/maps/campaign/thanson01.sc2mapMapScript.galaxy:3947

        auto23B6BB2B_var = UnitGroupUnitFromEnd(auto23B6BB2B_g, auto23B6BB2B_u);
        if (auto23B6BB2B_var == null) { break; }
        AIRemoveUnitFromAnyWavesAndSetHome(auto23B6BB2B_var, PointFromId(283));
    }
    autoFBC7DD9D_g = UnitGroup("NydusCanal", c_playerAny, RegionEntireMap(), UnitFilter(0, 0, (1 << c_targetFilterMissile), (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32))), 0);

campaigns/swarm.sc2campaignbase.sc2maps/maps/campaign/swarm/zchar01.sc2map/MapScript.galaxy:2633

    AIAttackWaveCancel(AIUnitGetWave(gv_zagara));
    AISetUnitScriptControlled(gv_zagara, false);
    AIRemoveUnitFromAnyWavesAndSetHome(gv_zagara, PointFromId(3));
    AIAttackWaveSetTargetPatrol(gv_pLAYER_02_ZERG, 0);
    AIAttackWaveSetGatherPoint(gv_pLAYER_02_ZERG, UnitGetPosition(gv_zagara));

campaigns/swarm.sc2campaignbase.sc2maps/maps/campaign/swarm/zlab02.sc2map/MapScript.galaxy:8316

    }

    AIRemoveUnitFromAnyWavesAndSetHome(EventUnit(), PointFromId(652));
    return true;
}

campaigns/swarm.sc2campaign/base.sc2maps/maps/campaign/swarm/zchar01.sc2mapMapScript.galaxy:2633

    AIAttackWaveCancel(AIUnitGetWave(gv_zagara));
    AISetUnitScriptControlled(gv_zagara, false);
    AIRemoveUnitFromAnyWavesAndSetHome(gv_zagara, PointFromId(3));
    AIAttackWaveSetTargetPatrol(gv_pLAYER_02_ZERG, 0);
    AIAttackWaveSetGatherPoint(gv_pLAYER_02_ZERG, UnitGetPosition(gv_zagara));

campaigns/swarm.sc2campaign/base.sc2maps/maps/campaign/swarm/zlab02.sc2mapMapScript.galaxy:8316

    }

    AIRemoveUnitFromAnyWavesAndSetHome(EventUnit(), PointFromId(652));
    return true;
}

campaigns/void.sc2campaignbase.sc2maps/maps/campaign/void/pulnar01.sc2map/MapScript.galaxy:474

        if (auto2439952A_var == null) { break; }
        if ((AIUnitGetWave(auto2439952A_var) == null) && (RegionContainsPoint(gv_celestialLocks[lp_index].lv_defenseRegion, UnitGetGoalPosition(auto2439952A_var)) == true)) {
            AIRemoveUnitFromAnyWavesAndSetHome(auto2439952A_var, PlayerStartLocation(UnitGetOwner(auto2439952A_var)));
            UnitIssueOrder(auto2439952A_var, OrderTargetingPoint(null, PlayerStartLocation(UnitGetOwner(auto2439952A_var))), c_orderQueueReplace);
            AISetUnitScriptControlled(auto2439952A_var, false);

campaigns/void.sc2campaign/base.sc2maps/maps/campaign/void/pulnar01.sc2mapMapScript.galaxy:474

        if (auto2439952A_var == null) { break; }
        if ((AIUnitGetWave(auto2439952A_var) == null) && (RegionContainsPoint(gv_celestialLocks[lp_index].lv_defenseRegion, UnitGetGoalPosition(auto2439952A_var)) == true)) {
            AIRemoveUnitFromAnyWavesAndSetHome(auto2439952A_var, PlayerStartLocation(UnitGetOwner(auto2439952A_var)));
            UnitIssueOrder(auto2439952A_var, OrderTargetingPoint(null, PlayerStartLocation(UnitGetOwner(auto2439952A_var))), c_orderQueueReplace);
            AISetUnitScriptControlled(auto2439952A_var, false);