- Thread Author
- #1
All
I can't tell if it's the runemate api or my code that is just quite frankly causing long pauses between NPC selection (in a combat bot).
This is my code for selecting an NPC to attack. It's got a couple of problems that I would like some insight on.
Sometimes, for no apparent reason/with no correlation to other events, it simply takes 10-15 seconds to attack the next NPC, despite having multiple valid NPCs. It also sometimes will attack NPCs in combat with others or attack a different NPC than it's already attacking, however these happen infrequently enough to not be a major issue like the long delays.
So -- what's the definitive way to select an NPC for combat? Where am I going wrong? I feel like there should be an API class specifically made with the expertise of the core coders that does this.
Thanks!
also -- if someone could point me to a developer chat/discord that'd be great thanks
I can't tell if it's the runemate api or my code that is just quite frankly causing long pauses between NPC selection (in a combat bot).
Code:
private Npc selectNPC() {
Npc toAttack = Npcs.newQuery()
.names("xxx")
.within(Area)
.results()
.sortByDistance()
.first();
if (toAttack== null
|| !toAttack.isValid()
|| toAttack.getHealthGauge() != null
|| toAttack.getTarget() != null) {
return selectNPC();
}
return toAttack;
}
This is my code for selecting an NPC to attack. It's got a couple of problems that I would like some insight on.
Sometimes, for no apparent reason/with no correlation to other events, it simply takes 10-15 seconds to attack the next NPC, despite having multiple valid NPCs. It also sometimes will attack NPCs in combat with others or attack a different NPC than it's already attacking, however these happen infrequently enough to not be a major issue like the long delays.
So -- what's the definitive way to select an NPC for combat? Where am I going wrong? I feel like there should be an API class specifically made with the expertise of the core coders that does this.
Thanks!
also -- if someone could point me to a developer chat/discord that'd be great thanks