Jump to content
  • 0
garro

Npc that opens at certain times

Question

Hello community, you can help me with a script that will open example at 15hrs and 19hrs, I will transport you to X map and let you be only 10 min inside it, and then leave you on the map you saved. That if the npc does not tell you I still can not teleport you wait 15hrs or 19hrs. Thanks in advance

Share this post


Link to post
Share on other sites

1 answer to this question

Recommended Posts

  • 0

maybe something like this:

map,x,y,dir	script	npc name	sprite,{

    if (gettime(GETTIME_HOUR) == 15 || gettime(GETTIME_HOUR) == 19) {
        mes("I will now teleport you to the map.");
        close2();

        // check the hour again, because the player can wait before closing
        if (gettime(GETTIME_HOUR) == 15 || gettime(GETTIME_HOUR) == 19) {
            warp(.dest_map$, .dest_x, .dest_y);
            addtimer(600000, strnpcinfo(NPC_NAME) + "::OnComeBack"); // 10 minutes
            end;
        }
    }

    mes("Sorry, I cannot teleport you right now.");
    next();
    mes("Come back at 15H or 19H.");
    close;

OnComeBack:
    warp("SavePoint", 0, 0);
    end;

OnInit:
    .dest_map$ = "destination map";
    .dest_x = 0;
    .dest_y = 0;

    // fallthrough

OnHour16:
OnHour20:
    // force any remaining player to come back if for whatever reason they are still there
    .@count = getunits(BL_PC, .@players, false, .dest_map$);
    for (.@i = 0; .@i < .@count; .@i++) {
        deltimer(strnpcinfo(NPC_NAME) + "::OnComeBack", .@players[.@i]);
        addtimer(0, strnpcinfo(NPC_NAME) + "::OnComeBack", .@players[.@i]);
    }
    end;
}

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.