Stresse 2 Posted January 14, 2020 Share Posted January 14, 2020 Hi y'all! I'm trying to figure out the various methods WRobot has for finding paths. I'm working on a profile to do the Tanaan Jungle "Tiny Terrors" and can't seem to put together a decent method for the bot to get as far as it can with the flying mount, but then using a (more) precise method to navigate to the NPC. For example string name = "Chaos Pup" Vector3 location = new Vector3(3265.077, 394.3333, 116.3515, "None"); int npcID= 94638; This NPC is in a cave. If I use... List<Vector3> pos= wManager.Wow.Helpers.PathFinder.FindPath(ObjectManager.Me.Position, location); MovementManager.Go(pos); ...it generates a ground-only path to the NPC, which looks pretty bot-like, but does seemto actually navigate to the NPC. If I use... MountTask.Mount(true, MountTask.MountCapacity.Fly); MovementManager.StopMove(); LongMove.StopLongMove(); GoToTask.ToPosition(position); ...the bot flies above the location and then smashes itself into the mountain repeatedly (which, obviously, looks even more like a bot and doesn't reach the desired location). Is there a simple solution that I'm missing? My current method for navigating is (and forgive me, this is cannibalized from somewhere on the forum)... public static void GoTo(Vector3 position, float minDist= 10, float minDistFly= 100, int maxFlyTimeMins= 30) { var dist = ObjectManager.Me.Position.DistanceTo(position); bool canFly= Lua.LuaDoString<bool>("return IsFlyableArea()"); if (dist > minDistFly&& canFly) { Log("Making a long move to "+position); MovementManager.StopMove(); LongMove.StopLongMove(); MountTask.Mount(true, MountTask.MountCapacity.Fly); //LongMove.LongMoveGo(position, maxFlyTimeMins * 60 * 1000, minDistFly); LongMove.LongMoveGo(position); } else if (dist > minDist) { Log("Making a short move to "+position); MovementManager.StopMove(); LongMove.StopLongMove(); GoToTask.ToPosition(position); } } ...but I need to make this adaptable so it can handle the occasional indoor location...does anyone have any ideas (or, I mean, I have to imagine this functionality is probably already somewhere in WRobot(?)so perhaps @Droidz can point me in the right direction? Sorry, I did try to find it in the forums (maybe I'm not using the right search terms?). I've been coding for WRobt for awhile (still getting used to C#), but this is my first foray into Profiles (actually it's kinda my first attempt to make a full product that isn't a plugin). Link to comment Share on other sites More sharing options...
Droidz 2737 Posted January 14, 2020 Share Posted January 14, 2020 Hello, try to use vector3 type "Flying": Vector3 location = new Vector3(3265.077, 394.3333, 116.3515, "Flying"); GoToTask.ToPosition(location); if npc is indoor, don't put npc position but try to put outdoor position near the door Stresse 1 Link to comment Share on other sites More sharing options...
Stresse 2 Posted January 14, 2020 Author Share Posted January 14, 2020 7 minutes ago, Droidz said: Hello, try to use vector3 type "Flying": Vector3 location = new Vector3(3265.077, 394.3333, 116.3515, "Flying"); GoToTask.ToPosition(location); ifnpc is indoor, don't put npc position but try to put outdoor position near the door Awesome! I'll give it a shot once servers are back up. Is there a way to check if a coordinate/npc is indoors (seems like there must be, since we can "Ignore indoor/outdoor nodes" while gathering)? Because then I could do something like public static void TakeOptimalRoute(Vector3 position) { List<Vector3> roughPath= wManager.Wow.Helpers.PathFinder.FindPath(Location); Vector3 transitionPoint= new Vector3(); for (int i= 0; i< roughPath.Count; i++) { Vector3 coo = roughPath[i]; if coo.IsIndoors() // Or however I would do a check to see if the destination is indoors { transitionPoint= roughPath[i-1]; } } if (transitionPoint != new Vector3()) { GoToTask.ToPosition(transitionPoint.IsFlying()); //And that might fix my orignal problem, too? Sorry, just looked into Vector3 properties GoToTask.ToPosition(location.IsGround()); } } Link to comment Share on other sites More sharing options...
Droidz 2737 Posted January 15, 2020 Share Posted January 15, 2020 You can check if npc is out/indoor but you cannot check position directly. IsFlying() and IsGround() return bool (you cannot use it in "GoToTask.ToPosition()") Not tested, but you can try by distance (build are generally small): const float OutdoorDistance = 30; public static void TakeOptimalRoute(Vector3 position) { if (position.IsFlying()) { GoToTask.ToPosition(position); return; } List<Vector3> roughPath = wManager.Wow.Helpers.PathFinder.FindPath(position); Vector3 transitionPoint = Vector3.Empty; float distance = 0; for (int i = roughPath.Count - 1 - 1; i >= 0; i--) { distance += roughPath[i].DistanceTo2D(roughPath[i + 1]); if (distance >= OutdoorDistance) { transitionPoint = roughPath[i]; break; } } if (transitionPoint != Vector3.Empty) { transitionPoint.SetFlying(); GoToTask.ToPosition(transitionPoint); GoToTask.ToPosition(position); } else GoToTask.ToPosition(position); } Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now