- Joined
- Mar 30, 2015
- Messages
- 2,410
Can you branch off a leaf? Like say i called a leaf to teleport somewhere, now I want it to check if its near someplace to do something else.
You could use a branch to check if it is near something else.
By registering with us, you'll be able to discuss, share and private message with other members of our community.
Sign up now!Can you branch off a leaf? Like say i called a leaf to teleport somewhere, now I want it to check if its near someplace to do something else.
Leafs are at the end of your binary tree. So as serene said, you would need a Branch to check if you are near somewhere. But you cannot branch off a leafCan you branch off a leaf? Like say i called a leaf to teleport somewhere, now I want it to check if its near someplace to do something else.
You'd have to change up your tree it sounds like.Can you branch off a leaf? Like say i called a leaf to teleport somewhere, now I want it to check if its near someplace to do something else.
Why? It's only used for debugging purposes. Just replace those statements with System.out.println(arg);I'd like to +1 the absence of the statics.UpdateUI package.
Possible to share?
Why? It's only used for debugging purposes. Just replace those statements with System.out.println(arg);
@Override
public boolean validate() {
/**
* Validate if we see a Cow or JackO
*/
if(targets == Targets.cow) {
obj = Npcs.newQuery().names("Cow").within(bot.cowArea).results().nearest();
}else if(targets == Targets.jacko) {
obj = Npcs.newQuery().names("Jack Oval").within(bot.jackoArea).results().nearest();
}
System.out.println("Branch IsVisible(" + targets + "): " + (obj != null));
return obj != null && obj.distanceTo(Players.getLocal()) <12;
}
@Override
public void execute() {
if (location == TraversalLocation.cowArea)
{area = bot.cowArea;}
else if (location == TraversalLocation.jackoArea)
{area = bot.jackoArea;}
final WebPath bp = Traversal.getDefaultWeb().getPathBuilder().buildTo(area.getRandomCoordinate());
//final BresenhamPath bp = BresenhamPath.buildTo(area.getRandomCoordinate());
if (bp != null){
if (bp.step(true)){
bot.currentTaskString = "Traversing to" + location;
Execution.delayWhile(Players.getLocal()::isMoving, 1000, 2500);
}
}
}
Path path = nav.web.getPathBuilder().buildTo(toArea.getRandomCoordinate());
if (path != null) {
if (bp.step(true)){
bot.currentTaskString = "Traversing to" + location;
Execution.delayWhile(Players.getLocal()::isMoving, 1000, 2500;
}
} else {
System.out.println("That bitch be null, walking with bresenham");
bresenhamPath(toArea);
}
@Override
public boolean validate() {
/**
* Validate if we see a Cow or JackO
*/
if(targets == Targets.cow) {
obj = Npcs.newQuery().names("Cow").within(bot.cowArea).results().nearest();
}else if(targets == Targets.jacko) {
obj = Npcs.newQuery().names("Jack Oval").within(bot.jackoArea).results().nearest();
}
System.out.println("obj(" + targets + ") != null: " + (obj != null));
System.out.println("obj(" + targets + ").distanceTo(Players.getLocal()): " + (obj.distanceTo(Players.getLocal()) <12));
return obj != null && obj.distanceTo(Players.getLocal()) <12;
}
public void execute() {
if (location == TraversalLocation.cowArea)
{area = bot.cowArea;}
else if (location == TraversalLocation.jackoArea)
{area = bot.jackoArea;}
if (area.getRandomCoordinate() != null )
{
System.out.println("AreaCoordinates" + area);
WebPath wp = Traversal.getDefaultWeb().getPathBuilder().buildTo(area.getRandomCoordinate());
if (wp != null){
if (wp.step(true)){
bot.currentTaskString = "Traversing to" + location;
Execution.delayWhile(Players.getLocal()::isMoving, 1000, 2500);
}
}
} }
PS: I read by cloud that recalling webpath for every action is good for enhancement of the system????? Btw if intitializing before hand For X locations I'd need X Webpath variables??
Yea, I occasionally have to delete it due to some odd circumstances, but you shouldn't have to delete it too often.I finally found out what the problem was. I had a typo in my UI controller, which indeed didn't assign the right areas -.-. Something you said before did made me think of it! Everything works now! Fieeww, good for learning.
The thing that helped me most tho was deleting the out folder now and then. The bot tends do do some weird things now and then
In the original example when it executes a leaf does it automatically go back to the is Inventory Full branch once the leafs condition has been accomplished? Example being if the inventory is not full, it checks if the bank is open. The bank is not open so it traverses to the flax area. Does it go back to is Inventory Full to then check if the bank is open to then go to is Flax Nearby?
Your assumption is correct. When a leaf task is reached it goes back to the root branch and repeatsIn the original example when it executes a leaf does it automatically go back to the is Inventory Full branch once the leafs condition has been accomplished? Example being if the inventory is not full, it checks if the bank is open. The bank is not open so it traverses to the flax area. Does it go back to is Inventory Full to then check if the bank is open to then go to is Flax Nearby?
We use essential cookies to make this site work, and optional cookies to enhance your experience.