# Unit Can Path To Unit

Grammarunit Can Path To target with range Range and maxDistance Maximum Distance
FlagsNative | Function

This returns whether or not the unit can path to the specified unit.

# Arguments

  • unit — Source Unit
  • unit — Target
  • fixed — Range
  • fixed — Max Distance

Returns — bool

native bool UnitPathableToUnit(
	unit u,
	unit inTarget,
	fixed inRange,
	fixed inMaxDistance,
);

Category: Unit / Basic

# Examples

campaigns/void.sc2campaignbase.sc2maps/maps/campaign/void/pulnar02.sc2map/MapScript.galaxy:1090

            UnitGroupAdd(lv_attackTargets, gv_aRTANIS);
            UnitGroupAdd(lv_attackTargets, gv_kERRIGAN);
            if ((UnitPathableToUnit(lp_construct, gv_aRTANIS, 0.0, 1000.0) == false)) {
                UnitGroupRemove(lv_attackTargets, gv_aRTANIS);
            }

campaigns/void.sc2campaignbase.sc2maps/maps/campaign/void/pulnar02.sc2map/MapScript.galaxy:1094

            }

            if ((UnitPathableToUnit(lp_construct, gv_kERRIGAN, 0.0, 1000.0) == false)) {
                UnitGroupRemove(lv_attackTargets, gv_kERRIGAN);
            }

campaigns/void.sc2campaignbase.sc2maps/maps/campaign/void/pulnar02.sc2map/MapScript.galaxy:1141

            UnitGroupAdd(lv_attackTargets, gv_aRTANIS);
            UnitGroupAdd(lv_attackTargets, gv_kERRIGAN);
            if ((UnitPathableToUnit(lp_crystal, gv_aRTANIS, 0.0, 1000.0) == false)) {
                UnitGroupRemove(lv_attackTargets, gv_aRTANIS);
            }

campaigns/void.sc2campaignbase.sc2maps/maps/campaign/void/pulnar02.sc2map/MapScript.galaxy:1145

            }

            if ((UnitPathableToUnit(lp_crystal, gv_kERRIGAN, 0.0, 1000.0) == false)) {
                UnitGroupRemove(lv_attackTargets, gv_kERRIGAN);
            }

campaigns/void.sc2campaignbase.sc2maps/maps/campaign/void/pulnar02.sc2map/MapScript.galaxy:1268

        }

        if ((UnitPathableToUnit(lp_enemyUnit, gv_kERRIGAN, 0.0, 1000.0) == true)) {
            lv_kerriganValid = true;
        }

campaigns/void.sc2campaignbase.sc2maps/maps/campaign/void/pulnar02.sc2map/MapScript.galaxy:1274

            lv_kerriganValid = false;
        }
        if ((UnitPathableToUnit(lp_enemyUnit, gv_aRTANIS, 0.0, 1000.0) == true)) {
            lv_artanisValid = true;
        }

campaigns/void.sc2campaign/base.sc2maps/maps/campaign/void/pulnar02.sc2mapMapScript.galaxy:1090

            UnitGroupAdd(lv_attackTargets, gv_aRTANIS);
            UnitGroupAdd(lv_attackTargets, gv_kERRIGAN);
            if ((UnitPathableToUnit(lp_construct, gv_aRTANIS, 0.0, 1000.0) == false)) {
                UnitGroupRemove(lv_attackTargets, gv_aRTANIS);
            }

campaigns/void.sc2campaign/base.sc2maps/maps/campaign/void/pulnar02.sc2mapMapScript.galaxy:1094

            }

            if ((UnitPathableToUnit(lp_construct, gv_kERRIGAN, 0.0, 1000.0) == false)) {
                UnitGroupRemove(lv_attackTargets, gv_kERRIGAN);
            }

campaigns/void.sc2campaign/base.sc2maps/maps/campaign/void/pulnar02.sc2mapMapScript.galaxy:1141

            UnitGroupAdd(lv_attackTargets, gv_aRTANIS);
            UnitGroupAdd(lv_attackTargets, gv_kERRIGAN);
            if ((UnitPathableToUnit(lp_crystal, gv_aRTANIS, 0.0, 1000.0) == false)) {
                UnitGroupRemove(lv_attackTargets, gv_aRTANIS);
            }

campaigns/void.sc2campaign/base.sc2maps/maps/campaign/void/pulnar02.sc2mapMapScript.galaxy:1145

            }

            if ((UnitPathableToUnit(lp_crystal, gv_kERRIGAN, 0.0, 1000.0) == false)) {
                UnitGroupRemove(lv_attackTargets, gv_kERRIGAN);
            }

campaigns/void.sc2campaign/base.sc2maps/maps/campaign/void/pulnar02.sc2mapMapScript.galaxy:1268

        }

        if ((UnitPathableToUnit(lp_enemyUnit, gv_kERRIGAN, 0.0, 1000.0) == true)) {
            lv_kerriganValid = true;
        }

campaigns/void.sc2campaign/base.sc2maps/maps/campaign/void/pulnar02.sc2mapMapScript.galaxy:1274

            lv_kerriganValid = false;
        }
        if ((UnitPathableToUnit(lp_enemyUnit, gv_aRTANIS, 0.0, 1000.0) == true)) {
            lv_artanisValid = true;
        }

mods/heroesdata.stormmodbase.stormdata/TriggerLibs/GameDataHelperLib.galaxy:19917

    lv_misha = libGDHL_gv_rexxarMishaUnit[lv_player];
    if ((libGame_gv_players[lv_player].lv_activeVehicle == null)) {
        if ((UnitPathableToUnit(lv_misha, lv_rexxar, 0.0, 0.0) == false)) {
            UnitSetPosition(lv_misha, UnitGetPosition(lv_rexxar), false);
        }

mods/heroesdata.stormmodbase.stormdata/TriggerLibs/GameDataHelperLib.galaxy:19923

    }
    else {
        if ((UnitPathableToUnit(lv_misha, lv_rexxar, 0.0, 0.0) == false)) {
            UnitSetPosition(lv_misha, UnitGetPosition(lv_rexxar), false);
        }

mods/novastoryassets.sc2modbase2.sc2maps/maps/campaign/nova/nova04.sc2map/MapScript.galaxy:1046

        autoC6E8BEE7_var = UnitGroupUnitFromEnd(autoC6E8BEE7_g, autoC6E8BEE7_u);
        if (autoC6E8BEE7_var == null) { break; }
        if ((UnitPathableToUnit(lp_sporeCrawler, autoC6E8BEE7_var, 0.0, 0.0) == false)) {
            UnitGroupRemove(lv_nearValidUnits, autoC6E8BEE7_var);
        }

mods/novastoryassets.sc2modbase2.sc2maps/maps/campaign/nova/nova04.sc2map/MapScript.galaxy:1057

        auto2CA30ED2_var = UnitGroupUnitFromEnd(auto2CA30ED2_g, auto2CA30ED2_u);
        if (auto2CA30ED2_var == null) { break; }
        if ((UnitPathableToUnit(lp_sporeCrawler, auto2CA30ED2_var, 0.0, 0.0) == false)) {
            UnitGroupRemove(lv_farValidUnits, auto2CA30ED2_var);
        }

mods/novastoryassets.sc2mod/base2.sc2maps/maps/campaign/nova/nova04.sc2mapMapScript.galaxy:1046

        autoC6E8BEE7_var = UnitGroupUnitFromEnd(autoC6E8BEE7_g, autoC6E8BEE7_u);
        if (autoC6E8BEE7_var == null) { break; }
        if ((UnitPathableToUnit(lp_sporeCrawler, autoC6E8BEE7_var, 0.0, 0.0) == false)) {
            UnitGroupRemove(lv_nearValidUnits, autoC6E8BEE7_var);
        }

mods/novastoryassets.sc2mod/base2.sc2maps/maps/campaign/nova/nova04.sc2mapMapScript.galaxy:1057

        auto2CA30ED2_var = UnitGroupUnitFromEnd(auto2CA30ED2_g, auto2CA30ED2_u);
        if (auto2CA30ED2_var == null) { break; }
        if ((UnitPathableToUnit(lp_sporeCrawler, auto2CA30ED2_var, 0.0, 0.0) == false)) {
            UnitGroupRemove(lv_farValidUnits, auto2CA30ED2_var);
        }