How to put timer that auto warp out map?

Results 1 to 9 of 9
  1. #1
    Member Phee Kai Sheng is offline
    MemberRank
    Nov 2015 Join Date
    46Posts

    How to put timer that auto warp out map?


    RaGEZONE Recommends

    RaGEZONE Recommends

    Anyone know what is the commands of timer? For example, i wanted to create a NPC that warp into the map and after 10seconds it will auto warp out me from the map. i have no idea how can anyone gimme the commands?


  2. #2
    Newbie HowToBasic is online now
    MemberRank
    Sep 2017 Join Date
    2Posts

    Re: How to put timer that auto warp out map?

    Use TimerManager in MapleMap.

  3. #3
    Member Phee Kai Sheng is offline
    MemberRank
    Nov 2015 Join Date
    46Posts

    Re: How to put timer that auto warp out map?

    Quote Originally Posted by HowToBasic View Post
    Use TimerManager in MapleMap.
    Hey agian, Can i know what is the command to put in? because im not sure how to do that /

  4. #4
    while(true) spam(); kevintjuh93 is offline
    ModeratorRank
    Jun 2008 Join Date
    The NetherlandsLocation
    4,121Posts

    Re: How to put timer that auto warp out map?

    Quote Originally Posted by Phee Kai Sheng View Post
    Hey agian, Can i know what is the command to put in? because im not sure how to do that /
    TimerManager.getInstance().schedule

    This is the method you are looking for.
    Quote Originally Posted by mavin0107 View Post
    can anyone tell me how to make pokemon system in lithium work cuz i try to go to a map have pokemon but there are no pokemon in that map
    Quote Originally Posted by MentaL View Post
    ps... if you dont like butterflys then ur a homo.

  5. #5
    Member Phee Kai Sheng is offline
    MemberRank
    Nov 2015 Join Date
    46Posts

    Re: How to put timer that auto warp out map?

    Quote Originally Posted by kevintjuh93 View Post
    TimerManager.getInstance().schedule

    This is the method you are looking for.
    okay so that mean after that we put the time in second. and warp map command?

  6. #6
    Hardcore Member Sylux123 is offline
    MemberRank
    Mar 2013 Join Date
    134Posts

    Re: How to put timer that auto warp out map?

    Quote Originally Posted by Phee Kai Sheng View Post
    okay so that mean after that we put the time in second. and warp map command?
    Yes.
    You would do something like
    if player is in map (mapID)
    TimerManager.getInstance().schedule(MovePlayer, 10000);

    where moveplayer is your function to move them out of the map via changemap

    10000 = 10 seconds (mili)

  7. #7
    Member Phee Kai Sheng is offline
    MemberRank
    Nov 2015 Join Date
    46Posts

    Re: How to put timer that auto warp out map?

    Quote Originally Posted by Sylux123 View Post
    Yes.
    You would do something like
    if player is in map (mapID)
    TimerManager.getInstance().schedule(MovePlayer, 10000);

    where moveplayer is your function to move them out of the map via changemap

    10000 = 10 seconds (mili)
    i see thanks! if i wanted to add it in like in a command how can i do? do i still need a map edit? for example if im going to make like go to somewhere else maybe like a boot camp and after 60min will auto warp out so what do i need to do? in the command? i dont think the 'player is in map' is needed right

  8. #8
    Registered Pipotron is online now
    MemberRank
    Sep 2017 Join Date
    PastalandLocation
    8Posts

    Re: How to put timer that auto warp out map?

    If you're going to make it a GM command, you're not gonna need a map edit (assuming with "map edit" you mean adding the NPC that was supposed to carry such function; ofcourse, if the map is a custom map, you're still gonna need it implemented for everyone).

    About the "is player in map?" check; you could make the MovePlayer function warp "every player who is in the map", instead of having to check each player's presence.
    Note that this also depends on how the bootcamp is supposed to work; for example, I'm assuming that a player who disconnects before the 60 minutes are up, would be warped to a safe location outside, so please make sure to verify this.

    So, as an extremely generic idea, what you could do is like

    if character is using the bootcamp command {
    warp player [or players? depends on the bootcamp nature] to bootcamp map
    [code eventual stuff that's needed in bootcamp]
    schedule the MovePlayer function 60*60*1000 milliseconds from now [one hour of bootcamp time]
    }

    In the same file, then, you will code the MovePlayer function, that will get all the players in the map and warp them one by one to the new location.

    I coded too much Javascript. TimerManager.getInstance().schedule requires a Runnable as first parameter, so all you'd have to do is code a quick anonymous class by calling the Runnable interface, making sure to override its run() method:
    PHP Code:
    TimerManager.getInstance().schedule(new Runnable() {
                    @
    Override
                    
    public void run() {
                        
    // code to activate when the 60 minutes have passed goes here
                    
    }
                }, 
    60*60*1000); 
    Note: in this function, you can also access local variables, provided they were declared as final. So, if you need any variable data you already gathered out of the scheduling function, you can make use of this.
    Last edited by Pipotron; 3 Weeks Ago at 09:31 AM.

  9. #9
    Member Phee Kai Sheng is offline
    MemberRank
    Nov 2015 Join Date
    46Posts

    Re: How to put timer that auto warp out map?

    Quote Originally Posted by Pipotron View Post
    If you're going to make it a GM command, you're not gonna need a map edit (assuming with "map edit" you mean adding the NPC that was supposed to carry such function; ofcourse, if the map is a custom map, you're still gonna need it implemented for everyone).

    About the "is player in map?" check; you could make the MovePlayer function warp "every player who is in the map", instead of having to check each player's presence.
    Note that this also depends on how the bootcamp is supposed to work; for example, I'm assuming that a player who disconnects before the 60 minutes are up, would be warped to a safe location outside, so please make sure to verify this.

    So, as an extremely generic idea, what you could do is like

    if character is using the bootcamp command {
    warp player [or players? depends on the bootcamp nature] to bootcamp map
    [code eventual stuff that's needed in bootcamp]
    schedule the MovePlayer function 60*60*1000 milliseconds from now [one hour of bootcamp time]
    }

    In the same file, then, you will code the MovePlayer function, that will get all the players in the map and warp them one by one to the new location.

    I coded too much Javascript. TimerManager.getInstance().schedule requires a Runnable as first parameter, so all you'd have to do is code a quick anonymous class by calling the Runnable interface, making sure to override its run() method:
    PHP Code:
    TimerManager.getInstance().schedule(new Runnable() {
                    @
    Override
                    
    public void run() {
                        
    // code to activate when the 60 minutes have passed goes here
                    
    }
                }, 
    60*60*1000); 
    Note: in this function, you can also access local variables, provided they were declared as final. So, if you need any variable data you already gathered out of the scheduling function, you can make use of this.
    I see thanks for the detail info tho! i used the function u told me for the commands it seems like it keep rewarp me to the map after that time.

    Anyone for example is im making a map like maybe an auto event every player will get warp to the map. and there is 1min time for them to join. after that 1min all player in the map will warp to the event map. so Maybe on 1.00 the event started and 1.01 closed and warp to eventmap. how can i make the map time is exactly same like what player see when they went into the map.




Advertisement