- Joined
- Apr 21, 2019
- Messages
- 40
- Thread Author
- #1
Hey guys im noticing whenever I poll for enemies to attack in my fighter bot I am having substantial stuttering and lag during the new query. The query in question is as follows, and makes sure enemies found are within my defined area constraints.
Npc cow = Npcs.newQuery().names(Pattern.compile("Cow")).actions("Attack").visible().reachable().within(StoredVariables.CowAreaA, StoredVariables.CowAreaB, StoredVariables.CowAreaC).filter(x -> x != null && x.getHealthGauge() == null && x.getTarget() == null && x.getPosition() != Players.getLocal().getPosition()).results().nearest(bot.StoredVariables.DistanceAlgorithm);
Is there a more efficient way to write such a query, maybe I don't need as many null checks?
Npc cow = Npcs.newQuery().names(Pattern.compile("Cow")).actions("Attack").visible().reachable().within(StoredVariables.CowAreaA, StoredVariables.CowAreaB, StoredVariables.CowAreaC).filter(x -> x != null && x.getHealthGauge() == null && x.getTarget() == null && x.getPosition() != Players.getLocal().getPosition()).results().nearest(bot.StoredVariables.DistanceAlgorithm);
Is there a more efficient way to write such a query, maybe I don't need as many null checks?