Skip to content

MovementManager ยป Ground Pathing

Namespace: Mayo.Manager.Movement
Denpendies: GC.MM


See the very bottom for GroundPathConfig.


async Task FollowAsync(IList<Vector3> Path, GroundPathConfig?)

Follows a previously generated path.

Example
var ClosestUnit = GC.OM.GetClosestUnit();
if (ClosestUnit != null)
{
    var Path = GC.Navigation.GetGroundPath(GC.OM.Me.Position, ClosestUnit.Position);
    await GC.MM.FollowAsync(Path, new GroundPathConfig(GC));
}

async Task FollowAsync(IUnit, GroundPathConfig?)
async Task FollowAsync(IPlayer, GroundPathConfig?)
async Task FollowAsync(IGameObject, GroundPathConfig?)
async Task FollowAsync(IModel, GroundPathConfig?)

Follows a dynamic generated path.
The path updates continuously.

Example
var ClosestUnit = GC.OM.GetClosestUnit();
if (ClosestUnit != null)
{
    await GC.MM.FollowAsync(ClosestUnit, new GroundPathConfig(GC));
}

async Task FollowAsync(Vector3, GroundPathConfig?)

Generates a static path to the specified location and follows it.


new GroundPathConfig()

The GroundPathConfig allows you to set various behavioral, visual, and other settings.

Example
var ClosestUnit = GC.OM.GetClosestUnit();
if (ClosestUnit != null)
{
    await GC.MM.FollowAsync(ClosestUnit, new GroundPathConfig(GC)
    {
        StopMovingWhenArrived = true,
        StopFollowDistance = 2.0,
        StopFollowTimeInMS = 0,
        ShowWaypoints = true,
        MonitorAntiStuck = true,
        MonitorOffMesh = true,
        UseDefaultOnStuckActions = true,
        UseMount = false,
        DismountOnCombatApproach = true,
        LoopPath = false,
        Actions = [],
        ActionsAsync = [],
        OnStuckActions = [],
        OnStuckActionsAsync = [],
        StopConditions = [],
    });
}

StopMovingWhenArrived

Type: bool
Default: true

Stops the character as soon as they reach their destination.

StopFollowDistance

Type: double
Default: 2.0

Specifies the distance to the target position where the character should stop.

StopFollowTimeInMS

Type: int
Default: 0

Stops the action once the time has expired.
0 disables this option.

ShowWaypoints

Type: bool
Default: true

Displays waypoints visually.
Requires an enabled overlay in the options.

MonitorAntiStuck

Type: bool
Default: true

Checks if the character is stuck and reacts accordingly.

MonitorOffMesh

Type: bool
Default: true

Always includes all offmesh paths.

UseDefaultOnStuckActions

Type: bool
Default: true

Uses the default unstuck mechanic.
Disabling this option requires at least one action in OnStuckActions or in OnStuckActionsAsync.

UseMount

Type: bool
Default: false

Uses the mount if one is specified as usable.

DismountOnCombatApproach

Type: bool
Default: true

Leaves the mount before starting a combat.

LoopPath

Type: bool
Default: false

Starts again at coordinate 1 when the last coordinate has been reached.

Actions

Type: List<Action>
Default: Empty

Executed in the given order between 10 and 30 yards to the target position.

Example
Actions = {
    () => GC.MM.MyCustomAction(),
}

ActionsAsync

Type: List<Func<Task>>
Default: Empty

Executed in the given order between 10 and 30 yards to the target position.

Example
ActionsAsync = {
    () => GC.MM.MyCustomActionAsync(),
}

OnStuckActions

Type: List<Func<bool>>
Default: Empty

This allows you to implement additional synchronous anti-stuck measures.
A boolean value is expected.
true = Success. Restarts the anti-stuck check.

Example
OnStuckActions = {
    () =>
    {
        GC.MM.Jump();
        // ... further checks
        return true;
    },
}

OnStuckActionsAsync

Type: List<Func<Task<bool>>>
Default: Empty

This allows you to implement additional awaitable anti-stuck measures.
A boolean value is expected.
true = Success. Restarts the anti-stuck check.

Example
OnStuckActionsAsync =
{
    async () =>
    {
        await GC.MM.JumpAsync();
        return true;
    },
    () => MyCustomAntiStuckTask(),
}

StopConditions

Type: List<Func<bool>>
Default: Empty

Stops as soon as a condition is met.

Example
StopConditions =
{
    () => ConditionA,
    () => ConditionB,
    () => ConditionC() && ConditionD(),
    () => { /* further checks... */ return true; },
}
void Stop()

It is also possible to interrupt the process via the configuration.

Example
var ClosestUnit = GC.OM.GetClosestUnit();
if (ClosestUnit != null)
{
    var Config = new GroundPathConfig(GC);
    _ = GC.MM.FollowAsync(ClosestUnit, Config);

    await Task.Delay(3000);
    Config.Stop();

    Log.Write($"IsStopped: {Config.IsStopped}");
}