- Joined
- Oct 24, 2015
- Messages
- 82
- Thread Author
- #1
Hello,
Ok so i have my bot set up pretty well its quite basic just a vial filling one while i get use to how to make them!
However it goes to the same spot every time which is not very good and can easily be picked up as a bot!
So to get around this i would like to set an Rectangular area and it choose a random coordinate which is set as a variable which i can just add to my current code! I see there is Area.Rectangle and getRandomCoordinate but i have no idea on how to use them.
Thanks in advance!
Right OK i worked out how to do this with the help of the people in the dev chat, and im going to put this here to help anybody else with the same question!
Firstly, to set a Area that is a rectangle:
Now to find a random coordinate in that area:
The variable "area" have to be the same exactly as each other, so if you have it as say, "bank" they both have to be "bank " this is where i fell apart and needed help with, THANKS DEV CHAT!!!
Lastly create a path there:
Hope this helped anybody that needed it
Ok so i have my bot set up pretty well its quite basic just a vial filling one while i get use to how to make them!
However it goes to the same spot every time which is not very good and can easily be picked up as a bot!
So to get around this i would like to set an Rectangular area and it choose a random coordinate which is set as a variable which i can just add to my current code! I see there is Area.Rectangle and getRandomCoordinate but i have no idea on how to use them.
Thanks in advance!
Right OK i worked out how to do this with the help of the people in the dev chat, and im going to put this here to help anybody else with the same question!
Firstly, to set a Area that is a rectangle:
Code:
final Area area = new Area.Rectangular(new Coordinate(2948, 3381, 0), new Coordinate(2951, 3383, 0));
Now to find a random coordinate in that area:
Code:
final Coordinate destination = area.getRandomCoordinate();
Lastly create a path there:
Code:
final RegionPath path = RegionPath.buildTo(destination);
if (path != null)
path.step(true);
Hope this helped anybody that needed it