Thread: [Kronos] How to mics random tele home?

Page 2 of 4 FirstFirst 1234 LastLast
Results 11 to 20 of 36
  1. #11  
    Extreme Donator

    JayArrowz's Avatar
    Join Date
    Sep 2008
    Posts
    104
    Thanks given
    99
    Thanks received
    107
    Rep Power
    810
    Quote Originally Posted by Armo View Post
    Add public static final to the randomHomePos line of code so it should look like this:


    Code:
    public static final Position randomHomePos = new Position(ran.nextInt(2) + HOME.getX(), ran.nextInt(2) + HOME.getY(), HOME.getZ());
    Then add this code to wherever you want it to be called (Command, clicking a teleport, teleport interface, etc)

    Code:
    player.getMovement().teleport(World.randomHomePos);
    Dude? wtf is this? do you even know what ur doing here.

    Let me tell you:
    Ur creating a 1 static random home pos which WILL be the same for EVERYONE. Hardly random :\
    Reply With Quote  
     

  2. #12  
    RuneCasino


    Join Date
    Jul 2007
    Posts
    1,647
    Thanks given
    175
    Thanks received
    257
    Rep Power
    358
    Quote Originally Posted by JayArrowz View Post
    Dude? wtf is this? do you even know what ur doing here.

    Let me tell you:
    Ur creating a 1 static random home pos which WILL be the same for EVERYONE. Hardly random :\
    I know exactly what I'm doing here. Did you get triggered because you though he didn't have Misc.java because you read the error wrong?

    The Position.of method is what causes the position being sent to everyone causing player saving to glitch. It is static so it can be called from other classes, I use it and have no problems with it.
    Reply With Quote  
     

  3. #13  
    Extreme Donator

    JayArrowz's Avatar
    Join Date
    Sep 2008
    Posts
    104
    Thanks given
    99
    Thanks received
    107
    Rep Power
    810
    Quote Originally Posted by Armo View Post
    I know exactly what I'm doing here. Did you get triggered because you though he didn't have Misc.java because you read the error wrong?

    The Position.of method is what causes the position being sent to everyone causing player saving to glitch. It is static so it can be called from other classes, I use it and have no problems with it.
    No i got triggered cause ur posting a load of shit which is done wrongly to help this guy. Creating a position variable with a static scope saying its a unique random instance per player/teleport is WRONG.
    Reply With Quote  
     

  4. #14  
    plz dont take my wizard mind bombs Women's Avatar
    Join Date
    Mar 2010
    Posts
    1,881
    Thanks given
    724
    Thanks received
    1,162
    Rep Power
    4763
    Quote Originally Posted by Armo View Post
    I know exactly what I'm doing here. Did you get triggered because you though he didn't have Misc.java because you read the error wrong?

    The Position.of method is what causes the position being sent to everyone causing player saving to glitch. It is static so it can be called from other classes, I use it and have no problems with it.
    you have a fundamental misunderstanding of the static modifier
    Reply With Quote  
     

  5. Thankful user:


  6. #15  
    RuneCasino


    Join Date
    Jul 2007
    Posts
    1,647
    Thanks given
    175
    Thanks received
    257
    Rep Power
    358
    Quote Originally Posted by Women View Post
    you have a fundamental misunderstanding of the static modifier
    You 2 are going to have to tell Patrity that then, the source was released with these 2 lines of code, I didn't touch anything:

    Code:
        public static final Position HOME = Position.of(2028, 3577, 0);
        public static final Position EDGEHOME = Position.of(3085, 3492, 0);
    I see no problem with it, it doesn't hurt anything.
    Reply With Quote  
     

  7. #16  
    Extreme Donator

    JayArrowz's Avatar
    Join Date
    Sep 2008
    Posts
    104
    Thanks given
    99
    Thanks received
    107
    Rep Power
    810
    Quote Originally Posted by Armo View Post
    You 2 are going to have to tell Patrity that then, the source was released with these 2 lines of code, I didn't touch anything:

    Code:
        public static final Position HOME = Position.of(2028, 3577, 0);
        public static final Position EDGEHOME = Position.of(3085, 3492, 0);
    And I will say this again, stop being a know it all. I see no problem with it, it doesn't hurt anything.
    You have to realize that these static variables are CONSTANT they do not change. What your random method is MEANT to do is mutate these constants using local method variables and then use that local variable in the start teleport, so it does not have a static scope but a local scope. By you making it have a random pos AND a STATIC scope, it gets initialized ONCE per APPLICATION LIFETIME. Which means ALL players will pull the same "random" Position which is not really going to be random.
    Reply With Quote  
     

  8. #17  
    RuneCasino


    Join Date
    Jul 2007
    Posts
    1,647
    Thanks given
    175
    Thanks received
    257
    Rep Power
    358
    Quote Originally Posted by JayArrowz View Post
    You have to realize that these static variables are CONSTANT they do not change. What your random method is MEANT to do is mutate these constants using local method variables and then use that local variable in the start teleport, so it does not have a static scope but a local scope. By you making it have the random pos a STATIC scope, it gets initialized ONCE per APPLICATION LIFETIME. Which means ALL players will pull the same "random" Position which is not really going to be random.
    I see what you're saying now, my mistake. I wasn't thinking about the placement of the random method. There should be no position line, and wherever its being called should handle the random there.

    @OP

    Use this wherever you want it to be called:
    Code:
    Random ran = new Random(); 
    
    player.getMovement().teleport(World.randomHomePos.getX() + ran.nextInt(2),World.randomHomePos.getY() + ran.nextInt(2),World.randomHomePos.getZ());
    Reply With Quote  
     

  9. #18  
    Extreme Donator

    JayArrowz's Avatar
    Join Date
    Sep 2008
    Posts
    104
    Thanks given
    99
    Thanks received
    107
    Rep Power
    810
    Quote Originally Posted by Armo View Post
    I see what you're saying now, my mistake. I wasn't thinking about the placement of the random method. There should be no position line, and wherever its being called should handle the random there.
    Exactly , at-least you get me now haha
    Reply With Quote  
     

  10. #19  
    WVWVWVWVWVWVWVW

    _jordan's Avatar
    Join Date
    Nov 2012
    Posts
    3,046
    Thanks given
    111
    Thanks received
    1,848
    Rep Power
    5000
    we fighting over some java fields now? grabbing popcorn
    Attached image
    Attached image
    Reply With Quote  
     

  11. #20  
    Extreme Donator


    Join Date
    Jul 2008
    Age
    31
    Posts
    956
    Thanks given
    186
    Thanks received
    344
    Rep Power
    1060
    Quote Originally Posted by Armo View Post
    You 2 are going to have to tell Patrity that then, the source was released with these 2 lines of code, I didn't touch anything:

    Code:
        public static final Position HOME = Position.of(2028, 3577, 0);
        public static final Position EDGEHOME = Position.of(3085, 3492, 0);
    I see no problem with it, it doesn't hurt anything.
    <?>
    It's final... The variables input there are always the same. When you just throw misc.rand around willy nilly, the values are no longer constant.
    Reply With Quote  
     

Page 2 of 4 FirstFirst 1234 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. How to Portfoward A Bt-Home-Hub V.2[PICS]
    By A I R Z in forum Tutorials
    Replies: 1
    Last Post: 08-17-2009, 12:23 PM
  2. Replies: 8
    Last Post: 07-17-2009, 05:11 PM
  3. how to make a new home in a 474
    By DSscape™ in forum Tutorials
    Replies: 12
    Last Post: 06-14-2009, 04:55 AM
  4. How to Drop random Item Amounts
    By tucybro in forum Tutorials
    Replies: 7
    Last Post: 06-08-2009, 11:11 PM
  5. Replies: 15
    Last Post: 10-02-2008, 03:27 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
  •