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

Page 4 of 4 FirstFirst ... 234
Results 31 to 36 of 36
  1. #31  
    RuneCasino


    Join Date
    Jul 2007
    Posts
    1,618
    Thanks given
    170
    Thanks received
    228
    Rep Power
    326
    Quote Originally Posted by Ilgaz View Post
    My home command:

    case "home": {
    Random ran = new Random();
    teleport(World.randomHomePos.getX() + ran.nextInt(2),World.randomHomePos.getY() + ran.nextInt(2),World.randomHomePos.getZ()); ([Only registered and activated users can see links. ])
    return true;
    }

    And this is what I have in World.java
    Sorry, forgot the "player," in the line use this:

    Code:
    teleport(player, World.randomHomePos.getX() + ran.nextInt(2),World.randomHomePos.getY() + ran.nextInt(2),World.randomHomePos.getZ());
    Reply With Quote  
     

  2. Thankful user:


  3. #32  
    Registered Member
    Join Date
    Nov 2020
    Posts
    78
    Thanks given
    41
    Thanks received
    2
    Rep Power
    23
    Quote Originally Posted by Armo View Post
    Sorry, forgot the "player," in the line use this:

    Code:
    teleport(player, World.randomHomePos.getX() + ran.nextInt(2),World.randomHomePos.getY() + ran.nextInt(2),World.randomHomePos.getZ());
    We did something unwise, I tried to make it through the spellbook teleport, and it's not a mics random teleport look here:

    [Only registered and activated users can see links. ]
    Reply With Quote  
     

  4. #33  
    RuneCasino


    Join Date
    Jul 2007
    Posts
    1,618
    Thanks given
    170
    Thanks received
    228
    Rep Power
    326
    Quote Originally Posted by Ilgaz View Post
    We did something unwise, I tried to make it through the spellbook teleport, and it's not a mics random teleport look here:

    [Only registered and activated users can see links. ]
    The spellbook teleport won't be random because it's being called without the random integers. I will write something for you so you can call it for the spellbook teleports

    Quote Originally Posted by Ilgaz View Post
    We did something unwise, I tried to make it through the spellbook teleport, and it's not a mics random teleport look here:

    [Only registered and activated users can see links. ]
    Replace it all with this (I tested it and it works)

    Code:
        static Random ran = new Random();
    
        public static final HomeTeleport MODERN = new HomeTeleport(p -> ModernTeleport.teleport(p, new Position(World.randomHomePos.getX() + ran.nextInt(2),World.randomHomePos.getY() + ran.nextInt(2),World.randomHomePos.getZ())));
    
        public static final HomeTeleport ANCIENT = new HomeTeleport(p -> ModernTeleport.teleport(p, new Position(World.randomHomePos.getX() + ran.nextInt(2),World.randomHomePos.getY() + ran.nextInt(2),World.randomHomePos.getZ())));
    
        public static final HomeTeleport LUNAR = new HomeTeleport(p -> ModernTeleport.teleport(p, new Position(World.randomHomePos.getX() + ran.nextInt(2),World.randomHomePos.getY() + ran.nextInt(2),World.randomHomePos.getZ())));
    
        public static final HomeTeleport ARCEUUS = new HomeTeleport(p -> ModernTeleport.teleport(p, new Position(World.randomHomePos.getX() + ran.nextInt(2),World.randomHomePos.getY() + ran.nextInt(2),World.randomHomePos.getZ())));
    Reply With Quote  
     

  5. Thankful user:


  6. #34  
    BoomScape #1
    BoomScape's Avatar
    Join Date
    May 2013
    Posts
    2,202
    Thanks given
    254
    Thanks received
    210
    Discord
    View profile
    Rep Power
    43
    Quote Originally Posted by Ilgaz View Post
    Tele home is always in the same pos(X.Y), I want it Mics random teleports.

    This is my code:



    I will thanks and rep for the helpers.
    Try something much simpler that'll just work lol

    public static final Position HOME = Position.of(3085 + random(3), 3488 + random(3), 0);
    Reply With Quote  
     

  7. #35  
    RuneCasino


    Join Date
    Jul 2007
    Posts
    1,618
    Thanks given
    170
    Thanks received
    228
    Rep Power
    326
    Quote Originally Posted by BoomScape View Post
    Try something much simpler that'll just work lol

    public static final Position HOME = Position.of(3085 + random(3), 3488 + random(3), 0);
    If you look at page 2 we already had a discussion/fight over this.
    That won't work because of it being static final Meaning the coords will be set with the random integers and then never again. Meaning it won't be random and will always use the same random integers.
    Reply With Quote  
     

  8. #36  
    Registered Member
    Join Date
    Nov 2020
    Posts
    78
    Thanks given
    41
    Thanks received
    2
    Rep Power
    23
    Quote Originally Posted by Armo View Post
    The spellbook teleport won't be random because it's being called without the random integers. I will write something for you so you can call it for the spellbook teleports



    Replace it all with this (I tested it and it works)

    Code:
        static Random ran = new Random();
    
        public static final HomeTeleport MODERN = new HomeTeleport(p -> ModernTeleport.teleport(p, new Position(World.randomHomePos.getX() + ran.nextInt(2),World.randomHomePos.getY() + ran.nextInt(2),World.randomHomePos.getZ())));
    
        public static final HomeTeleport ANCIENT = new HomeTeleport(p -> ModernTeleport.teleport(p, new Position(World.randomHomePos.getX() + ran.nextInt(2),World.randomHomePos.getY() + ran.nextInt(2),World.randomHomePos.getZ())));
    
        public static final HomeTeleport LUNAR = new HomeTeleport(p -> ModernTeleport.teleport(p, new Position(World.randomHomePos.getX() + ran.nextInt(2),World.randomHomePos.getY() + ran.nextInt(2),World.randomHomePos.getZ())));
    
        public static final HomeTeleport ARCEUUS = new HomeTeleport(p -> ModernTeleport.teleport(p, new Position(World.randomHomePos.getX() + ran.nextInt(2),World.randomHomePos.getY() + ran.nextInt(2),World.randomHomePos.getZ())));
    You're the best Thanks so much.
    Reply With Quote  
     

Page 4 of 4 FirstFirst ... 234

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
  •