post ur blockedshot ?
|
Okay guys I've used killamesses notes on how to make projectiles clipped.
But for some reason the 0x20000 shift 'flag' is killing me and allows me to shoot throught walls?
Heres a picture of the problem and piece of code wich causes the problem.
Problem lies within blockedShot code (check for objects with shift 0x20000 if they can be fired over).Code:if (!Region.getClipping(path[i][0], path[i][1], path[i][2], path[i][3], path[i][4]) && !Region.blockedShot(path[i][0], path[i][1], path[i][2]))
Thanks in advance! Trying to get back to my feet and return to program Kalegrian
EDIT: Found the boolean wich gives good enough data for objects that can be fired over.
Now the problem is that getClipping code is bugged and allows me to shoot diagonally past walls/anything. I've fixed it around so it blocks the attacks but then again if 2 characters are in diagonal position it wont let attack the other one, something wrong with the code seen below post #8.
~ See this post >> http://www.rune-server.org/runescape...ml#post3587027 ~
BUMP!
Now I have discovered that there's only 1 boolean in objectdef wich data makes sense to be the flag for what I need.
It also gives some strange objects too but some of them make sense like bank booths so you can talk to banker without finding path behind the bank
But when I disabled checking for the objects that can be shoot over I saw that the getClipping code fucks up with diagonals when ranging.
Now past 2 days I've tried to edit it so it checks diagonals and got it SOMEHOW working, but then even if there's nothing that can block me from attacking, if I get my characters to diagonal position it says blocked path and doesn't shoot.
I'd like to get that fixed but I seem to not get it working correctly.
Any help? Thanks in advance!
Code below:
Code:public static boolean getClipping(int x, int y, int height, int moveTypeX, int moveTypeY) { try { if (height > 3) height = 0; //int checkX = (x + moveTypeX); //int checkY = (y + moveTypeY); //System.err.println(checkX + " " + checkY); //west if (moveTypeX == -1 && moveTypeY == 0) return (getClipping(x, y, height) & 0x1280108) == 0; //east else if (moveTypeX == 1 && moveTypeY == 0) return (getClipping(x, y, height) & 0x1280180) == 0; //south else if (moveTypeX == 0 && moveTypeY == -1) return (getClipping(x, y, height) & 0x1280102) == 0; //north else if (moveTypeX == 0 && moveTypeY == 1) return (getClipping(x, y, height) & 0x1280120) == 0; //south-west else if (moveTypeX == -1 && moveTypeY == -1) return blockedSouthWest(x, y, height, false) && blockedSouth(x, y, height, false) && blockedWest(x, y, height, false); //south-east else if (moveTypeX == 1 && moveTypeY == -1) return blockedSouthEast(x, y, height, false) && blockedSouth(x, y, height, false) && blockedEast(x, y, height, false); //north-west else if (moveTypeX == -1 && moveTypeY == 1) return blockedNorthWest(x, y, height, false) && blockedNorth(x, y, height, false) && blockedWest(x, y, height, false); //north-east else if (moveTypeX == 1 && moveTypeY == 1) return blockedNorthEast(x, y, height, false) && blockedNorth(x, y, height, false) && blockedEast(x, y, height, false); else { return false; } } catch (Exception e) { e.printStackTrace(); return true; } }
Buuuump. Basically just need to figure working check for diagonal walls when ranging. I know all the shifts used for them but not sure what is wrong.
Help please
After few good threads of read I think the only way to get shootable objects is to define them by myself. The as known "walkable" (op:18) boolean gave abit wrong data but first I looked it was good lol
Yes there are no flags or data that we are aware off which gives you this information. When shooting diagonally you have to check two tiles each 'step' X+1 and y+1 as an example. I'm currently just using walkable tiles as shootable. also remember that you have to check the entire projectiles path. Although I have just thaught off something which could help. We could load all the object data into a custom loader which calculates or retrieves the objects height. We could then set all objects with a height lower then X as rangable etc...
« Previous Thread | Next Thread » |
Thread Information |
Users Browsing this ThreadThere are currently 1 users browsing this thread. (0 members and 1 guests) |