Jump to content

Implement own mount routine


scsfl

Recommended Posts

hello community!
I'm trying to implement following method in druid FC: when condition met bot has to use flying mount, else ground mount.

There is following logic: I'm subscribing to OnPathFinderFindPath event and checking if I need to use flying path to destination point. If so then I'm setting destination flying and calling LongMove.LongMoveGo(destination).

private static void checkIfNeedFlyingPath(Vector3 from, Vector3 to, string continentNameMpq, CancelEventArgs cancelable)
{
	if (NeedToUseFlyingPath(to))
	{
		to.SetFlying();
		UseFlightForm();		
		Logging.WriteNavigator($"LongMove to {to}");                
		LongMove.LongMoveGo(to);                
		cancelable.Cancel = true;
	}                
}

 

Function that check if I need to fly.

private static bool NeedToUseFlyingPath(Vector3 dest)
{
	RotationLogger.Debug($"Calling NeedToUseFlyingPath({dest})");
	if (!FlightForm.IsKnown() || Me.IsDead || Me.IsSwimming || Usefuls.ContinentNameMpq == "Azeroth")
	{
		RotationLogger.Debug($"NeedToUseFlyingPath() precondition failed!");
		return false;
	}
            
	float dist = Me.Position.DistanceTo(dest);
	RotationLogger.Debug($"[Movement] Distance to point {dist}");

	if (dist >= FCSettings.CurrentSetting.MinDistanceToFly &&
		(Logging.Status == "To Town" ||
		Logging.Status == "Farming" ||
		Logging.Status == "Looting" ||
		ToTown.GoToTownInProgress ||
		dist >= FCSettings.CurrentSetting.DistanceToFly))
	{                
		RotationLogger.Debug($"[Movement] Need to use flying path to {dest}");
		return true;
	}
  
	RotationLogger.Debug($"[Movement] Need to use ground path to {dest}");
	return false;            
}

 

The problem that this method is not stable. Sometimes it works fine, sometimes especially after farming state bot literally walks by the ground in flying form, then he might continue flying. I couldn't get where does he get this ground points when there is LongMove between 2 points 🙂

When I use built-in flying mechanics everything works decent. But I don't know how to implement similar flight mechanics.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...