Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

Sign up now!

Question QueryBuilder for Coordinates?

Joined
Nov 29, 2017
Messages
3
Is there a way of invoking a QueryBuilder? In the docs, it wasn't apparent that this was feasible.

The context in which I'd be using this would be to find a specific "safe" tile within a region that is furthest from monsters with a propensity to attack. This would allow for a user to retreat to this local tile, and the process of finding the next safest local tile in the updated region would continue until the monster no longer focuses on the user.

If there is a simpler way of going about doing this without the use of a QueryBuilder, I'm all ears.

Thanks
 
Java Warlord
Joined
Nov 17, 2014
Messages
4,906
There are more than 10000 coordinates loaded at once, it‘s basically impossible to frequently iterate over them checking for distances and reachability and what not
 
Joined
Nov 29, 2017
Messages
3
There are more than 10000 coordinates loaded at once, it‘s basically impossible to frequently iterate over them checking for distances and reachability and what not
What about within a specified distance, eg. the coordinates displayed on a player's minimap?
 
12 year old normie
Joined
Jan 8, 2015
Messages
2,769
What about within a specified distance, eg. the coordinates displayed on a player's minimap?
You can create a circular area around the player and get all coordinates form that area if you really want to pursue this.
 
Joined
Mar 28, 2017
Messages
286
The context in which I'd be using this would be to find a specific "safe" tile within a region that is furthest from monsters

I don't think there's a set method getSafeTile or something of those sorts, or even npc.getSafeDistance, so you'd have to manually define a monsters wandering radius, and walk away that amount of tiles.

Then again, I don't know if it becomes slightly difficult if the npcs are ranged. Also, it becomes more difficult to do the method above because that monsters attack region is already pre defined, and based on where they spawn. Unless the npc is stationary, it's going to be hard to know what is that npc's spawn point, unless we have a method that defines that
 
Joined
May 24, 2016
Messages
1,113
What you are trying to do sounds achievable using
Code:
Players.getLocal().getPostion().getReachableCoordinates()
which returns all reachable coordinates in the current region.
 
Last edited:
Niche bots at your disposal
Joined
Dec 23, 2015
Messages
1,099
I needed a coordinate query builder myself just recently. What I did now is getReachableCoordinates (like auxi just said) and then use a GameObjects query with the .on(coordinates) filter to do what I want. This allows you to use thing like nearest(), nearestTo() (without making your own comparator) and parallel compute (?) of the regular stream filters.
Just remember to use providers where applicable, so you don't query your CPU to hell.

So what you could do is something like this:
(do note you can optimize this query by using other parameters)
JavaScript:
Npc target;
GameObjects.newQuery().on(reachableCoordinates).within(optionalArea).fitler(monster->Distance.between (target, monster)>getWanderignDistance(monster)).results().nearest();
 
Last edited:
Top