# Lane Waypoint Get Closest Lane

FlagsNative | Function

Finds the lane closest to TestPoint (note this function can be called any time and is not dependent on “Lane Waypoint Calc Closest Data For Lane”).

# Arguments

  • point — TestPoint

Returns — int

native int AILaneWaypointGetClosestLane(point testPoint);

Category: AI Advanced / Lane / Functions

# Examples

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

        }

        if ((AILaneWaypointGetClosestLane(UnitGetPosition(libStEx_gv_hERO_EnemyFalstad)) == gv__2B_CurrentLane)) {
            TriggerEnable(TriggerGetCurrent(), true);
            return true;

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

        }

        if ((AILaneWaypointGetClosestLane(UnitGetPosition(libStEx_gv_hERO_EnemyFalstad)) == gv__2B_CurrentLane)) {
            TriggerEnable(TriggerGetCurrent(), true);
            return true;

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

    }

    libAIAI_gf_AITeamDelegateUpdateFortKeepcountinLaneforTeam(lv_victimTeam, AILaneWaypointGetClosestLane(UnitGetPosition(lv_dyingStructureUnit)));
    return true;
}

mods/heroesmapmods/battlegroundmapmods/infernalshrines.stormmodbase.stormdata/LibMSHE.galaxy:642

    libGame_gf_CalculateSpawnedMinionGoalPoints(lp_team, UnitGetPosition(lv_monster));
    libAIAI_gf_MinionAIStartMinionAI(-1, lv_monster, libGame_gv_spawnedMinionLane, libGame_gv_spawnedMinionFirstWaypointIndex, false, true, false, lv_enemyTeam, false);
    libMSHE_gv_mMDiabloShrinesPunisherPushLane = AILaneWaypointGetClosestLane(UnitGetPosition(lv_monster));
}

mods/heromods/thefirelords.stormmodbase.stormdata/LibHMaj.galaxy:595

    }

    lv_targetLane = AILaneWaypointGetClosestLane(lv_targetPoint);
    lv_unitCounter = 1;
    for ( ; ( (autoEA04AE5C_ai >= 0 && lv_unitCounter <= autoEA04AE5C_ae) || (autoEA04AE5C_ai < 0 && lv_unitCounter >= autoEA04AE5C_ae) ) ; lv_unitCounter += autoEA04AE5C_ai ) {