ObjectDefinitions#opcode69 determines from which side(s) the objects can be interacted with. Implement that into your pathfinder if it isn't already there.
|
|

Hey
Does any1 got a server-sided pathfinder that finds the path to a tile where an object is usable from?
Heres a picture to explain more: - so my current pathfinder does find the path to walk next to the object, but if the object is only usable from specific tiles it doesnt work. (unless I manually set the tile to walk-to to something that the object works with)
EDIT: current code:
Code:ClippedPathFinder.getPathFinder().findRoute(this, def.getPosition().getX(), def.getPosition().getY(), true, object.getSizeX(def.getFace()), object.getSizeY(def.getFace()));Pathfinder: [Only registered and activated users can see links. ]Code:public int getSizeX(int rotation) { if (rotation == 1 || rotation == 3) { return yLength; } else { return xLength; } } public int getSizeY(int rotation) { if (rotation == 1 || rotation == 3) { return xLength; } else { return yLength; } }



ObjectDefinitions#opcode69 determines from which side(s) the objects can be interacted with. Implement that into your pathfinder if it isn't already there.




ObjectDefinitions(id=30367, varbit=-1, anInt453=1, models=[1203], objectTypes=null, transformedIds=null, name=Ladder, ambientSoundId=-1, varp=-1, supportItems=1, anIntArray100=null, mapIconId=-1, sizeX=1, clipType=2, isRotated=false, sizeY=1, hasShadow=false, projectileClip=true, anInt455=0, nonFlatShading=false, adjustType=-1, anInt456=0, modelClipped=false, ambient=0, options=[Climb-down, null, null, null, null], contrast=0, anInt457=0, hollow=false, animationId=-1, modelSizeX=128, decorDisplacement=16, modelSizeHeight=128, modelSizeY=128, modelColour=null, clipped=true, modelTexture=null, mapSceneId=7, replacementColour=null, offsetX=0, replacementTexture=null, offsetHeight=0, offsetY=0, obstructsGround=false, accessBlockFlag=0, params=null)
You're right. This means you have to force the location for it server-side. There are some - although not that common - cases in which they have custom path handlers for it. You could of course just edit the definitions and set the flag yourself as well.




Ah yes, you're right actually. Didn't go there in-game to actually test it before posting my last reply but that is indeed the case here. Honestly thought those fences were just part of the ladder object itself. Got a little confused and assume it requires a hacky way of handling it like a few things I've encountered have.
Aaanyways, yeah it is correct.
[Only registered and activated users can see links. ]
There's no special code handling the "route" to the object, all ran through generic pathfinding. You just need to check whether the tile you're interacting from has a "wall" in-front of you or not, which should be covered by pathfinding just fine. No clue how 317s handle it though since their pathfinding shit is done through client.

Yeah, the last four bits of this 'surroundings' bitmask control whether or not the pathfinder considers an object to have been reached if approached from that side (the other bits aren't used, at least in 3xx). 0 means reachable from that side, 1 means unreachable, and it's ordered WESN (i.e. the last bit states whether or not the object is reached when standing one tile north of it).
Also worth noting that only three object types support this: 10, 11, 22 (which are 'general object category i never found a name for', that same category just rotated 45 degrees, and ground decorations).Code:public boolean reached(int x, int y, int minX, int minY, int rangeX, int rangeY, int surroundings) { int maxX = (minX + rangeX) - 1; int maxY = (minY + rangeY) - 1; if (x >= minX && x <= maxX && y >= minY && y <= maxY) { // inside target area return true; } else if (x == minX - 1 && y >= minY && y <= maxY && (matrix[x][y] & WALL_EAST) == 0 && (surroundings & 0x8) == 0) { return true; } else if (x == maxX + 1 && y >= minY && y <= maxY && (matrix[x][y] & WALL_WEST) == 0 && (surroundings & 0x2) == 0) { return true; } else if (y == minY - 1 && x >= minX && x <= maxX && (matrix[x][y] & WALL_NORTH) == 0 && (surroundings & 0x4) == 0) { return true; } else if (y == maxY + 1 && x >= minX && x <= maxX && (matrix[x][y] & WALL_SOUTH) == 0 && (surroundings & 0x1) == 0) { return true; } return false; }
Last edited by Major; 12-08-2018 at 10:12 PM.

Kind of solved this, just wondering if theres a better way to get the surrounding tiles than this kind of loop:
Code:public Position findTileToUseObjectFrom(GameObjectDef def, GameObjectData object){ Position walkToPos = null; int x = def.getPosition().getX(); int y = def.getPosition().getY(); int sizeX = object.getSizeX(def.getFace())-1; int sizeY = object.getSizeY(def.getFace())-1; for(int i = x-1; i <= x+sizeX+1; i++) { for(int j = y-1; j <= y+sizeY+1; j++) { if(i >= x && i <= x+sizeX && j >= y && j <= y+sizeY){ //these tiles are part of the object } else { //these tiles are the surrounding tiles } } } return null; }
| « searching for good 317 source with HD on it | Request OSRS Base » |
| Thread Information |
Users Browsing this ThreadThere are currently 1 users browsing this thread. (0 members and 1 guests) |