Pudge 24 Posted December 22, 2020 Share Posted December 22, 2020 Hi. I want to make this but can't find sample, this damn lift in the howling fjord ruins everything... /sigh Link to comment https://wrobot.eu/forums/topic/12743-c-offmesh-connection-to-use-elevator/ Share on other sites More sharing options...
Zer0 148 Posted December 22, 2020 Share Posted December 22, 2020 Here's the method I've made to handle elevators: public static void AddTransportOffMesh( Vector3 waitForTransport, Vector3 stepIn, Vector3 objectDeparture, Vector3 objectArrival, Vector3 stepOut, int objectId, ContinentId continentId, string name = "", float precision = 0.5f) { OffMeshConnection offMeshConnection = new OffMeshConnection(new List<Vector3> { waitForTransport, new Vector3(stepIn.X, stepIn.Y, stepIn.Z, "None") { Action = "c#: Logging.WriteNavigator(\"Waiting for transport\"); " + "while (Conditions.InGameAndConnectedAndProductStartedNotInPause) " + "{ " + $"var elevator = ObjectManager.GetWoWGameObjectByEntry({objectId}).OrderBy(o => o.GetDistance).FirstOrDefault(); " + $"if (elevator != null && elevator.IsValid && elevator.Position.DistanceTo(new Vector3({objectDeparture.X.ToString().Replace(",", ".")}, {objectDeparture.Y.ToString().Replace(",", ".")}, {objectDeparture.Z.ToString().Replace(",", ".")})) < {precision.ToString().Replace(",", ".")}) " + "break; " + "Thread.Sleep(100); " + "}" }, new Vector3(stepOut.X, stepOut.Y, stepOut.Z, "None") { Action = "c#: Logging.WriteNavigator(\"Wait to leave Elevator\"); " + "while (Conditions.InGameAndConnectedAndProductStartedNotInPause) " + "{ " + $"var elevator = ObjectManager.GetWoWGameObjectByEntry({objectId}).OrderBy(o => o.GetDistance).FirstOrDefault(); " + $"if (elevator != null && elevator.IsValid && elevator.Position.DistanceTo(new Vector3({objectArrival.X.ToString().Replace(",", ".")}, {objectArrival.Y.ToString().Replace(",", ".")}, {objectArrival.Z.ToString().Replace(",", ".")})) < {precision.ToString().Replace(",", ".")}) " + "break; " + "Thread.Sleep(100); " + "}" }, }, (int)continentId, OffMeshConnectionType.Unidirectional, true); offMeshConnection.Name = name; OffMeshConnections.Add(offMeshConnection, true); } And here is how I use it: AddTransportOffMesh(new Vector3(2865.628, 6211.75, 104.262), // wait for transport new Vector3(2878.712, 6224.032, 105.3798), // Step in new Vector3(2878.315, 6223.635, 105.3792), // Object departure new Vector3(2892.18, 6236.34, 208.908), // Object arrival new Vector3(2880.497, 6226.416, 208.7462, "None"), // Step out 188521, ContinentId.Northrend, "Warsong Hold Elevator UP"); AddTransportOffMesh(new Vector3(2880.497, 6226.416, 208.7462, "None"), // wait for transport new Vector3(2891.717, 6236.516, 208.9086, "None"), // Step in new Vector3(2892.18, 6236.34, 208.908), // Object departure new Vector3(2878.315, 6223.635, 105.3792), // Object arrival new Vector3(2865.628, 6211.75, 104.262), // Step out 188521, ContinentId.Northrend, "Warsong Hold Elevator DOWN"); I've used this for our FlightMaster plugin. In theory, it should also work for other transports. Pudge 1 Link to comment https://wrobot.eu/forums/topic/12743-c-offmesh-connection-to-use-elevator/#findComment-60867 Share on other sites More sharing options...
Pudge 24 Posted December 22, 2020 Author Share Posted December 22, 2020 Thanks, have already found Droidz's post with the barrens elevator Made by this sample, put in plugin and it works. private void InitializeOffmeshes() { List<PathFinder.OffMeshConnection> Doodad_VR_Elevator_Lift02_FJORD = new List<PathFinder.OffMeshConnection> { new PathFinder.OffMeshConnection(new List<Vector3> { new Vector3(1596.064, -5748.844, 255.9307), new Vector3(1677.591, -5822.056, 248.18), // elevator waiting point at the top new Vector3(1688.42, -5831.752, 246.5121) {Action = "c#: Logging.WriteNavigator(\"[OffMeshConnection] Fjord Horde Elevator DOWN > Wait Elevator\"); while (Conditions.InGameAndConnectedAndProductStartedNotInPause) { var elevator = ObjectManager.GetWoWGameObjectByEntry(190118).OrderBy(o => o.GetDistance).FirstOrDefault(); if (elevator != null && elevator.IsValid && elevator.Position.DistanceTo(new Vector3(1680.11, -5824.42, 161.673)) < 0.5) break; Thread.Sleep(10); }"}, // the point at which we stand in the elevator and the elevator stopping point at the top new Vector3(1695.742, -5839.653, 11.995) {Action = "c#: Logging.WriteNavigator(\"[OffMeshConnection] Fjord Horde Elevator DOWN > Wait to leave Elevator\"); while (Conditions.InGameAndConnectedAndProductStartedNotInPause) { var elevator = ObjectManager.GetWoWGameObjectByEntry(190118).OrderBy(o => o.GetDistance).FirstOrDefault(); if (elevator != null && elevator.IsValid && elevator.Position.DistanceTo(new Vector3(1680.11, -5824.42, -72.76543)) < 0.5) break; Thread.Sleep(10); }"}, // elevator exit point below and elevator stop point below new Vector3(1704.343, -5831.836, 11.99983), new Vector3(1720.702, -5847.75, 5.766593), }, (int)ContinentId.Northrend, PathFinder.OffMeshConnectionType.Unidirectional, true), new PathFinder.OffMeshConnection(new List<Vector3> { new Vector3(1720.702, -5847.75, 5.766593), new Vector3(1704.343, -5831.836, 11.99983), new Vector3(1695.941, -5839.131, 11.99734), // elevator waiting point below new Vector3(1688.42, -5831.752, 12.07372) {Action = "c#: Logging.WriteNavigator(\"[OffMeshConnection] Fjord Horde Elevator UP > Wait Elevator\"); while (Conditions.InGameAndConnectedAndProductStartedNotInPause) { var elevator = ObjectManager.GetWoWGameObjectByEntry(190118).OrderBy(o => o.GetDistance).FirstOrDefault(); if (elevator != null && elevator.IsValid && elevator.Position.DistanceTo(new Vector3(1680.11, -5824.42, -72.76543)) < 0.5) break; Thread.Sleep(10); }"}, // the point at which we stand in the elevator and the elevator stopping point below new Vector3(1677.591, -5822.056, 248.18) {Action = "c#: Logging.WriteNavigator(\"[OffMeshConnection] Fjord Horde Elevator UP > Wait to leave Elevator\"); while (Conditions.InGameAndConnectedAndProductStartedNotInPause) { var elevator = ObjectManager.GetWoWGameObjectByEntry(190118).OrderBy(o => o.GetDistance).FirstOrDefault(); if (elevator != null && elevator.IsValid && elevator.Position.DistanceTo(new Vector3(1680.11, -5824.42, 161.673)) < 0.5) break; Thread.Sleep(10); }"}, // elevator exit point at the top and elevator stop point at the top new Vector3(1596.064, -5748.844, 255.9307), }, (int)ContinentId.Northrend, PathFinder.OffMeshConnectionType.Unidirectional, true), }; PathFinder.OffMeshConnections.AddRange(Doodad_VR_Elevator_Lift02_FJORD); PathFinder.OffMeshConnections.Save(); } Still don't understand why Droidz didn't add all of the elevator offmeshes to pathfinder if that is so easy. Link to comment https://wrobot.eu/forums/topic/12743-c-offmesh-connection-to-use-elevator/#findComment-60868 Share on other sites More sharing options...
Matenia 628 Posted December 23, 2020 Share Posted December 23, 2020 No offense to Droidz, but it's pretty much laziness. He'd have to add everything for every expansion and then maintain it manually if pathfinding for the expansion ever changes. I do pretty much the same thing for some connections in HMP. A few Droidz added after being given the info so I could remove them. Others I still struggle with due to large distances. It's really not as reliable as I'd like it to be. TheSmokie 1 Link to comment https://wrobot.eu/forums/topic/12743-c-offmesh-connection-to-use-elevator/#findComment-60870 Share on other sites More sharing options...
Pudge 24 Posted December 25, 2020 Author Share Posted December 25, 2020 Lol, when I added this offmesh connection at first time it worked super fine, but now bot just IGNORE IT completely. Now I am literally tearing the hair out of my head and trying to understand why the bot ignores this offmesh.................... @Droidz please dont ignore, I'm going crazy Link to comment https://wrobot.eu/forums/topic/12743-c-offmesh-connection-to-use-elevator/#findComment-60884 Share on other sites More sharing options...
Pudge 24 Posted December 25, 2020 Author Share Posted December 25, 2020 [Server] [Path-Finding] Not found usable Off-mesh connection. Why? I added it! Link to comment https://wrobot.eu/forums/topic/12743-c-offmesh-connection-to-use-elevator/#findComment-60885 Share on other sites More sharing options...
Droidz 2738 Posted December 27, 2020 Share Posted December 27, 2020 hi, Are you sure that your path only requires 1 offmesheconnection? Because WRobot can only support 1 per path. Share here (or by private message) offmeshesconnection used and from/to path (that you want fix) Link to comment https://wrobot.eu/forums/topic/12743-c-offmesh-connection-to-use-elevator/#findComment-60896 Share on other sites More sharing options...
Pudge 24 Posted December 29, 2020 Author Share Posted December 29, 2020 On 12/27/2020 at 3:50 PM, Droidz said: hi, Are you sure that your path only requires 1 offmesheconnection? Because WRobot can only support 1 per path. Share here (or by private message) offmeshesconnection used and from/to path (that you want fix) Hi! I dont know, what that means support 1 per path... maybe i'm dumb or have too low iq, ah, dont care. Really need 2 connections for this lift, up and down, object id 190118, for some reason it is impossible to force the bot to use offmesh connections, it generates weird straight paths across the rock ... new Vector3(1695.941, -5839.131, 11.99734) // character wait/leave pos at bottom new Vector3(1688.42, -5831.752, 12.07372) // pos to enter lift at bottom new Vector3(1680.11, -5824.42, -72.76543) // lift stop pos bottom new Vector3(1680.11, -5824.42, 161.673)) // lift stop pos top new Vector3(1687.812, -5831.235, 246.5121, "None") // pos to enter lift at top new Vector3(1662.868f, -5808.526f, 252.1796f, "None") // character wait/leave pos at top Link to comment https://wrobot.eu/forums/topic/12743-c-offmesh-connection-to-use-elevator/#findComment-60907 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