Jump to content

Checking for a valid firemaking tile


HunterRS

Recommended Posts

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.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

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