Thread: [PI] Stairs

Results 1 to 7 of 7
  1. #1 [PI] Stairs 
    Registered Member Queer's Avatar
    Join Date
    Aug 2008
    Age
    26
    Posts
    781
    Thanks given
    210
    Thanks received
    33
    Rep Power
    33
    Solved.
    Reply With Quote  
     

  2. #2  
    Motivation is your best friend
    geordie's Avatar
    Join Date
    Nov 2008
    Posts
    749
    Thanks given
    3
    Thanks received
    19
    Rep Power
    0
    This is a ongoing problem in p.i, it's apparently very difficult to fix this but i haven't tried so what do i know.
    Reply With Quote  
     

  3. #3  
    Registered Member
    Vox''s Avatar
    Join Date
    Nov 2008
    Age
    27
    Posts
    3,116
    Thanks given
    49
    Thanks received
    180
    Rep Power
    731
    if (c.objectX == #### && c.objectY == ####) {
    c.teleportToX = 2562;
    c.teleportToY = 9014;
    c.heightLevel = 2;
    } else {
    return poop;
    }

    Quote Originally Posted by Zirtrix View Post
    So I've recently changed some things in the server, but when i compile it says
    Code:
    source\server\model\players\packets\Commands.java: 58: error: cannot find symbol
    This.Antileech("Remove This Line");
    ^
    Anyone know the problem?
    Student and Developer for [Only registered and activated users can see links. ]
    Reply With Quote  
     

  4. #4  
    Registered Member

    Join Date
    Sep 2008
    Posts
    4,820
    Thanks given
    889
    Thanks received
    1,434
    Rep Power
    2924
    Quote Originally Posted by Victim View Post
    This is a ongoing problem in p.i, it's apparently very difficult to fix this but i haven't tried so what do i know.
    What are you talking about?

    Here, use my stairHandler. I didn't quite finish it, but its functional.

    Code:
    package server.model.objects;
    
    import server.model.players.Client;
    
    /**
     * 
     * @author Faris
     */
    public class Stairs {
        
        /**
         * Deciphers movement position based upon current height-level
         * @param c
         * @param stairs 
         */
        public static void handleStairs(Client c, final int stairs){
        steps(c);
    	if (stairs != 1738) {
    		if (c.heightLevel == 0) {
    			c.getPA().movePlayer(c.absX, c.absY, 1);
    		} else if (c.heightLevel == 1) {
    			c.getPA().movePlayer(c.absX, c.absY, 0);
    		} else if (c.heightLevel == 2) {
    			c.getPA().movePlayer(c.absX, c.absY, 1);
    		} else if (c.heightLevel == 3) {
    			c.getPA().movePlayer(c.absX, c.absY, 2);
    		}
    	} else {
                c.getPA().movePlayer(c.absX, c.absY, c.heightLevel+1);
    	}
        }
        
        /**
         * hands two way up - down options for stairs
         * @param c
         * @param climbType 
         */
        public static void stairsOption(Client c,final String climbType) {
    	c.stairsInteracting = false;
    	steps(c);
                if (climbType.equalsIgnoreCase("up")) {
                        c.getPA().movePlayer(c.absX, c.absY, c.heightLevel += 1);
                }
                if (climbType.equalsIgnoreCase("down")) {
                        c.getPA().movePlayer(c.absX, c.absY, c.heightLevel -= 1);
                }
        }
        
        /**
         * Sends two way up - down options for stairs
         * @param c 
         */
        public static void getStairsOption(Client c) {
    	c.stairsInteracting = true;
    	String s = "Climb up the stairs.", s1 = "Climb down the stairs.";
    	c.getDH().sendOption2(s, s1);
        }
        
        /**
         * Misc stairs actions (EG Facing, closing windows)
         * @param c 
         */
        private static void steps(Client c){
    	int x = c.objectX, y = c.objectY;
    	faceStairs(c, x, y);
    	c.resetWalkingQueue();
    	c.getPA().requestUpdates();
    	c.getPA().removeAllWindows();
    	c.stopMovement();
        }
        
        /**
         * Turns player toward stairs
         * @param c
         * @param x
         * @param y 
         */
        private static void faceStairs(Client c, final int x, final int y) {
    	if (c.FocusPointX >= x) {
    		c.turnPlayerTo(0, y - 2);
    	} else if (c.FocusPointY >= y) {
    		c.turnPlayerTo(x - 2, 0);
    	} else if (c.FocusPointX < x) {
    		c.turnPlayerTo(x, y);
    	} else if (c.FocusPointY <= y) {
    		c.turnPlayerTo(x, y);
    	}
        }
    }
    "Know thy self, know thy enemy. A thousand battles, a thousand victories." - Sun Tzu
    GitHub: [Only registered and activated users can see links. ]
    Reply With Quote  
     

  5. #5  
    Donator
    Mr Extremez's Avatar
    Join Date
    Jun 2012
    Posts
    2,221
    Thanks given
    91
    Thanks received
    292
    Rep Power
    61
    Quote Originally Posted by Faris View Post
    What are you talking about?

    Here, use my stairHandler. I didn't quite finish it, but its functional.

    Code:
    package server.model.objects;
    
    import server.model.players.Client;
    
    /**
     * 
     * @author Faris
     */
    public class Stairs {
        
        /**
         * Deciphers movement position based upon current height-level
         * @param c
         * @param stairs 
         */
        public static void handleStairs(Client c, final int stairs){
        steps(c);
    	if (stairs != 1738) {
    		if (c.heightLevel == 0) {
    			c.getPA().movePlayer(c.absX, c.absY, 1);
    		} else if (c.heightLevel == 1) {
    			c.getPA().movePlayer(c.absX, c.absY, 0);
    		} else if (c.heightLevel == 2) {
    			c.getPA().movePlayer(c.absX, c.absY, 1);
    		} else if (c.heightLevel == 3) {
    			c.getPA().movePlayer(c.absX, c.absY, 2);
    		}
    	} else {
                c.getPA().movePlayer(c.absX, c.absY, c.heightLevel+1);
    	}
        }
        
        /**
         * hands two way up - down options for stairs
         * @param c
         * @param climbType 
         */
        public static void stairsOption(Client c,final String climbType) {
    	c.stairsInteracting = false;
    	steps(c);
                if (climbType.equalsIgnoreCase("up")) {
                        c.getPA().movePlayer(c.absX, c.absY, c.heightLevel += 1);
                }
                if (climbType.equalsIgnoreCase("down")) {
                        c.getPA().movePlayer(c.absX, c.absY, c.heightLevel -= 1);
                }
        }
        
        /**
         * Sends two way up - down options for stairs
         * @param c 
         */
        public static void getStairsOption(Client c) {
    	c.stairsInteracting = true;
    	String s = "Climb up the stairs.", s1 = "Climb down the stairs.";
    	c.getDH().sendOption2(s, s1);
        }
        
        /**
         * Misc stairs actions (EG Facing, closing windows)
         * @param c 
         */
        private static void steps(Client c){
    	int x = c.objectX, y = c.objectY;
    	faceStairs(c, x, y);
    	c.resetWalkingQueue();
    	c.getPA().requestUpdates();
    	c.getPA().removeAllWindows();
    	c.stopMovement();
        }
        
        /**
         * Turns player toward stairs
         * @param c
         * @param x
         * @param y 
         */
        private static void faceStairs(Client c, final int x, final int y) {
    	if (c.FocusPointX >= x) {
    		c.turnPlayerTo(0, y - 2);
    	} else if (c.FocusPointY >= y) {
    		c.turnPlayerTo(x - 2, 0);
    	} else if (c.FocusPointX < x) {
    		c.turnPlayerTo(x, y);
    	} else if (c.FocusPointY <= y) {
    		c.turnPlayerTo(x, y);
    	}
        }
    }
    Honestly lol? This was released. [Only registered and activated users can see links. ]
    Reply With Quote  
     

  6. Thankful users:


  7. #6  
    Registered Member Queer's Avatar
    Join Date
    Aug 2008
    Age
    26
    Posts
    781
    Thanks given
    210
    Thanks received
    33
    Rep Power
    33
    Quote Originally Posted by I'm A Boss View Post
    Honestly lol? This was released. [Only registered and activated users can see links. ]
    That's ladders he posted stairs. Where would I put this stair code faris?
    Reply With Quote  
     

  8. #7  
    Registered Member

    Join Date
    Sep 2008
    Posts
    4,820
    Thanks given
    889
    Thanks received
    1,434
    Rep Power
    2924
    Quote Originally Posted by I'm A Boss View Post
    Honestly lol? This was released. [Only registered and activated users can see links. ]
    Incase you havnt noticed, stairs and ladders perform very similar functions.
    Admittedly I used the ladders handler as a template so I could do it quickly, so the small bit of functionality isnt exactly uncommon. Still a far better option using this class over some of the silly examples of code being posted above.

    Quote Originally Posted by Queer View Post
    That's ladders he posted stairs. Where would I put this stair code faris?
    Make this a new class, reference it from your actionhandler.
    "Know thy self, know thy enemy. A thousand battles, a thousand victories." - Sun Tzu
    GitHub: [Only registered and activated users can see links. ]
    Reply With Quote  
     


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. Need help with going down stairs.
    By gucci gravy in forum Help
    Replies: 4
    Last Post: 05-30-2012, 10:04 PM
  2. [PI] Stairs hate me...
    By Chris SS in forum Help
    Replies: 6
    Last Post: 11-03-2010, 06:41 AM
  3. //down stairs
    By Pronyma in forum Help
    Replies: 13
    Last Post: 11-30-2009, 04:28 AM
  4. stairs!
    By Romania Clan in forum Help
    Replies: 0
    Last Post: 09-08-2009, 04:05 PM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •