Skip to content

EN API UO LimitMove

Codex edited this page Oct 17, 2026 · 1 revision

Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어

UO.LimitMove

int UO.LimitMove();
int UO.LimitMove(object? distance);

UO.LimitMove() returns the maximum tile distance to a destination; UO.LimitMove(distance) changes it and returns the new value. The initial value is 2000. Zero disables the distance bound; negative values raise an error without changing the setting.

Distance is max(abs(targetX-startX), abs(targetY-startY)). This measures the specified destination, not the length of a detour. Explicit maxDistance, maxSteps and timeout arguments still apply.

The bound covers MoveXY, NewMoveXY, MoveXYZ, PMove, Follow, GetPathArray/GetPathArray3D and movement from the Manager map. Map access works with or without a game window; movement requires an active game session. Unlimited distance does not permit crossing walls or changing facets.

The setting is shared by scripts and the map of the current profile and saved with API state. A new profile starts at 2000; another script does not reset an explicitly chosen value. Call UO.LimitMove(2000) to restore the default.

Examples

int previousLimit = UO.LimitMove();
UO.LimitMove(2000);
UO.Print(UO.LimitMove().ToString());
UO.LimitMove(0);
int destinationX = 5000;
int destinationY = 1500;
int arrived = UO.NewMoveXY(destinationX, destinationY, true, 1, true);
UO.Print(arrived.ToString());
int previousLimit = UO.LimitMove();
try
{
    UO.LimitMove(6000);
    var route = UO.GetPathArray(5000, 1500, true, 1);
    UO.Print(route.Length.ToString());
}
finally
{
    UO.LimitMove(previousLimit);
}

Internal routines

InjectionRuntimeState.LimitMove → InjectionApiUO.MoveToCanonical / BuildPortablePath → ClassicUOInjectionApiBridge.MoveTo → Pathfinder.WalkTo. NativeFollowController / WorldMapController → Pathfinder.WalkTo.

UO.LimitMove controls destination distance: default 2000, zero unlimited. There are no hidden 4096-step/node or 10000-node caps. Work is sliced and can be stopped. GetPathArray respects the numeric moveThroughNPC stamina threshold and moveOpenDoor.

int savedLimit = UO.LimitMove();
try
{
    int applied = ApplyLimit(6000);
    UO.Print(applied.ToString());
}
finally { UO.LimitMove(savedLimit); }

int ApplyLimit(int distance)
{
    if (distance < 0) throw new ArgumentOutOfRangeException(nameof(distance));
    return UO.LimitMove(distance);
}
UO.Print(new MovementLimits(UO).Current().ToString());

class MovementLimits(ClassicUO.CSharp.CSharpGameApi api)
{
    public int Current() => api.LimitMove();
}

Clone this wiki locally