Thread: Clipped projectiles

Results 1 to 8 of 8
  1. #1 Clipped projectiles 
    Registered Member
    AkZu's Avatar
    Join Date
    Jan 2008
    Age
    29
    Posts
    393
    Thanks given
    249
    Thanks received
    163
    Rep Power
    343
    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.


    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]))
    Problem lies within blockedShot code (check for objects with shift 0x20000 if they can be fired over).

    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 ~
    Spoiler for OSRS in #414:
    Reply With Quote  
     

  2. #2  
    Registered Member
    Join Date
    Aug 2009
    Posts
    630
    Thanks given
    79
    Thanks received
    24
    Rep Power
    52
    post ur blockedshot ?
    Reply With Quote  
     

  3. #3  
    Registered Member
    AkZu's Avatar
    Join Date
    Jan 2008
    Age
    29
    Posts
    393
    Thanks given
    249
    Thanks received
    163
    Rep Power
    343
    Quote Originally Posted by team b0 View Post
    post ur blockedshot ?
    Code:
    public static boolean blockedShot(int x, int y, int z) {
    		return (getClipping(x, y, z) & 0x20000) == 0;
    	}
    Spoiler for OSRS in #414:
    Reply With Quote  
     

  4. #4  
    Registered Member
    AkZu's Avatar
    Join Date
    Jan 2008
    Age
    29
    Posts
    393
    Thanks given
    249
    Thanks received
    163
    Rep Power
    343
    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;
    		}
    	}
    Spoiler for OSRS in #414:
    Reply With Quote  
     

  5. #5  
    Registered Member
    AkZu's Avatar
    Join Date
    Jan 2008
    Age
    29
    Posts
    393
    Thanks given
    249
    Thanks received
    163
    Rep Power
    343
    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
    Spoiler for OSRS in #414:
    Reply With Quote  
     

  6. #6  
    q.q


    Join Date
    Dec 2010
    Posts
    6,519
    Thanks given
    1,072
    Thanks received
    3,535
    Rep Power
    4752
    Quote Originally Posted by AkZu View Post
    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;
    		}
    	}
    what opcode are you referring to
    Reply With Quote  
     

  7. #7  
    Registered Member
    AkZu's Avatar
    Join Date
    Jan 2008
    Age
    29
    Posts
    393
    Thanks given
    249
    Thanks received
    163
    Rep Power
    343
    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
    Spoiler for OSRS in #414:
    Reply With Quote  
     

  8. #8  
    Registered Member
    craig903's Avatar
    Join Date
    Sep 2007
    Age
    30
    Posts
    1,357
    Thanks given
    14
    Thanks received
    92
    Rep Power
    238
    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...
    Visit Rune Miracle Here
    Reply With Quote  
     

  9. Thankful user:



Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Similar Threads

  1. Replies: 67
    Last Post: 07-31-2015, 03:03 AM
  2. Clipped Projectiles (for players)
    By I'mAGeek in forum Snippets
    Replies: 27
    Last Post: 04-06-2013, 07:02 AM
  3. Replies: 40
    Last Post: 08-22-2012, 10:26 AM
  4. Clipped Projectiles
    By Jiee in forum Help
    Replies: 1
    Last Post: 02-29-2012, 04:26 PM
  5. [PI] Clipped Projectiles
    By Boxxy in forum Buying
    Replies: 3
    Last Post: 12-02-2011, 11:59 AM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •