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;
}