Walking to random tile in an area?

I followed Jeremy2’s scripting tutorial and managed to get my script running, but it always walks to the same tile. Is there any method to walk to a random tile in an area?

Movement.walkToRandomized(Positionable destination);

or you could do Area.getCenter().Randomized() or something, not too sure about this one, it’s been a while.

Everything is written there : JavaDocs

1 Like

Thanks bud, I’ll give that a try.

I use Movement.walkTo(Random.nextElement(area.getTiles()));

1 Like

For randomizing the specific tile:
Position destination = new Position(1, 1, 1);
Movement.walkTo(destination.randomize(3));

For random tile in area:
Area zone = new Area.polygonal(new Position (1, 1,0), new Position (2, 2,0));
Movement.walkTo(zone.getCenter().randomize(3));

Works for me. Stay healthy!