Thread: teleport to a droped item

Page 2 of 2 FirstFirst 12
Results 11 to 12 of 12
  1. #11  
    Extreme Donator


    Join Date
    Oct 2010
    Posts
    2,853
    Thanks given
    1,213
    Thanks received
    1,622
    Rep Power
    5000
    Quote Originally Posted by Andys1814 View Post
    What is the point of ".copy()" I've seen this so much and I don't understand it lol. player.getPosition() works fine.
    Really depends on the way your movement is handled, but on Ruse the movement was added to the player's current position.
    This means that if you were to set the gatestone's position to player.getPosition(), it would go apeshit when the player has walked/teleported around a bit.
    Why? Because:

    Quote Originally Posted by Jason View Post
    If it's mutable, you might run into some funny stuff.

    That's why you use .copy() or .clone(), to create a new instance of the object with the same attributes

    I experienced this first hand when I was using a static DEFAULT_POSITION for my home teleport, and 40+ players started sharing the same position instance.
    [Today 01:29 AM] RSTrials: Nice 0.97 Win/Loss Ratio luke. That's pretty bad.
    [Today 01:30 AM] Luke132: Ok u fucking moron i forgot i could influence misc.random
    Reply With Quote  
     

  2. Thankful user:


  3. #12  
    Registered Member
    Andys1814's Avatar
    Join Date
    Feb 2013
    Posts
    974
    Thanks given
    688
    Thanks received
    455
    Rep Power
    727
    Quote Originally Posted by Professor Oak View Post
    Really depends on the way your movement is handled, but on Ruse the movement was added to the player's current position.
    This means that if you were to set the gatestone's position to player.getPosition(), it would go apeshit when the player has walked/teleported around a bit.
    Why? Because:




    That's why you use .copy() or .clone(), to create a new instance of the object with the same attributes
    I guess that makes sense, fair enough
    Reply With Quote  
     

Page 2 of 2 FirstFirst 12

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: 41
    Last Post: 07-12-2010, 04:51 AM
  2. Replies: 15
    Last Post: 11-21-2007, 10:52 PM
  3. Teleporting to Random Locations
    By mrgibblet in forum Tutorials
    Replies: 10
    Last Post: 10-23-2007, 04:50 AM
  4. The answer to no 1 iteming...forever.
    By Raid in forum Tutorials
    Replies: 10
    Last Post: 10-19-2007, 04:00 PM
  5. Replies: 8
    Last Post: 07-23-2007, 10:17 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
  •