Thread: Verify Walking (NPC / PLAYER)

Page 1 of 2 12 LastLast
Results 1 to 10 of 14
  1. #1 Verify Walking (NPC / PLAYER) 
    Respected Member


    George's Avatar
    Join Date
    Mar 2009
    Posts
    7,099
    Thanks given
    2,226
    Thanks received
    3,146
    Rep Power
    5000
    Requirements; Palidino's region class
    Purpose; Stopping ppl with cheat clients from noclipping all over your server

    First add this in your region class.
    Code:
    	public static boolean canMove(int startX, int startY, int endX, int endY,
    			int height, int xLength, int yLength) {
    		int diffX = endX - startX;
    		int diffY = endY - startY;
    		int max = Math.max(Math.abs(diffX), Math.abs(diffY));
    		for (int ii = 0; ii < max; ii++) {
    			int currentX = endX - diffX;
    			int currentY = endY - diffY;
    			for (int i = 0; i < xLength; i++) {
    				for (int i2 = 0; i2 < yLength; i2++)
    					if (diffX < 0 && diffY < 0) {
    						if ((getClipping((currentX + i) - 1,
    								(currentY + i2) - 1, height) & 0x128010e) != 0
    								|| (getClipping((currentX + i) - 1, currentY
    										+ i2, height) & 0x1280108) != 0
    								|| (getClipping(currentX + i,
    										(currentY + i2) - 1, height) & 0x1280102) != 0)
    							return false;
    					} else if (diffX > 0 && diffY > 0) {
    						if ((getClipping(currentX + i + 1, currentY + i2 + 1,
    								height) & 0x12801e0) != 0
    								|| (getClipping(currentX + i + 1,
    										currentY + i2, height) & 0x1280180) != 0
    								|| (getClipping(currentX + i,
    										currentY + i2 + 1, height) & 0x1280120) != 0)
    							return false;
    					} else if (diffX < 0 && diffY > 0) {
    						if ((getClipping((currentX + i) - 1, currentY + i2 + 1,
    								height) & 0x1280138) != 0
    								|| (getClipping((currentX + i) - 1, currentY
    										+ i2, height) & 0x1280108) != 0
    								|| (getClipping(currentX + i,
    										currentY + i2 + 1, height) & 0x1280120) != 0)
    							return false;
    					} else if (diffX > 0 && diffY < 0) {
    						if ((getClipping(currentX + i + 1, (currentY + i2) - 1,
    								height) & 0x1280183) != 0
    								|| (getClipping(currentX + i + 1,
    										currentY + i2, height) & 0x1280180) != 0
    								|| (getClipping(currentX + i,
    										(currentY + i2) - 1, height) & 0x1280102) != 0)
    							return false;
    					} else if (diffX > 0 && diffY == 0) {
    						if ((getClipping(currentX + i + 1, currentY + i2,
    								height) & 0x1280180) != 0)
    							return false;
    					} else if (diffX < 0 && diffY == 0) {
    						if ((getClipping((currentX + i) - 1, currentY + i2,
    								height) & 0x1280108) != 0)
    							return false;
    					} else if (diffX == 0 && diffY > 0) {
    						if ((getClipping(currentX + i, currentY + i2 + 1,
    								height) & 0x1280120) != 0)
    							return false;
    					} else if (diffX == 0
    							&& diffY < 0
    							&& (getClipping(currentX + i, (currentY + i2) - 1,
    									height) & 0x1280102) != 0)
    						return false;
    
    			}
    
    			if (diffX < 0)
    				diffX++;
    			else if (diffX > 0)
    				diffX--;
    			if (diffY < 0)
    				diffY++;
    			else if (diffY > 0)
    				diffY--;
    		}
    
    		return true;
    	}
    Next thing you do is go into your NPC class and find "int getNextWalkingDirection() {" below "dir = Misc.direction(absX, absY, (absX + moveX), (absY + moveY));" add
    Code:
    		if (!Region.canMove(absX, absY, (absX + moveX), (absY + moveY), heightLevel, 1, 1))
    			return -1;
    If you wanna use NPC sizes, here's a dump that you can use(Only goes up to 474 npcs).

    Download npcsize.txt @ UppIT


    Player walking, go into your player class and find "int getNextWalkingDirection() {" and under "currentY += Misc.directionDeltaY[dir];" add

    Code:
    		if (!Region.canMove(absX, absY, (absX + Misc.directionDeltaX[dir]), (absY + Misc.directionDeltaY[dir]), heightLevel, 1, 1))
    			return -1;
    Done.



    To dump npc sizes
    Code:
        public static void dumpSizes() {
        	BufferedWriter writer = null;
        	try {
    		    writer = new BufferedWriter( new FileWriter("npcsize.txt", true));
        		for (int j = 0; j < npc amount; j++) {
        			EntityDef n = EntityDef.forID(j);
        		    writer.write(j + "	" + n.aByte68);
        		    writer.newLine();
        		}
        		//writer.write(-1);
    		    writer.close();
    		} catch (IOException ioexception) {
    			ioexception.printStackTrace();
    		}
    	}
    Attached image

    Spoiler for Spoilers!:
    Attached image
    Attached image
    Attached image
    Attached image
    Reply With Quote  
     

  2. Thankful users:


  3. #2  
    Banned

    Join Date
    Mar 2013
    Posts
    256
    Thanks given
    356
    Thanks received
    109
    Rep Power
    0
    First, thanks for this mate!
    Reply With Quote  
     

  4. #3  
    Respected Member


    George's Avatar
    Join Date
    Mar 2009
    Posts
    7,099
    Thanks given
    2,226
    Thanks received
    3,146
    Rep Power
    5000
    Quote Originally Posted by Nephalem View Post
    First, thanks for this mate!
    No problemo.
    Attached image

    Spoiler for Spoilers!:
    Attached image
    Attached image
    Attached image
    Attached image
    Reply With Quote  
     

  5. #4  
    Registered MrClassic
    MrClassic's Avatar
    Join Date
    Oct 2008
    Age
    15
    Posts
    2,063
    Thanks given
    24,154
    Thanks received
    551
    Rep Power
    5000
    So what you've posted here is clipped following? Because all I see is you're attacking a monster
    Reply With Quote  
     

  6. #5  
    Respected Member


    George's Avatar
    Join Date
    Mar 2009
    Posts
    7,099
    Thanks given
    2,226
    Thanks received
    3,146
    Rep Power
    5000
    Quote Originally Posted by mrClassic View Post
    So what you've posted here is clipped following? Because all I see is you're attacking a monster
    It's a walking check? Has nothing to do with following.
    Attached image

    Spoiler for Spoilers!:
    Attached image
    Attached image
    Attached image
    Attached image
    Reply With Quote  
     

  7. #6  
    Registered MrClassic
    MrClassic's Avatar
    Join Date
    Oct 2008
    Age
    15
    Posts
    2,063
    Thanks given
    24,154
    Thanks received
    551
    Rep Power
    5000
    Quote Originally Posted by Coder Sponjebubu View Post
    It's a walking check? Has nothing to do with following.
    Yeah, already knew it. Thanks man and nice job
    Reply With Quote  
     

  8. #7  
    Member Verify Walking (NPC / PLAYER) Market Banned


    Luke132's Avatar
    Join Date
    Dec 2007
    Age
    35
    Posts
    12,574
    Thanks given
    199
    Thanks received
    7,106
    Rep Power
    5000
    thx needed this


































































































    jk









































































    gj tho repped

    Attached imageAttached image
    Reply With Quote  
     

  9. #8  
    Registered Member

    Join Date
    Jun 2011
    Posts
    2,458
    Thanks given
    23
    Thanks received
    650
    Rep Power
    390
    thanks mr generous
    Reply With Quote  
     

  10. #9  
    Registered Member
    Mylyn's Avatar
    Join Date
    Dec 2012
    Posts
    1,536
    Thanks given
    602
    Thanks received
    278
    Rep Power
    119
    I did it differently but this way is better tbh.
    Nice one, thanks for this.
    Reply With Quote  
     

  11. #10  
    Respected Member


    George's Avatar
    Join Date
    Mar 2009
    Posts
    7,099
    Thanks given
    2,226
    Thanks received
    3,146
    Rep Power
    5000
    No problem.
    Attached image

    Spoiler for Spoilers!:
    Attached image
    Attached image
    Attached image
    Attached image
    Reply With Quote  
     

Page 1 of 2 12 LastLast

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: 795
    Last Post: 03-24-2013, 08:45 PM
  2. Making NPCs not walk throught Players & NPCs
    By Nemmyz in forum Configuration
    Replies: 10
    Last Post: 03-11-2009, 12:20 PM
  3. [474] Advanced NPC & Player Combat and system!
    By wizzyt21 in forum Tutorials
    Replies: 10
    Last Post: 11-29-2008, 10:01 AM
  4. [Request] No Npc & Player Noclipping
    By zezarak in forum Requests
    Replies: 10
    Last Post: 10-12-2008, 02:10 AM
  5. [508] NPC, Player, Magic Combat
    By Martin in forum RS 503+ Client & Server
    Replies: 19
    Last Post: 08-28-2008, 03:31 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
  •