# AI Pathing Cost Map

Grammar — Pathing cost from point from to point to
FlagsNative | Function

Returns the map pathing cost between two points, ignores all units.

# Arguments

  • point — From
  • point — To

Returns — int

native int AIPathingCostMap(point from, point to);

Category: AI Advanced / Utility / Functions

# Examples

mods/heroes.stormmodbase.stormmaps/maps/heroes/singleplayermaps/startingexperience/tutorialveteran.stormmap/MapScript.galaxy:5869

            }
            else {
                if ((AIPathingCostMap(UnitGetPosition(libStEx_gv_hERO_PlayerUnit), lv_originalLoc) > 25)) {
                    TriggerEnable(TriggerGetCurrent(), false);
                    libStEx_gf_HighlightCommandButton(true, libStEx_ge_TutorialCommandButton_Mount);

mods/heroes.stormmod/base.stormmaps/maps/heroes/singleplayermaps/startingexperience/tutorialveteran.stormmapMapScript.galaxy:5869

            }
            else {
                if ((AIPathingCostMap(UnitGetPosition(libStEx_gv_hERO_PlayerUnit), lv_originalLoc) > 25)) {
                    TriggerEnable(TriggerGetCurrent(), false);
                    libStEx_gf_HighlightCommandButton(true, libStEx_ge_TutorialCommandButton_Mount);

mods/heroesbrawlmods/brawlmapmods/lunarfestival.stormmodbase.stormdata/LibLNYF.galaxy:519

        	autoA0480C1D_var = PlayerGroupNextPlayer(autoA0480C1D_g, autoA0480C1D_var);
        	if (autoA0480C1D_var<0) { break; }
        	if (((lv_shortestDistance == 0.0) || (AIPathingCostMap(UnitGetPosition(libGame_gv_players[autoA0480C1D_var].lv_heroUnit), libLNYF_gv_leaderboard.lv_point[lv_index_FurthestOccupiedRegion]) < lv_shortestDistance))) {
            lv_shortestDistance = AIPathingCostMap(UnitGetPosition(libGame_gv_players[autoA0480C1D_var].lv_heroUnit), libLNYF_gv_leaderboard.lv_point[lv_index_FurthestOccupiedRegion]);
            lv_player_ShortestDistance = autoA0480C1D_var;

mods/heroesbrawlmods/brawlmapmods/lunarfestival.stormmodbase.stormdata/LibLNYF.galaxy:520

        	if (autoA0480C1D_var<0) { break; }
        	if (((lv_shortestDistance == 0.0) || (AIPathingCostMap(UnitGetPosition(libGame_gv_players[autoA0480C1D_var].lv_heroUnit), libLNYF_gv_leaderboard.lv_point[lv_index_FurthestOccupiedRegion]) < lv_shortestDistance))) {
            lv_shortestDistance = AIPathingCostMap(UnitGetPosition(libGame_gv_players[autoA0480C1D_var].lv_heroUnit), libLNYF_gv_leaderboard.lv_point[lv_index_FurthestOccupiedRegion]);
            lv_player_ShortestDistance = autoA0480C1D_var;
        }

mods/starcoop/starcoop.sc2modbase.sc2data/LibCOMU.galaxy:4233

    for ( ; ( (autoB400F7EB_ai >= 0 && lv_spawnAttempt <= autoB400F7EB_ae) || (autoB400F7EB_ai < 0 && lv_spawnAttempt >= autoB400F7EB_ae) ) ; lv_spawnAttempt += autoB400F7EB_ai ) {
        lv_riftLocation = RegionRandomPoint(RegionPlayableMap());
        if (((DistanceBetweenPoints(lv_riftLocation, PlayerStartLocation(1)) <= 30.0) || (DistanceBetweenPoints(lv_riftLocation, PlayerStartLocation(2)) <= 30.0) || (DistanceBetweenPoints(lv_riftLocation, PlayerStartLocation(1)) > lv_maxDistance) || (libCOOC_gf_CC_SpawnAllowedAtPoint(lv_riftLocation) == false) || (UnitCountAlliance(1, c_unitAllianceEnemy, RegionCircle(lv_riftLocation, 10.0), UnitFilter(0, 0, (1 << c_targetFilterMissile), (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32))), 0) > 3) || (UnitGroupCount(UnitGroup(null, c_playerAny, RegionCircle(lv_riftLocation, 10.0), UnitFilter((1 << c_targetFilterHarvestableResource), 0, (1 << c_targetFilterMissile), (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32))), 0), c_unitCountAlive) > 0) || (PointPathingIsConnected(lv_riftLocation, PlayerStartLocation(1)) == false) || (UnitGroupCount(UnitGroup("MutatorVoidRift", c_playerAny, RegionCircle(lv_riftLocation, 20.0), UnitFilter(0, 0, (1 << c_targetFilterMissile), (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32))), 0), c_unitCountAlive) > 0) || ((libCOOC_gf_CC_CurrentMap() == "AC_UlnarLocks") && (GameGetMissionTime() < 300.0) && (AIPathingCostMap(lv_riftLocation, PlayerStartLocation(lp_forPlayer)) > 70)))) {
            lv_riftLocation = null;
            continue;

mods/starcoop/starcoop.sc2modbase.sc2data/LibCOMU.galaxy:5706


    if ((UnitGroupCount(UnitGroupSelected(1), c_unitCountAlive) > 0)) {
        TextExpressionSetToken("Param/Expression/lib_COMU_9C0FF2F9", "A", FixedToText(AIPathingCostMap(UnitGetPosition(UnitGroupUnit(UnitGroupSelected(EventPlayer()), 1)), PlayerStartLocation(1)), c_fixedPrecisionAny));
        TextExpressionSetToken("Param/Expression/lib_COMU_9C0FF2F9", "B", FixedToText(AIPathingCostMap(UnitGetPosition(UnitGroupUnit(UnitGroupSelected(EventPlayer()), 1)), PlayerStartLocation(2)), c_fixedPrecisionAny));
        TriggerDebugOutput(1, TextExpressionAssemble("Param/Expression/lib_COMU_9C0FF2F9"), true);

mods/starcoop/starcoop.sc2modbase.sc2data/LibCOMU.galaxy:5707

    if ((UnitGroupCount(UnitGroupSelected(1), c_unitCountAlive) > 0)) {
        TextExpressionSetToken("Param/Expression/lib_COMU_9C0FF2F9", "A", FixedToText(AIPathingCostMap(UnitGetPosition(UnitGroupUnit(UnitGroupSelected(EventPlayer()), 1)), PlayerStartLocation(1)), c_fixedPrecisionAny));
        TextExpressionSetToken("Param/Expression/lib_COMU_9C0FF2F9", "B", FixedToText(AIPathingCostMap(UnitGetPosition(UnitGroupUnit(UnitGroupSelected(EventPlayer()), 1)), PlayerStartLocation(2)), c_fixedPrecisionAny));
        TriggerDebugOutput(1, TextExpressionAssemble("Param/Expression/lib_COMU_9C0FF2F9"), true);
    }

mods/starcoop/starcoop.sc2modbase.sc2data/LibCOMU.galaxy:5711

    }
    else {
        TextExpressionSetToken("Param/Expression/lib_COMU_E4EE57D5", "A", FixedToText(AIPathingCostMap(CameraGetTarget(EventPlayer()), PlayerStartLocation(1)), c_fixedPrecisionAny));
        TextExpressionSetToken("Param/Expression/lib_COMU_E4EE57D5", "B", FixedToText(AIPathingCostMap(CameraGetTarget(EventPlayer()), PlayerStartLocation(2)), c_fixedPrecisionAny));
        TriggerDebugOutput(1, TextExpressionAssemble("Param/Expression/lib_COMU_E4EE57D5"), true);

mods/starcoop/starcoop.sc2modbase.sc2data/LibCOMU.galaxy:5712

    else {
        TextExpressionSetToken("Param/Expression/lib_COMU_E4EE57D5", "A", FixedToText(AIPathingCostMap(CameraGetTarget(EventPlayer()), PlayerStartLocation(1)), c_fixedPrecisionAny));
        TextExpressionSetToken("Param/Expression/lib_COMU_E4EE57D5", "B", FixedToText(AIPathingCostMap(CameraGetTarget(EventPlayer()), PlayerStartLocation(2)), c_fixedPrecisionAny));
        TriggerDebugOutput(1, TextExpressionAssemble("Param/Expression/lib_COMU_E4EE57D5"), true);
    }