Thread: [Elvarg] Ladder code not working

Page 1 of 2 12 LastLast
Results 1 to 10 of 11
  1. #1 [Elvarg] Ladder code not working 
    Registered Member Hyped's Avatar
    Join Date
    Dec 2016
    Posts
    171
    Thanks given
    21
    Thanks received
    7
    Rep Power
    4
    Heya!

    I want to install a laddersystem this is what i got so far

    Code:
    				case LADDERUP:
    					player.setPositionToFace(position);	
    					player.getMovementQueue().reset();
    					player.getPacketSender().sendMessage("You climb up a ladder.");
    					player.performAnimation(new Animation(828, Priority.HIGH));		
    					if(player.getPosition().getZ() == 0) {
    						player.getPacketSender().sendMessage("@red@test");
    						new Position(x,y, player.getPosition().getZ() +1);
    					}
    					break;
    The animation works, and the server also sends "test" in the chatbox as expected why is my Z position not changing?

    Reginald
    learning, learning, learning, learning
    Reply With Quote  
     

  2. #2  
    Extreme Donator


    Join Date
    Nov 2011
    Posts
    311
    Thanks given
    15
    Thanks received
    94
    Rep Power
    361
    Quote Originally Posted by reginaldrsps View Post
    Heya!

    I want to install a laddersystem this is what i got so far

    Code:
    				case LADDERUP:
    					player.setPositionToFace(position);	
    					player.getMovementQueue().reset();
    					player.getPacketSender().sendMessage("You climb up a ladder.");
    					player.performAnimation(new Animation(828, Priority.HIGH));		
    					if(player.getPosition().getZ() == 0) {
    						player.getPacketSender().sendMessage("@red@test");
    						new Position(x,y, player.getPosition().getZ() +1);
    					}
    					break;
    The animation works, and the server also sends "test" in the chatbox as expected why is my Z position not changing?

    Reginald
    new Position(x,y, player.getPosition().getZ() +1);
    Your not actually changing the players position plus one, You are just creating a new object of position.


    To move the player you would do.
    player.moveTo(new Position(x,y, player.getPosition().getZ() +1));
    Also make sure you define the x and y variables.
    Reply With Quote  
     

  3. #3  
    Registered Member
    Join Date
    Apr 2017
    Posts
    301
    Thanks given
    34
    Thanks received
    59
    Rep Power
    65
    Haven't really been bothered to test, but ternary use would be nice I guess. You're also calling your new Position wrong.

    Code:
    player.moveTo(new Position(player.getPosition().getX(), player.getPosition().getY(), player.getPosition().getZ() == 0 ? +1 : -1));
    Reply With Quote  
     

  4. #4  
    Registered Member
    Andys1814's Avatar
    Join Date
    Feb 2013
    Posts
    974
    Thanks given
    688
    Thanks received
    455
    Rep Power
    727
    Quote Originally Posted by VenomRS View Post
    Haven't really been bothered to test, but ternary use would be nice I guess. You're also calling your new Position wrong.

    Code:
    player.moveTo(new Position(player.getPosition().getX(), player.getPosition().getY(), player.getPosition().getZ() == 0 ? +1 : -1));
    This wouldn't work as intended though because there is some buildings with multiple levels and ladders
    Reply With Quote  
     

  5. #5  
    Registered Member
    Join Date
    Apr 2017
    Posts
    301
    Thanks given
    34
    Thanks received
    59
    Rep Power
    65
    Quote Originally Posted by Andys1814 View Post
    This wouldn't work as intended though because there is some buildings with multiple levels and ladders
    Yeah, i'll go write up a ladder system then

    However would work for standard ladders for single floor to upper like Edgevile shop maybe. Again it's chicken scratch written so hope for the best.
    Reply With Quote  
     

  6. #6  
    Registered Member Hyped's Avatar
    Join Date
    Dec 2016
    Posts
    171
    Thanks given
    21
    Thanks received
    7
    Rep Power
    4
    Quote Originally Posted by VenomRS View Post
    Haven't really been bothered to test, but ternary use would be nice I guess. You're also calling your new Position wrong.

    Code:
    player.moveTo(new Position(player.getPosition().getX(), player.getPosition().getY(), player.getPosition().getZ() == 0 ? +1 : -1));
    Thanks it worked but what does this

    Code:
    == 0 ? +1 : -1))
    mean?

    I also played around with the numbers for a LadderDown but i cant seem to find it.
    learning, learning, learning, learning
    Reply With Quote  
     

  7. #7  
    Super Donator


    Join Date
    Feb 2011
    Age
    27
    Posts
    1,126
    Thanks given
    180
    Thanks received
    178
    Rep Power
    243
    Quote Originally Posted by reginaldrsps View Post
    Heya!

    I want to install a laddersystem this is what i got so far

    Code:
    				case LADDERUP:
    					player.setPositionToFace(position);	
    					player.getMovementQueue().reset();
    					player.getPacketSender().sendMessage("You climb up a ladder.");
    					player.performAnimation(new Animation(828, Priority.HIGH));		
    					if(player.getPosition().getZ() == 0) {
    						player.getPacketSender().sendMessage("@red@test");
    						new Position(x,y, player.getPosition().getZ() +1);
    					}
    					break;
    The animation works, and the server also sends "test" in the chatbox as expected why is my Z position not changing?

    Reginald
    Because
    Code:
     new Position(x,y, player.getPosition().getZ() +1);
    Just generates a new position instance but doesn't apply to something maybe...
    Code:
      player.moveTo(new Position(x,y, player.getPosition().getZ() +1));
    ?
    Reply With Quote  
     

  8. #8  
    Registered Member Hyped's Avatar
    Join Date
    Dec 2016
    Posts
    171
    Thanks given
    21
    Thanks received
    7
    Rep Power
    4
    Thanks guys! got it!
    but still what does this mean

    Code:
    == 0 ? +1 : -1))
    learning, learning, learning, learning
    Reply With Quote  
     

  9. #9  
    Extreme Donator


    Join Date
    Nov 2011
    Posts
    311
    Thanks given
    15
    Thanks received
    94
    Rep Power
    361
    Quote Originally Posted by reginaldrsps View Post
    Thanks guys! got it!
    but still what does this mean

    Code:
    == 0 ? +1 : -1))

    Thats basically saying, If your players height is 0, Move him up to 1, If its not 0 then move him down 1
    Reply With Quote  
     

  10. Thankful user:


  11. #10  
    Registered Member

    Join Date
    Dec 2012
    Posts
    2,999
    Thanks given
    894
    Thanks received
    921
    Rep Power
    2555
    Quote Originally Posted by reginaldrsps View Post
    Thanks guys! got it!
    but still what does this mean

    Code:
    == 0 ? +1 : -1))
    Code:
    condition ? true : false
    Attached image
    Reply With Quote  
     

  12. Thankful user:


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: 1
    Last Post: 08-16-2012, 08:58 AM
  2. 639 [Dementhium] Yell Code not working
    By greenxbox in forum Help
    Replies: 1
    Last Post: 08-12-2012, 06:16 AM
  3. Taking all Half finished code/not working
    By youngy_james in forum Requests
    Replies: 5
    Last Post: 05-02-2012, 08:46 PM
  4. code not working right?
    By Serenity in forum Application Development
    Replies: 0
    Last Post: 02-25-2011, 01:33 PM
  5. Replies: 12
    Last Post: 07-11-2009, 02:33 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
  •