Jump to content

Checking for a valid firemaking tile


Recommended Posts

Posted

Yes.

Firstly, you need to grab a bunch of tile data to work with. You can do this by creating a new Area object and using the getPositions function to get the tiles in that range.

Then, you'll need to check those tiles' flags to see whether they can be walked on or not. You need to do this separately and still be able to filter out the 'bad tiles'.

On 04/06/2015 at 4:03 PM, Khaleesi said:

Here:


static final int UNWALKABLE = 256 | 0x200000 | 0x40000;

public static boolean isWalkable(int flag) {
   return (flag & (UNWALKABLE)) == 0;
}

XClippingPlane[] clippingPlanes = script.client.accessor.getClippingPlanes();
int[][] map = clippingPlanes[script.myPlayer().getZ()].getTileFlags();

Now just loop through all tiles and check them smile.png

 

Khaleesi

 

 

 

Not true, if you use the right values the shared flags won't matter.

 

A tile where a door is on is always walkable. but you'll have to check other flags if you can pass from 1 tile to another.

Example fence:

you can stand on both tiles, 1 tile will hold info if the tile is blocked north,east,south,west. :)

 

Khaleesi

Thirdly, when you have all those 'walkable' tiles, you then need to figure out whether there are objects situated on those tiles. Objects such as cannons, flowers, fires, and others will prevent you from being able to light a fire in that spot.

The MethodProvider has MethodProvider.objects, which links you to the Objects object. From there, you can use the Objects.get(x, y) function, or you could use a PositionFilter which filters out tiles that aren't occupied with 'bad objects.' I would chose the former, because your list of good tiles will work better if you can just check for objects at their coordinates.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...