Trees Posted October 20, 2016 Share Posted October 20, 2016 (edited) Hey all, objects.closest uses linear distance to calculate the closest object, is there a way to find the closest walkable object using pathfinding? (Ex. collisionable objects makes the distance by walking longer than linear distance) Couldn't find anything in the api. Edited October 20, 2016 by Trees Quote Link to comment Share on other sites More sharing options...
Khaleesi Posted October 20, 2016 Share Posted October 20, 2016 Hey all, objects.closest uses linear distance to calculate the closest object, is there a way to find the closest walkable object using pathfinding? (Ex. collisionable objects makes the distance by walking longer than linear distance) Couldn't find anything in the api. Map#realDistance 3 Quote Link to comment Share on other sites More sharing options...
Lemons Posted October 20, 2016 Share Posted October 20, 2016 To add to what Khal said, simply add a "true" as the first parameter of a EntityApi.closest() class, like: getObjects().closest(true, "Tree"); 2 Quote Link to comment Share on other sites More sharing options...
Botre Posted October 20, 2016 Share Posted October 20, 2016 Keep in mind this will be much more expensive. 1 Quote Link to comment Share on other sites More sharing options...
Trees Posted October 20, 2016 Author Share Posted October 20, 2016 Keep in mind this will be much more expensive. Yeah, but how does it work? Is it using A*? Because I imagine that the pathfinding is calculated client sided when you issue a movement order, which could potentially be done by hooking the callback and getting the path and then not sending it to the server. 2 Quote Link to comment Share on other sites More sharing options...
Botre Posted October 20, 2016 Share Posted October 20, 2016 Yeah, but how does it work? Is it using A*? Because I imagine that the pathfinding is calculated client sided when you issue a movement order, which could potentially be done by hooking the callback and getting the path and then not sending it to the server. That's a sexy idea. Quote Link to comment Share on other sites More sharing options...
Solzhenitsyn Posted October 20, 2016 Share Posted October 20, 2016 Yeah, but how does it work? Is it using A*? Because I imagine that the pathfinding is calculated client sided when you issue a movement order, which could potentially be done by hooking the callback and getting the path and then not sending it to the server. I don't see how this is faster, since it's the difference between locally calculating a path using whichever pathfinding algorithm the OSB team has implemented, and locally calculating a path using whichever pathfinding algorithm Jagex has implemented. Quote Link to comment Share on other sites More sharing options...
Lemons Posted October 20, 2016 Share Posted October 20, 2016 I don't see how this is faster, since it's the difference between locally calculating a path using whichever pathfinding algorithm the OSB team has implemented, and locally calculating a path using whichever pathfinding algorithm Jagex has implemented. Faster, no, but it would be useful in that is would be the exact path your character is going to follow before walking. Quote Link to comment Share on other sites More sharing options...