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

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×
×
  • Create New...

Important Information

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