1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

Teleporting by scheduler

Discussion in 'Development' started by BruhLol, May 17, 2017.

  1. BruhLol

    BruhLol Baby Zombie

    Messages:
    122
    How to delay teleporting? Like 6-7 seconds from a task, so lag gets reduced .. and if the player moves while teleporting scheduler is running, it should get cancelled, i think that could be done by sending the player's position to the scheduler and checking if they are the same after 6-7 seconds?
     
    Last edited: May 17, 2017
  2. Lowkey

    Lowkey Slime

    Messages:
    94
    BruhLol and jasonwynn10 like this.
  3. Thunder33345

    Thunder33345 Moderator Staff Member

    Messages:
    2,137
    GitHub:
    Thunder33345
    are you trying to do a TP warnup? please give us more context as for how that would reduce "lag"
    if you are doing a warmup TP task is the way to go
    the Task will be a delayed task, accepting Player, which you pass cloned Player in(citation needed: reasoning since the player will move and we just want the current pos not future pos)
    in the onRun, you should distance cloned Player with CURRENT player by getting the player using server with the name off cloned player
    not tested, but should work, if not pass in a just reconstruct the vector3 and player name, using these instated
     
    BruhLol likes this.
  4. falk

    falk Slime Poggit Reviewer

    Messages:
    75
    GitHub:
    falkirks
    BruhLol likes this.
  5. Muqsit

    Muqsit Chicken

    Messages:
    1,548
    GitHub:
    muqsit
    I think you should do this too..
    PHP:
    /** @var Position $warp */
    //class extending Task
    public function __construct(...){
        
    //...
        
    $warp->getLevel()->loadChunk($warp->>> 4$warp->>> 4);
    }
     
    BruhLol and jasonwynn10 like this.
  6. BruhLol

    BruhLol Baby Zombie

    Messages:
    122
  7. falk

    falk Slime Poggit Reviewer

    Messages:
    75
    GitHub:
    falkirks
    Nope, my code is happy the way it is. If I was using teleportImmediate I would need to do this. But teleport handles the chunk loading and waits until chunks are sent.
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.