- Thread Author
- #1
Hey guys,
I am currently working on my very first RuneMate bot and I keep running into problems when trying to make the bot interact with the bank before my player actually reached it.
If the bank is near my player but not visible, I want the bot to turn the camera to the bank and then interact with it. However, the bot never turns the camera under any circumstances. It always just walks to the bank and interacts with it as soon as it can see it. Even weirder, when it finally opens the bank it also seems to act very weird and missclicks like 10-20 times before it finally manages to deposit an item from my inventory. I am currently using a BranchTask with the following validate-Statement to check if the player reached the bank:
public boolean validate()
{
Player player = Players.getLocal();
LocatableEntity bank = Banks.getLoaded().nearest();
if (bank != null && !bank.isVisible())
{
Camera.turnTo(bank);
}
return (player != null && Tools.GetBankArea().contains(player))
|| (bank != null && bank.isVisible());
}
I have also tried something similar with an NPC (the kebab trader in Al Kharid) and in that case it seems to get bugged and randomly walk around inside the shop while never interacting with the NPC at all (or sometimes after a very very long time it finally manages to talk to the NPC). For this I use the following validate-Statement:
public boolean validate()
{
Area kebabShopArea = Tools.GetKebabShopArea();
Player player = Players.getLocal();
Actor karim = Npcs.newQuery().names("Karim").within(kebabShopArea).reachable().results().first();
if (karim != null && !karim.isVisible())
{
Camera.turnTo(karim);
}
return (player != null && kebabShopArea.contains(player))
|| (karim != null && karim.isVisible());
}
When I replace these two functions with a basic area check I do not have any of these issues.
Am I doing something wrong? How am I supposed to implement something like this?
My idea behind this was that it looks extremely bot-like to first walk to a certain area, wait and then interact with the NPC so I wanted to improve that.
I am currently working on my very first RuneMate bot and I keep running into problems when trying to make the bot interact with the bank before my player actually reached it.
If the bank is near my player but not visible, I want the bot to turn the camera to the bank and then interact with it. However, the bot never turns the camera under any circumstances. It always just walks to the bank and interacts with it as soon as it can see it. Even weirder, when it finally opens the bank it also seems to act very weird and missclicks like 10-20 times before it finally manages to deposit an item from my inventory. I am currently using a BranchTask with the following validate-Statement to check if the player reached the bank:
public boolean validate()
{
Player player = Players.getLocal();
LocatableEntity bank = Banks.getLoaded().nearest();
if (bank != null && !bank.isVisible())
{
Camera.turnTo(bank);
}
return (player != null && Tools.GetBankArea().contains(player))
|| (bank != null && bank.isVisible());
}
I have also tried something similar with an NPC (the kebab trader in Al Kharid) and in that case it seems to get bugged and randomly walk around inside the shop while never interacting with the NPC at all (or sometimes after a very very long time it finally manages to talk to the NPC). For this I use the following validate-Statement:
public boolean validate()
{
Area kebabShopArea = Tools.GetKebabShopArea();
Player player = Players.getLocal();
Actor karim = Npcs.newQuery().names("Karim").within(kebabShopArea).reachable().results().first();
if (karim != null && !karim.isVisible())
{
Camera.turnTo(karim);
}
return (player != null && kebabShopArea.contains(player))
|| (karim != null && karim.isVisible());
}
When I replace these two functions with a basic area check I do not have any of these issues.
Am I doing something wrong? How am I supposed to implement something like this?
My idea behind this was that it looks extremely bot-like to first walk to a certain area, wait and then interact with the NPC so I wanted to improve that.